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
    fxr
    Answered on January 17, 2012 at 04:57 PM

    Thanks Filip,

    OK, I can see what your problem is now. 

    The only other solution to that shown in that thread is to download your form source code, upload the form source code to a webserver add a little javascript / php to the forms code. 

    Even though we may be able to help with the scripts, it is still quite a lot of work. 

    --

    I am trying to think why the solution offered by Neil in that thread wont work for you? 

    Are you able to create some kind of fuller prototype of how your final form will look? and we will have a thought about whether or not some version of Neils solution is something that we could use. 

  • 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
    fxr
    Answered on January 19, 2012 at 04:40 AM

    The developers are unlikely to offer bespoke code for your installation to help you attain this specifc functionality. 

    We in Support are happy to assist, as much as possible, with php/javascript to hide specific fields based on the parameters given in a form URL, but again this involves embedding source code on each individual form. 

  • 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.

  • Profile Image
    EduardoMendez
    Answered on November 09, 2012 at 02:15 PM

    Thanks for sharing this with us!

    We appreciate the workaround and will be sharing it with others.

    Cheers!