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

    Working with conditions and the POST Array

    Asked by shaggy22 on December 11, 2012 at 08:46 AM

    Hello Team,

     

    i´m using conditions to hide different parts of my form depending on the input values the user selected.

     

    Let´s say i have a radio input "male" and "female" and i want the input field "Female Name" only displayed when the "female" radio button is selected.

    I fill out the "female name" input field, after that (!) i switch to the male radio button and the "female name" input field disappears.

    When i submit the form now, the POST-Array includes all the data - even the data of the field "female name". That´s pretty bad to handle since i have to switch/case/if all of the conditions in my php code again.

    Is there any solution for this problem?

  • Profile Image
    JotForm Support

    Answered by jonathan on December 11, 2012 at 09:56 AM

    Hi,

    Please check this guide -How-to-Hide-or-Show-Multiple-Fields-at-Once-Based-On-a-Single-Conditional-Entry . It should make it a lot easier to compose the condition rules in your form.

    Base on this description:

    I fill out the "female name" input field, after that (!) i switch to the male radio button and the "female name" input field disappears.

    How about if you also a add condition to hide the female/male radio option when the female input field is filled-in. At least this way, the user will not see the radio option again (except when the input field is cleared again)

    The show/hide of the input fields does not clear the data on the form. This is the reason why in the POST data, the input fields can still contain values.

    Refreshing the browser will clear it, or adding scripts to clear the input fields -- like what the print/clear button does.

    Hope this help. Please inform us if you have further inquiry.

    Thanks.

     

     

     

  • Profile Image

    Answered by shaggy22 on December 11, 2012 at 10:10 AM

    The problem is not to show or hide some fields. The problem is to clear the fields that are not used, so they will not appear in the database.

     

    Is there no way to clear the input fields that are hidden?

  • Profile Image
    JotForm Support

    Answered by jonathan on December 11, 2012 at 10:45 AM

    Hi,

    I understand your point. What I actually wanted to say is, if the form user cannot see the field -- they will not have the chance to use it.Thus, they can remain hidden and cleared. When the form is submitted, the clear/empty fields should then not appear in the database.

    I am not sure if you are using custom POST page (like what was mentioned on this guide) , but if you do, you can probably create a custom server-side script to parse and clear the fields/data prior to appending them to the database.

    I cannot find means to clear selected input fields that are hidden. If you refresh the browser or use the reset button -- it clears all fields.

    Thanks.