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.
Problem with conditionsAsked by NRCsupport on November 15, 2015 at 01:51 PM
Please could you try to find why the conditions on this form don't work properly. I attach a screenshot showing what happens when I try to use the form. The three date/time fields on the 4th and 5th lines, should all contain the same as the other two date time fields, and the currentmode field should contain "dataentry".
Is there any way of single stepping through the conditions to find out what is going wrong?
I am sorry, but I do not understand what you are trying to accomplish with your conditions here.
First of all, there is no need for this condition, if you have a field which is empty, why inserting "empty" into the empty field? I'ts like inserting air in an empty glass.
Also, these conditions are conflicting between them:
Here is another view, it's mixed up, you are updating with different values the same field, and at the same time, updating the field value if the value is equal to i'ts current value:
There are conflicts between conditions, and unnecessary conditions. Could you explain the workflow you want to accomplish?
I am still working on making my form distinguish between initial data entry and viewing/editing a previous submission.
currentmode is used to tell it where we have got to, and what to do next.
Normally when data entry is allowed currentmode contains "dataentry". When it contains any othervalue all the normal fields are disabled (greyed out) and currentmode contains "viewonly". In viewonly mode, each page incldes a checkbox which can be checked in order to enable editing. If any of these are checked, the mode becomes "dataentry" and the normal data fields become enabled.
The other values in currentmode are used in order to get things set up on startup and on change from "viewonly" to "dataentry".
The initial putting of "empty field" into currentmode is because on loading a previous submission for view/edit, currentmode will get loaded with what it contained when the submission was made, i.e. "dataentry". I cannot leave that value there until I get the request to switch from viewonly to dataentry
Hi again. I've slightly altered the conditions, so please look at the latest version. Conditions 5, 13 and 14 do not appear to insert anything into the destination fields.
I've just had a thought.Is it possible that conditions which set a value into a field, actually empty the field if their rules are false. I'll try some experiments.
I'm also having a hard time understanding the current workflow of your form. Perhaps you could share us a sample flow on how your form is completed? If I am not mistaken, the form can be filled out (dataentry mode), can be viewed only (viewonly mode), etc...
But we're not sure how your form is being filled out, is there an initial person that will fill it out, who is the person that will update or edit the submissions? And who is the person that can "view only" the submissions?
I'm also not sure if the following conditions you have will work:
You are changing the value of the input field depending on the value of it. It is actually a conflict, unless I'm missing something on the flow of your forms. In this case, there will never be a instance that there's a "newsession as it will only be overwritten to something. Same goes with the "viewonly", there will never be a submission with a "viewonly" because it will only be overwritten. However, I'm still not sure how your form works so I might be wrong with my observation.
OK, I'll try to explain my ideas.
Anyone can complete and submit a new form.This is dataentry mode.
Using the edit_link from the thankyou page or the auto responder email they can later look at the submission and if necessry alter it. Also I (as NRCSUPPORT.COM) can use the edit link on the notifier message to look at and if necessary alter the submission.
When entering from the edit_link I want the form to be locked initially (all fields disabled), so that it is not possible to alter the contents accidentally by hitting the keyboard. This is the viewonly mode. The submit button is hidden in this mode, so resubmission is not possible.
In order to edit and resubmit, you must check one of the "click this box to allow data editing" fields. There is one on each page to avoid having to use back and next. If any of these are checked the form returns to dataentry mode, all fields are re-enabled and the submit button is shown. Now it is possible to change data and resubmit the form.
So submissions are always made in dataentry mode. Similarly newsession is only used as an intermediate stage, in order to carry out operations that only need to be done once.
I now believe that conditions which fill a field when true, actually clear the field when false. I had initially thought that they would leave the field unchanged when false. I am working on another version which does not rely on my initial (but apparantly wrong) understanding. I am have a different problem with that version, and I'll start a thread about that shortly. So I think we can terminate this thread. Thank you for your help.
Thank you for sharing us this information. If you open a new thread, you can use this link as a reference and share it to the support staff that will assist you.
For existing submission and you want to edit it, it's the same concept that I shared above BUT you will need to use the API in your custom script to fetch the submissions and prepopulate it on an HTML form for updating or viewing purposes. You can learn more about our API and how to get submission data here: http://api.jotform.com/docs/#submission-id.
But please do try experimenting using our conditional logic. I hope that gives you an idea on how to proceed.