3 Replies - 1689 Views - Last Post: 14 March 2013 - 07:03 AM Rate Topic: -----

#1 vamsc443  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 08-March 13

Cftext box accept only multiple on 0.25 values.

Posted 14 March 2013 - 06:11 AM

hi,
i got a problem.i have a cftext box.
<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

Is This A Good Question/Topic? 0
  • +

Replies To: Cftext box accept only multiple on 0.25 values.

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1866
  • View blog
  • Posts: 3,385
  • Joined: 13-January 08

Re: Cftext box accept only multiple on 0.25 values.

Posted 14 March 2013 - 06:39 AM

Have you considered doing a select box instead? A select box will give you a dropdown form element with predefined options so you'd not have to do any validation on the back end aside from checking to see if the value passed wasn't a zero.
Was This Post Helpful? 0
  • +
  • -

#3 vamsc443  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 08-March 13

Re: Cftext box accept only multiple on 0.25 values.

Posted 14 March 2013 - 06:43 AM

range is not mention. user can enter any no multiple of 0.25 in the text box.
and i am using <cfform> so i stacked hear
Was This Post Helpful? 0
  • +
  • -

#4 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1866
  • View blog
  • Posts: 3,385
  • Joined: 13-January 08

Re: Cftext box accept only multiple on 0.25 values.

Posted 14 March 2013 - 07:03 AM

This sounds like a timekeeping app so there must be some maximum value you'll accept, right?

The reason I'm asking if you've considered a select box instead of a text input is that with the text input you'll need to build out a fair chunk of validation code to make sure what the user gives you is acceptable data. You don't need to do that with a select box.

Further, incrementing select options by .25 is a matter of building the options dynamically during a CFLOOP with a step value of .25 in an index loop.

I mean, build it however you like but if someone asked me to build a form that allowed people to enter times in quarter hour blocks only, I'd do this.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1