What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
Default values lost in edit modeAsked by NRCsupport on March 17, 2014 at 01:13 PM
There are two fields on the third page of this form with important default values.
Number of places should default to 1 and Price each should default to 12.50
These two fields lose their contents and are blank in the following situation:-
1. Submit form having replied "no" to "do you wish to attend our quiz night?" (Those two fields will not have been shown)
2. On the thank you page, select and copy the edit link displayed (this is the same as edit_link, but built in a calculation field)
3. Paste the link into the browser bar and go to it.
4. The form reopens in edit mode.
5. Go to the third page and select "yes" for "do you wish to attend our quiz night?".
6. Those fields and some others will now be displayed, but those two are blank instead of containing their default values. You can enter numbers into the number of places field, but the price field is read only and cannot be changed, so the calculated total remainsas zero.
PS. I've checked and found the same problem when using the edit_link on the notification emails.
Yes - I see what you mean...all the default values do not populate.
There's a script overriding the 'value' attribute for the input fields which carry the default-prepopulated value.
I understand this behavior, as it may prevent the 'edit' mode values from being manipulated on preload - even if the field property is set as read only - that would invalidify certain outcomes on the form if the value was effected (in certain instances)
I have a suggestion to overcome this:
1. Clone this form: http://www.jotformpro.com/form/40755679855977
2. Submit it and play around with the edit link in the email notification - I'm certain the set value does not get cleared as it exists as a property of the field
Using preselected checkboxes/radio buttons with numerical values might be what you need to overcome that.
What do you think?
Thank you. I am not entirely convinced.
Here is the thankyou url produced after submitting the form:-
Note quiz=no, numberOf= , priceEach= , totalCost= , formid=40503979576971
The value of quiz is the answer to the question about attending the quiz night. numberOf is the number of places (which defaults to 1), priceEach is the price per place which defaults to 12.50), totalCost should be the product of the two previous fields (i.e. defaultsto 12.50), and formid is the form id, and is preset as the default value of a field at theend of the form.
The formid is set as the default value of a text box with the hidden attribute set. It retains its value correctly in this url, and is also still correct when the submission is reopened to edit.
Number of places and price per place are set as the default values of two text buttons which are not set as hidden, they are made hidden as the result of a condition. (They are visible only when "quiz" is yes rather than no.)
So, as I see it, a field which is always hidden (such as formid), but one which is controlled by conditions loses its value if hidden at the time of submission. This does not seem sensible to me, and I don't quite follow your argument as to why it is reasonable.
I am going to try a different method - putting the price in an always hidden field, and using a calculation widget to copy it to a field which is displayed or hidden as required.
I'll get back and let you know how it turns out.
OK I've got it working reasonably.
I don't mind the "number of places" field coming back empty rather than defaulting to 1. It only requires the input of one digit (1 to 8) to set the required number.
I've done a peculiar thing on the price each field. I've made it into a calculated field with a value of 12.50 * (NumberOfPlaces / NumberOfPlaces). Obviously (NumberOfPlaces / NumberOfPlaces) is always 1, but because it refers to that field, the calculation is updated each time the number of places is altered, so as soon as anything is put into that field, the price each field gets set to 12.50.
I don't really like this, and although in general it makes sense to clear out fields hidden by a condition, I feel that if they have a default value, then they should be cleared back to the default rather than to empty.