How can I validate a number in a single Matrix text box (cell)?

  • czawodzi
    Asked on July 8, 2015 at 5:06 PM
    Also, I want to validate the numbers in a matrix text box, so that the teachers cannot make a mistake inputting the numbers.  For instance, I have 5 columns across,  1, 1, 2, 3, 4.  They cannot fill in a 4, into a column header of 1.  I would like an error to appear if that happens.  Is this possible?  I tried the tools in conditions, but I am done playing, and I would appreciate an answer.  Thanks so much!  Cathy
  • Ben
    Replied on July 8, 2015 at 5:26 PM

    To do this, you would need to add the field into the Form Calculation.

    When you do, you will be shown the option to select which exact cell you would like to include (or cells), but in your case, you should select one of the cells that work best for you and have a validation for each cell set up accordingly.

    How can I validate a number in a single Matrix text box (cell)? Image 1 Screenshot 30

    You can see how to add the Form Calculation widget to your form here: How to Add a Widget to your Form

    Once you set the form calculations, you can hide them by clicking on the gear wheel icon on them and selecting Hide Field option:

    How can I validate a number in a single Matrix text box (cell)? Image 2 Screenshot 41

    The last piece of the puzzle is to set up the conditions to show an error or hide submit button if the field is not filled out properly.

    For example, I would add Text element to the form that is to be shown on such occasions.

    You can see more about the conditions here: Smart Forms Using Conditional Logic and here: How to show or hide a field in the form based on the other field input or selection

    We are of course here Cathy if you need us so feel free to let us know about any issues or questions troubling along the way.

  • czawodzi
    Replied on July 10, 2015 at 11:55 AM

    Hi,   I really did try and understand the instructions, but I have failed.  I added the Form calculation, under the matrix, on my form.  I see how I can choose my text fields in my matrix.  Now what?  How do I create a validation rule?  Thanks so much for your patience with me, I appreciate your help!  Cathy

  • Kiran Support Team Lead
    Replied on July 10, 2015 at 2:20 PM

    I understand that you want to restrict the users to enter only the value mentioned in the header for each field on a matrix. Please correct me if I am mistaken. It seems that it is not possible to validate the numbers/values on a matrix field. However, your requirement can be achieved by using the direct number field. This field has got an inbuilt validation to set minimum and maximum values. Also, you can perform calculations using these fields.

    How can I validate a number in a single Matrix text box (cell)? Image 1 Screenshot 20

    Let us know if that works for you.

  • marraiz
    Replied on November 16, 2015 at 3:40 PM

    Yes!! It works this way!!! Thank you!

  • Ben
    Replied on November 16, 2015 at 5:01 PM

    In my colleague's name you are welcome.

    For anyone else that finds this thread I would recommend taking a look at the following guide as well: How to perform form calculation using the "Matrix Field"