- bmanfieldAsked on August 01, 2015 at 08:05 PM
I'm calculating age and its working well. When I preview the form though it populates the field with a value (115) before the date of birth is populated. Could you tell me how I can make the field stay blank. The wait for input in advanced options doesnt work without breaking the calculation.
- JotForm SupportBDAVIDAnswered on August 01, 2015 at 09:49 PM
That's because the math functions do not read the "wait for input" option, a workaround on this is to insert those values(Today's Date, and 365.25) based on a condition IF Date of Birth field is filled:
1) We add two calculation widgets:
2) We create two conditions to fill them with the corresponding values if Date of Birth field is filled:
3) We replace the values for those fields into the Form Calculation widget that displays the age?
This is how it works know:
Here is my cloned version: http://form.jotformpro.com/form/52128308346958?
You may clone it if you want to: http://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL
Let us know if you need more help, we will be glad to assist you.
- bmanfieldAnswered on August 01, 2015 at 11:03 PM
Thanks for the answer! :-) The system is a little clumsy that you have to add so many hidden fields to make it work. I'm going to do it the easy way and simply hide the age field until DOB is filled.
I've also found that hidden fields cant be grouped after the submit button. I was trying to do this to deal with the tidiness of the form layout for global hidden variables but it broke the form.
Thanks again for your help.
- JotForm SupportMike_GAnswered on August 02, 2015 at 03:19 AM
You might want to consider using a regular TextBox for Age field instead of using a Form Calculation Widget.
And then, create your condition using the Condition Wizard:
Here, you would only be needing one hidden field(Current Date). And, part of the Condition is that it will wait for the Date Field to be filled before the computation starts and place an output to the Age field.
You might want to check the form I've used in my example: http://form.jotformpro.com/form/52131025777956
I've also found that hidden fields cant be grouped after the submit button.
I'm not sure what you mean hear clearly, but I have tried placing the hidden field after the Submit button and the condition still works:
I hope this helps. Let us know if you need any further assistance. Thank you.
- bmanfieldAnswered on August 02, 2015 at 04:29 AM
Thanks Mike_G for your solution it works except I needed to use a number field to get the right conditional logic for the subsequent logic. (Age greater than/Age less than etc)
I'll go back and check the hidden fields being published after the submit button problem.
- JotForm SupportMike_GAnswered on August 02, 2015 at 05:40 AM
You can, also, use the Number field for the Age field instead of a regular TextBox field if you will be needing it for a condition that requires you to know if the value of the Age field is Greater Than or Less than another value.
Here's the form I've used this time: http://form.jotformpro.com/form/52132443202944
I hope this helps.
As for the hidden fields added after the submit button, please do update us of your findings and let us know if you need any further assistance. Thank you.
- bmanfieldAnswered on August 03, 2015 at 03:26 AM
That's what I did :-) I'd already worked that out.
Thanks for your help.