• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Limiting how many digits are able to be typed into a field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Limiting how many digits are able to be typed into a field

    I have a form with an editable field that's supposed to take in a max of a 2 digit number. once they press a button, its grabs whatever the user typed in and sends it to a back-end program to be used in a dec(2,0) variable. the form's data source is just a dummy table with the column being declared as (12 AS pkgcount). The button is set to be disabled if the form is in error, but the user can still type in a numbers that's, say, 10 digits long, and the form will think its okay.

    Is there any way to limit the field to only accept 2 digits?

  • #2
    I would suggest defining the column pkgcount as a numeric type with a total of 2 digits and 0 decimal places. See the example below:

    Code:
    cast(12 AS decimal(2, 0)) AS pkgcount,

    Comment


    • #3
      It seems that didn't change anything. I'm still able to type in as many digits as i want, it just errors out when i try to press the button since its trying to fit a 6 digit number into a 2,0 field

      Comment


      • #4
        After changing the data source, did you resave the widget so it captured the changes?

        Comment


        • #5
          That was it, thank you very much!

          Comment

          Working...
          X