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.


  • Profile Image

    Required Field Cannot Be Bypass Using Show/Hide Condition

    Asked by chatton on June 14, 2013 at 09:17 AM

    I have a required field that triggers a conditional field - which is required if the condition is met. The problem is when the condition is not met the validation for the hidden conditional field creates an invalid data error.

    Ex.

    Are the shipping and billing the same? Yes/No

    If no show the address field - which is required

    If yes do not show address field

     

    When yes is selected and the form is submitted the user receives an error stating the shipping address is required.

     

    My quick work around was to make the shipping address not required - but of course I would prefer the form worked like it once did. This is a new problem that I'm guessing is related to the recent update. As of a few days ago my form was working fine.

    Page URL:
    www.cccables.com/contact/payment.aspx

    address field required field problem hidden
  • Profile Image

    Answered by jefreylandicho on June 14, 2013 at 10:10 AM

    I have tested your form and was able to replicate the same issue. I have forwarded your concern to our developers to investigate the cause of this issue.Please expect a response from one of them soon.

    If you have any other concerns, please do not hesitate to contact us again.

  • Profile Image

    Answered by T. Gray on June 14, 2013 at 02:31 PM

    Same problem with conditional payment choice, both payment options were set as required fields but only one would show per user choice. Now if Pay by Check is selected, error message of Pay by PayPal is required appears. As above, did a quick fix and set both payment fields to not required, but this is not what I prefer. Form seemed to be work OK as of yesterday.

    Page URL: http://www.elpasoartassociation.com/atbshowentry.html

  • Profile Image
    JotForm Support

    Answered by NeilVicente on June 14, 2013 at 02:41 PM

    @T.Gray

    I have just released a fix for this bug a few hours ago. Please set your payment field as 'Required' again, and let me know if you still encounter issues.

    Best regards

  • Profile Image

    Answered by gpcwebs on June 14, 2013 at 03:25 PM

    Just did as you requested and set payment fields to required. Problem does not appear to be fixed. Received the following error message, so I have reset the fields to not required. This form is in use today so I have to have it working. Thank you for any help you can give and for your prompt response.

    Incomplete Values
    There are incomplete fields in your submission: Pay NOW with Credit Card through PayPal is requiredPlease go back and fix the problem(s)
  • Profile Image

    Answered by chatton on June 14, 2013 at 03:44 PM

    Fixed for me!!

    Thank you

  • Profile Image
    JotForm Support

    Answered by Mike_T on June 14, 2013 at 04:12 PM

    @Gpcwebs,

    Is there a form that we can check?

    @Chatton,

    We are happy to hear that. Thank you for update.

  • Profile Image

    Answered by gpcwebs on June 14, 2013 at 06:05 PM

    Set the fields back to required and everything seems to be working again. Thank you so much for the support. Looks like the problem is fixed.

  • Profile Image

    Answered by GAPTAOnline on July 03, 2014 at 08:14 PM

    I'm not sure if the problem was re-introduced, or whether the problem is more complex allowing it to work for some and not for others, but for those that are having issues like me, I found a decent work around for forms that are embedded on your own site.  There is a JavaScript function in jotform.js that handles setting or unseeting the required field condition.  The first argument is the field number (the number at the end of the field's id) for the field you want to change the required option on and the second argument is either true to enable the required requirement or false to disable it.  For example:

    JotForm.requireField("21",false);

    would remove the required requirement from the input question number 21.  Then you can just use jQuery or any other library you chose to show or hide the question.  I found the easiest way was to add a div with a related id for example, surrounding the set of elements that needed to be hidden.  Then you just hide the div and call the above function to remove the required requirement and do the opposite to show and enable it.

     
    An example of a multi field use case is as follows:
     
            function showHideVP() {
            var numVP = parseInt($j("#input_54 option:selected").prop("value"));
            switch (numVP) {//Hide VP fields cascading to include up to the correct number.
            case 1:
            hideFields(2,34,35,39);
            case 2:
            hideFields(3,40,41,45);
            case 3:
            hideFields(4,46,47,51);
            case 4:
            hideFields(5,87,88,92);
            case 5:
            hideFields(6,81,82,86);
            case 6:
            hideFields(7,93,94,98);
            case 7:
            hideFields(8,99,100,104);
            }
            switch (numVP) {//Show VP fields cascading to include up to the correct number.
            case 8:
            showFields(8,99,100,104);
            case 7:
            showFields(7,93,94,98);
            case 6:
            showFields(6,81,82,86);
            case 5:
            showFields(5,87,88,92);
            case 4:
            showFields(4,46,47,51);
            case 3:
            showFields(3,40,41,45);
            case 2:
            showFields(2,34,35,39);
            }
            }
     
            function showFields(divID, field1, fieldset2, field3) {
            $j("#vp"+divID).show();
            JotForm.requireField(field1,true);
            JotForm.requireField(fieldset2,true);
            JotForm.requireField(field3,true);
            }
     
            function hideFields(divID, field1, fieldset2, field3) {
         $j("#vp"+divID).hide();
            JotForm.requireField(field1,false);
            JotForm.requireField(fieldset2,false);
            JotForm.requireField(field3,false);
            }

    This set of functions uses a drop down element to choose the number of vice presidents to show (1 is required, but the other's are optional. and divs with related ids are set around each group of questions. The functions showFields and hideFields just take in the numbers for the fields in each group.  I had to create duplicate fields for each additional vice president, and then look up the numbers for each field in the group and add them to the cascading switch statements to show and hide them.  A bit of work, but it was actually less than the work when I tried to set this up using the built in conditionals.

    I hope this helps anyone else struggling with this issue.