Show/Hide fields basing on URL params

  • Profile Image
    Filip
    Asked on January 17, 2012 at 07:43 AM

    I need to show/hide some fields on my form basing on arguments passed in query string e.g. if formUrl?showName=true then show name textbox, otherwise hide it.

    In form`s conditional logic I tried to use hidden boxes that were prepopulated by those URL params but this doesn't work, as per thread:

    http://www.jotform.com/answers/37986-Is-there-a-way-I-can-use-hidden-fields-to-show-certain-questions?entrymessage=10732640770

    Is there any other solution than the one presented in the linked thread?

  • Profile Image
    Filip
    Answered on January 18, 2012 at 05:15 AM

    We host our own instance of JotForm - maybe we could introduce a code change to the JotForm source that would allowe that? It's much more convinient than modyfing code of each form we create.

    If this is possible, please advise how.

    --

    My main issue with the solution suggested by Neil is that I would need to create a separate page for each parameter combination. In my form I have 25 fields and currently only 1 needs to be shown/hidden basing on the url param value. Using this solution I would have to recreate 24 fields on another page.

    What would happen if on the same form I had 2 fields whose visibility depends on different url params - I would need to create 4 pages, each containing at least 23 fields.

     

  • Profile Image
    Mike_T
    Answered on January 18, 2012 at 05:21 PM

    Hello Filip,

    Please note that you can also put all the hidden questions to page 2 (related to Neil's solution), and other visible fields to page 3.

    http://form.jotform.com/form/20170353934?website=email

    http://form.jotform.com/form/20170353934

    Please give it a try, and let us know if you need any further assistance.

  • Profile Image
    Mike_T
    Answered on January 18, 2012 at 05:28 PM

    I would like to add that you do not have to re-create the fields. According to Neil's condition, all the "page 2" will be skipped.

  • Profile Image
    Filip
    Answered on January 19, 2012 at 02:45 AM

    The problem is that I need to display all the fields on the same page. I would only use pages to implement this showe/hide functionality.

    The end user should always see a single page and there should be no need for clicking 'Next' button at any time.

    It seems it's not achievable with current version. Can you advise the necessary code changes?

  • Profile Image
    youthencounter
    Answered on November 09, 2012 at 02:05 PM

    I know this thread is old, but I was looking for a solution to this as well, found this thread, and then came up with a better work around.

    You can use the conditional show/hide method of individual fields if you pass in a paramater to a radio box field.

    Then you can hide the radio box field with CSS.