How to validate input value with external data?

  • leandrodrigues14
    Asked on April 23, 2015 at 10:22 PM

    How do I insert a field of "promotional code", "discount code" or "gift coupon", where one should insert a hidden default values (letters and numbers) to fill the field? The values are differents and true, but only one correct is placed.
    I need put a promotional code in my form.

  • Ashwin JotForm Support
    Replied on April 24, 2015 at 1:45 AM

    Hello leandrodrigues14 ,

    I am not sure if I have understood your requirement correctly. 

    Do you want to add a hidden field in your form and set the default value of that field? You can add a normal text box in your form and hide it. You can also set the default value of that field. Please check the screenshot below:

    How to validate input value with external data? Image 1 Screenshot 20

     

    Hope this helps.

    If you meant to ask something else, do get back to us with little more detail and we will surely help you. You may also like to share a screenshot for better understanding of your requirement.

    Thank you!

  • leandrodrigues14
    Replied on April 24, 2015 at 9:32 PM

    Thank you so much. But is not it.

    I want that the person enter your code in the 'Promotional code' field. Several codes will be used in this field and should only be accepted codes previously established (which would be hidden in a database or registered in the field, hidden, several codes). The field 'Promotional code' is visible all time.

     

    For example,

    I'll provide 10 codes, AB01 to AB10. Person 'A' has the AB02 code to be entered in the field and accepted. The person 'B' provided on the form the code 1234 and could not continue with the inscription because her provided an invalid code.

    I want to do it.



    The field 'Modalidade de inscrição' is conditional. Marking the 'Código promocional' field comes another field to enter the correct code.
    How to validate input value with external data? Image 1 Screenshot 20
    https://drive.google.com/file/d/0B5pAg5WVsG0jZUlQRnZxaTAtREk/view?usp=sharing

  • Ashwin JotForm Support
    Replied on April 25, 2015 at 1:06 AM

    Hello leandrodrigues14,

    Thank you for detailed explanation.

    Unfortunately we do not have such features. It is currently not possible to validate the input from any external sources.

    One possible solution is to add conditions in form to match the input value. Please check the screenshot below:

    How to validate input value with external data? Image 1 Screenshot 20

     

    If you want one "Promotional code" to be used only once, it is possible to achieve it. You can set your form limits and make the "Promotional code" field an "Unique Question" which will not allow the same code to be used more than once. The following guide should help you:  http://www.jotform.com/help/223-How-to-set-Form-Limits-Based-on-a-Unique-Question 

    Hope this helps.

    Do get back to us if you have any questions.

    Thank you!

  • Ashwin JotForm Support
    Replied on April 25, 2015 at 1:08 AM

    Hello,

    Another alternative is to download your form's source code and your own code to validate the input data. The following guide should help you on how to download your form's source code:  http://www.jotform.com/help/104-How-to-get-the-Full-Source-Code-of-your-Form 

    Thank you!

  • leandrodrigues14
    Replied on April 28, 2015 at 8:16 AM

    Hi, ashwin_d, thank you again!

    As your image, how do I appear at the appropriate time the message "Invalid promotional code"? In the image doesn't show this step.

    I made some attempts here and wasn't good.

    Thank you!

  • Ben
    Replied on April 28, 2015 at 11:37 AM

    You should do a similar setup to show the error, but this time you check if it is filled out and if it is not equal to the codes above.

    How to validate input value with external data? Image 1 Screenshot 20

    As you can see the If check is also set to ALL, because otherwise the error would have been shown all of the time.

    Now, I also saw that you have set the field as hidden, so I have removed that since when you hide a field like that, it will not be possible to show it with conditions.

    You can see it working in this clone of your jotform: http://form.jotformpro.com/form/51174479349970

    You can also clone it to your account if you wish by following these steps: How to Clone an Existing Form from a URL

  • leandrodrigues14
    Replied on April 29, 2015 at 3:12 PM

    Nice!!!
    Thank you, Ben!
    I couldn't able do that.

  • Ben
    Replied on April 29, 2015 at 3:20 PM

    You are welcome and I am glad that you like it.

    Do let us know if you have any further questions or need any assistance.

  • leandrodrigues14
    Replied on April 29, 2015 at 3:31 PM

    I'm very satisfied using the JotForm. Nice plataform, nice suport. Excellent!

  • Ben
    Replied on April 29, 2015 at 3:37 PM

    Thank you that is always great to hear :)

    As mentioned, we are always here and happy to assist so feel free to let us know when we can be of assistance :)

  • leandrodrigues14
    Replied on April 29, 2015 at 4:20 PM

    =D