#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    18
    Rep Power
    0

    Cftext box accept only multiple on 0.25 values.


    hi,
    i got a problem.i have a cftext box.
    Code:
    <cfinput type="text" name="abc" id="abc">
    it should accept 0.25 multiples means 0.25,0.50,0.75,1.00,1.25,1.50 like that.

    i have got requirement like this.

    15 Minutes - 0.25
    30 Minutes - 0.50
    45 Minutes - 0.75
    60 Minutes - 1.00
    75 Minutes - 1.25 and so on...


    can any one help me on this
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,286
    Rep Power
    968
    If you know the range of options, use a select input instead of text. If you don't, then you'll have to write code (JavaScript or on the CF side) to validate the value. There's no built-in validation that's this specific.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    18
    Rep Power
    0

    Replay


    range is not mention user can enter any no multiple of 0.25.
    my form is submitting <cfform > so i have to do in CF side..


    please help me if you have soluton


    Thank you
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,286
    Rep Power
    968
    Take the string, split it into two values with "." as the delimiter, and check that the second part of the string is 00, 25, 50, or 75.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2008
    Posts
    131
    Rep Power
    7
    Either that or verify the second part is numeric. Then use MOD 25. If it equals 0, the value is a multiple of 0.25.

    That said, if the value can only be a multiple of 0.25 a set of select lists (hours and minutes) might work better for the front end. You should still validate on the back end, but lists might be more intuitive for the front end.

IMN logo majestic logo threadwatch logo seochat tools logo