Check if a field contains 4 different numbers and 2 letters

  • Profile Image
    FOTORIP
    Asked on April 14, 2015 at 03:03 AM

    Hi, is it possible to check a field if the content contains for example '3numbers+4characters' ? Example: 451ABCD

    I know that this is possible for email addresses for example, but can I define this myself ?

     

    regards,

    Steven 

  • Profile Image
    Ben
    Answered on April 14, 2015 at 10:44 AM

    This certainly seems like an interesting challenge Steven.

    There are 2 ways you could achieve something like this - that I can think of right of my head and I made a quick demo of them both on this form: http://form.jotformpro.com/form/51034688764968

    1st way - using Input mask

    We can set the Input Mask on a field so that we are accepting ##@@## or in other words: number number letter letter number number (without any spaces between)

    This is achieved by clicking on the field (text box in this example) and then on Input Mask button in the toolbar.

    This is great way to make sure that first two entries are numbers, followed by to letters and again with two numbers

    2nd way - using Form Calculation

    Basically, if you add the filed to Form Calculation widget and make it read it as a number, it will ignore the characters and only capture numbers. Once we have them, all we need is to check with conditions if the value in it is in range of 1.000-10.000.

    The reason for this range is that we get a 4 digit number and as such it can be 1000 or more, but up to 9999

    Do let us know if these would work for you and if you have any questions.

    Also, you can clone the form to your account by following these steps: How to Clone an Existing Form from a URL so that you can take a closer look at how it was made.