First of all, thank you for the great component you made!
I am using ChronoForms V3.2.0.
I made dynamic form based on tutorial in FAQs of this site. In my case "dynamic" means that at the beginning users can see fields (dimensions, weight) only for one cargo unit, but they can tick a checkbox and javascript will unhide 2nd (or 3rd, 4th, etc) cargo unit's fields. I made php loop that generates code for 20 cargo units. So users can order any amount of cargo form 1 to 20.
The problem is that user ordering 1 cargo unit will receive conformation e-mail with 19 empty cargo units' fields.
I thought, that putting following code in email template will solve my problem. As field variables I use {text_number}. I simplified my code so you can easier get the idea.
I was hoping that loop will iterate trough {text_number} till it finds string "text", which will mean that this field was empty and no need to show the rest of the units to user, cause he/she did not fill them out.
But the email template loop did not work. I guess it is because ChronoForms populate field variables only after the php of email template had been processed. But that doesn't really help me to solve my problem.
I spent more then 5 hours going trough forums, but was unable to find a solution.
I would really appreciate if you could help me with this!
I am using ChronoForms V3.2.0.
I made dynamic form based on tutorial in FAQs of this site. In my case "dynamic" means that at the beginning users can see fields (dimensions, weight) only for one cargo unit, but they can tick a checkbox and javascript will unhide 2nd (or 3rd, 4th, etc) cargo unit's fields. I made php loop that generates code for 20 cargo units. So users can order any amount of cargo form 1 to 20.
The problem is that user ordering 1 cargo unit will receive conformation e-mail with 19 empty cargo units' fields.
I thought, that putting following code in email template will solve my problem. As field variables I use {text_number}. I simplified my code so you can easier get the idea.
<?php
for ($unit = 1; $unit <= 10; $unit++) {
$UnitValue = "{text_$unit}";
if(stristr($UnitValue, "text") === FALSE)
{
echo "<p><h3>Unit No. $unit</h3></p>";
echo "<p><b>Weight:</b> {text_$unit}</p>";
}
else
break;
}
?>
I was hoping that loop will iterate trough {text_number} till it finds string "text", which will mean that this field was empty and no need to show the rest of the units to user, cause he/she did not fill them out.
But the email template loop did not work. I guess it is because ChronoForms populate field variables only after the php of email template had been processed. But that doesn't really help me to solve my problem.
I spent more then 5 hours going trough forums, but was unable to find a solution.
I would really appreciate if you could help me with this!