Forums

Dont send empty fields

Ademma 03 Mar, 2016
Hi Chrono-Team🙂

According to this topic: http://www.chronoengine.com/forums/posts/f2/t96375/don-t-send-empty-field.html i have 2 questions:

Is it possible to hide all empty fields in the email with a shorter php code? I created a big form and i dont want to edit every line. that would cost too much time😟

the way u descripted it in the linked topic above works fine but i got this when i try to use this on check boxes:

array ( 0 => 'value', )

no doubt u have some great ideas😉

Best regards
Robert
GreyHead 03 Mar, 2016
1 Likes
Hi Robert,

a. No - ChronoForms has no way of knowing which lines you want to include and which to skip. You can possibly use a PHP loop to simplify the code.

b. Please drag a Handle Arrays action into the OnSubmit event and move it up before the Custom Code action.

Bob
Ademma 04 Mar, 2016
Hi GreyHead, thanks for answer!

As a designer my php skills are not that good😟

This code works fine for hiding empty textfields in the email:
<?php if(!empty($form->data["fieldname01"])): ?>
Label: {fieldname01}
<?php endif; ?>


But when wrap this code around a checkbox field it results into this output in the email:

array ( 0 => 'value01', 1 => 'value02', )

Could u please provide me the handle array you talk about into the submit button to avoid this? i have no clou how to do this :/

Thank u so far🙂
GreyHead 04 Mar, 2016
Hi Ademma,

[attachment=0]2016-03-04_11-57-45.png[/attachment]

Bob
Ademma 04 Mar, 2016
Thanks for reply🙂

now i get this error when i try to setup the handle array😟

please see screenshot attached.
GreyHead 04 Mar, 2016
Hi Ademma,

They are warnings, not errors - you can usually hide them by setting your site Error Reporting to System Default or None in the site Global Configuration.

These particular warnings can happen if you have a form input with no label - try putting a single space in the label if you want to leave one blank.

Bob
This topic is locked and no more replies can be posted.