Forums

TCPDF - Hide Empty Fields

lydianp18 03 Apr, 2015
Love Chronoforms 5, but I'm having an issue hiding Empty Fields when using TCPDF. They automatically hide in the email, but not on the pdf. Not sure even where to start.

I found this snippet in another post:

<?php if(!empty($form->data["field_name"])): ?>
{field_name}
<?php endif; ?>


but not really sure how to adapt it... any help is appreciated.

Thanks
Lydia
GreyHead 03 Apr, 2015
Hi Lydia,

Please try
<?php
if(!empty($form->data["field_name"])):
  echo $form->data["field_name"];
endif;
?>

Bob
lydianp18 03 Apr, 2015
Ok, I'm dense. I don't get where I'm supposed to plug that in (in the older version I'd put it in it's own custom code event?).

I tried putting at the top of the content box of the TCPDF event (it says it's php friendly) - it didn't do anything.

I'm also not sure if I change "field_name" to the actual field name - I tried it both ways.

Thanks
L
GreyHead 04 Apr, 2015
Hi Lydia,

Yes, you do need to replace 'field_name' with a real field name - possibly many of them . . .

Please drag a Debugger action into the On Submit event, then submit the form and post the debug results here. You may need to set the TCPDF action to Save to Server to get that to display anything, if it's troublesome please generate an email template and post that here instead.

Bob
lydianp18 05 Apr, 2015
I'm still not sure where to plug it in?
lydianp18 05 Apr, 2015
and it's ONLY doing this for checkboxes...
GreyHead 06 Apr, 2015
Hi Lydia,

Please give a little more detail with your questions.

+ Plug what in exactly?

+ What is doing what only for checkboxes? If you have checkbox groups then you may need to add a Handle Arrays action to convert the result to a comma separated list.

Bob
lydianp18 06 Apr, 2015
I'm not sure where I put this:

<?php
if(!empty($form->data["field_name"])):
  echo $form->data["field_name"];
endif;
?>


Does it go in the content box of the TCPDF action where the field is, or does it go in a custom code event before that?

As for the Arrays - I have the handle array action added and the chekcbox fields output properly when at least one of the boxes is checked. It's just when they don't choose anything and it's empty that I get the {field_name} instead of just blank space. It works fine for any other kind of field type (text, dropdown, etc..) - if it's left blank on the form, it's blank on the output.

This is what's currently in the TCPDF box:

<table>
<tr>
  <td colspan="2">Patient Name: {patient}</td>
  <td>Date of Birth: {dob}</td>
  <td colspan="2">Email: {email}</td>
</tr>
<tr><td height="28" colspan="5"> </td></tr>
<tr><td width="37">{generalhealth}</td><td colspan="4">Is your general health good?</td></tr>
<tr><td> </td>
  <td colspan="4">If NO please explain: {ghifno}</td>
</tr>
<tr>
  <td> </td>
  <td colspan="4"> </td>
</tr>
<tr><td>{healthchanged}</td><td colspan="4">has there been a change in your health within the last year?</td></tr>
<tr><td> </td>
  <td colspan="4">if YES, explain: {healthchangeexplain}</td>
</tr>
<tr>
  <td> </td>
  <td colspan="4"> </td>
</tr>
<tr><td>{ervisit}</td><td colspan="4">Have you gone to the hospital or emergency room or had a serious illness in the alst three years?</td></tr>
<tr><td> </td>
  <td colspan="4"> If YES, explain: {erexplain}</td>
</tr>
<tr>
  <td> </td>
  <td colspan="4"> </td>
</tr>
<tr><td>{drcare}</td><td colspan="4">Are you being treated by a physician now?</td></tr>
<tr><td> </td>
  <td colspan="4"> If YES, explain: {drcarereason}</td>
</tr>
<tr><td> </td>
  <td> Date of last medical exam: {medexam}</td>
  <td colspan="6">Reason for exam: {mdexamwhy}</td>
</tr>
<tr>
  <td> </td>
  <td colspan="4"> </td>
</tr>
<tr><td>{problemsdental}</td><td colspan="4">have you had problems with prior dental treatment?</td></tr>
<tr><td> </td>
  <td colspan="4">If YES, explain: {dproblems}</td>
</tr>
<tr><td> </td>
  <td>Date of last dental exam: {dentalexam}</td>
  <td colspan="6">Reason for exam: {dentalexamwhy}</td>
</tr>
<tr>
  <td> </td>
  <td colspan="4"> </td>
</tr>
<tr>
  <td>{inpain}</td><td colspan="4">Are you in pain now?</td>></tr>
<tr><td> </td>
  <td colspan="4">If YES, explain: {painyes}</td>
</tr>
<tr>
  <td height="21" colspan="5" valign="bottom"> </td>
</tr>
<tr>
  <td height="26" colspan="5" valign="bottom" bgcolor="#CCCCCC"><strong>II. I have experienced the following:</strong></td>
</tr>
<tr><td colspan="5">{exp1group}</td></tr>
<tr>
  <td height="21" colspan="5" valign="bottom"> </td>
</tr>
<tr><td height="21" colspan="5" valign="bottom" bgcolor="#CCCCCC"><strong>I have had, or I have the following: </strong></td></tr>
<tr><td colspan="5">{exp3group}</td></tr>
 <tr>
   <td height="21" colspan="5" valign="bottom"> </td>
 </tr>
 <tr><td height="21" colspan="5" valign="bottom" bgcolor="#CCCCCC"><strong>I am allergic or have had a reaction to:</strong></td></tr>
 <tr><td colspan="5">{allergic}</td></tr>
<tr>
  <td colspan="5">Other Alelrgies: {othallergic}</td>
</tr>
 <tr>
   <td height="21" colspan="5" valign="bottom"> </td>
 </tr>
 <tr><td height="21" colspan="5" valign="bottom" bgcolor="#CCCCCC"><strong>I am taking, or have taken within the last 3 months:</strong></td></tr>
 <tr><td colspan="5">{taking}</td></tr>
<tr>
  <td colspan="5">Please list: {takenlist}</td>
</tr>
<tr>
  <td height="21" colspan="5" valign="bottom"> </td>
</tr>
<tr><td height="21" colspan="5" valign="bottom" bgcolor="#CCCCCC"><strong>Women Only:</strong></td></tr>
<tr><td>{pregnant}</td><td colspan="4">Are you or could you be pregnant?</td></tr>
<tr><td> </td>
  <td colspan="4">If YES, what month?: {pregmonth}</td>
</tr>
<tr><td>{nursing}</td><td colspan="4">Are you nursing?</td></tr>
<tr><td>{birthcontrol}</td><td colspan="4">Are you taking birth control pills?</td></tr>
<tr>
  <td height="21" colspan="5" valign="bottom"> </td>
</tr>
<tr><td height="21" colspan="5" valign="bottom" bgcolor="#CCCCCC"><strong>All Patients</strong></td></tr>
<tr><td>{otherdisease}</td><td colspan="4">Do you have or have you had any other diseases or medical problems NOT listed on this form?</td></tr>
<tr><td> </td>
  <td colspan="4">If YES, please explain; {othdiseasetxtyes}</td>
</tr>
<tr><td>{premeddental}</td><td colspan="4">have you ever been pre-medicated for dental treatment?</td></tr>
<tr><td> </td>
  <td colspan="4">If YES, why: {premedyestxt}</td>
</tr>
<tr><td>{fenphen}</td><td colspan="4">Have you ever taken Fen-Phen?</td></tr>
<tr><td> </td>
  <td colspan="4">If YES, when: {fenyestxt}</td>
</tr>
<tr><td height="27">{privatetalk}</td><td colspan="4">Is there any issue or condition that you would like to discuss with the dentist in private?</td></tr>
<tr>
  <td height="21" colspan="5"> </td>
</tr>
<tr>
  <td height="59" colspan="5"><em>The practice of dentistry involves treating the whole person. If the dentist determines that there may be a potentially medically compromised situation, medical consultation may be needed prior to commencement of dental treatment.<br/>
  I authorize Dr. Rashidi to contact my physician</em></td></tr>
<tr>
  <td colspan="3">Signature of Patient: {certsigpatient}</td>
  <td colspan="2">Date: {certsigpatientdate}</td>
</tr>
<tr>
  <td colspan="3">Physician's Name: {mdktsigname}</td>
  <td colspan="2">Phone Number: {mdktsigmdtel}</td>
</tr>
<tr>
  <td height="24" colspan="5"> </td>
</tr>
<tr><td height="46" colspan="5"><strong>I certify that I have read and understand this form. To the best of my knowledge, I have answered every question completely and accurately. I will inform my orthodontist of any change in my health and/or medication. Further I will not hold my orthodontist, or any other member of his staff, responsible for any errors or omissions that I may have made in the completion of this form.</strong></td></tr>
<tr>
  <td colspan="3">Signature of Patient: {certsigpatient}</td>><td colspan="2">Date: {certsigpatientdate}</td>
</tr>
</table>
Fawaaz 20 Apr, 2015
Hello,

Having the same problem here? Any workaround for empty checkboxes so that they don't appear as {field_name} in the PDF please ?
Fawaaz 24 Apr, 2015
Anyone please ?
moggster 27 Apr, 2015
I am also having this issue.. the plugin works great; however fields that are not filled in show the tags {field_name}... not brilliant with PHP myself, I think it just needs something to strip out blank fields on submit.
Max_admin 27 Apr, 2015
Please send me a message using the "Contact us" page to test a patch file for this!

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Fawaaz 04 May, 2015
Hello MAX,

Any news for the patch?
Max_admin 04 May, 2015
Please send me a message using the "Contact us" page to test it.

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.