1
0
-1

Hi, 


How do you set min and max character lengths on a number field? 


Thanks, 

Hannah

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi Hannah,

      That's actually quite tricky to achieve without resorting to JQuery code, given that a Text Input with type number will give you a JavaScript number object as output, which does not have a concept of length.  Also, if you were to enter leading zeros, they would be stripped out.

      There is a possible workaround using a feature of the Autotab Controller, if you have that control in your Maestro release. The workaround doesn't require JQuery code.

      If you add a Text Field to your form, you can add an Autotab Controller and set its Target to the text field. Give the Autotab Controller a Format of 'Custom' and leave the default Pattern as [^0-9\.]+.

      You can add the Max Characters property to the Text Field to limit the number of characters, but you would need to add a validation rule to trigger an error if the minimum characters have not been entered. You can do this easily because the output from the Text Field will still be a string and you can test its length.

      Since you have only one text field referenced from the Autotab Controller, its primary function will not be used. It's the side-effect that should help you out.

      Your Autotab properties should look a bit like this:

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Thanks Bill. Very helpful 

          CommentAdd your comment...