How can I make fields "required" or "not required" depending upon a url query parameter?

  • AlecTaylor
    Asked on October 26, 2017 at 7:47 AM

    Hi,

    I'd like to set up a form that changes depending upon a parameter passed to the form via a URL query string.

    In effect, I have 2 calls of the same form:

    1. Request an e-mailed response (e.g. ?responsetype=email)

    2. Request a call back (e.g. ?responsetype=callback)


    Both versions of the form have the same information, images, fields, etc. But:

    if the first is called, the form needs to make the email field "compulsory" and the telephone field "optional"

    if the second is called, the form makes the telephone field "compulsory", but the email field "optional".

    In doing this, I'm trying to maintain just the one master form (which is in 4 different languages....) for everything, rather than maintaining similar forms in parallel to one another, i.e. reduced maintenance. Hope this makes sense!

    Thanks!

    Alec.


  • Marvih
    Replied on October 26, 2017 at 10:16 AM

    I am not sure if it is really necessary to have those in different forms since It can be possible in just a single form.

    I have created a very simple form with the functionality you requested in it.

    https://form.jotform.com/72983860921971

    Not sure if that would work for you but if yes, I am willing to explain what I did.

    Let us know your thoughts.

  • AlecTaylor
    Replied on October 26, 2017 at 11:11 AM

    Ah Ok. Yes, this would work thanks.

    I can now see that there is the option under the conditions section that will manage this for me.

    Also, I could pass the URL queried parameter into a hidden field on the form, then "hide" or "show" the relevant input fields using the same conditional rules.

    Sorted! Thank you, Alec.

  • Marvih
    Replied on October 26, 2017 at 12:14 PM

    Glad it worked for you :) contact us anytime you need help.