Limit input box
- Started
- Last post
- 28 Responses
- BabySnakes0
Added an if statement to the refreshCustomBoxes(), that should force a 6 if user inputs an number less thatn 6 but keeps it at 0 if it is already 0. The each loop for the input boxes isn't set up the way i'd like but it should work.
- BabySnakes0
updated to set the input val to 6 as well...
- fadein110
your site needs to rely less on the back button - frustrating.
- Weyland0
pseudo code: onSubmit if(text.length()<6) return else submit
- Nathan_Adams0
Why not use a number input type?
Like a text box, only accepts numbers, and you can set min, max and step values.http://www.w3schools.com/html/tr…
That said, I can't understand what the problem is with fadein11's suggestion of a select box.
- he wants 6 and above to infinite, thats a big dropdown.mantrakid
- Raybandana0
thanks guys for the help!
- Raybandana0
Hey BabySnakes,
I added your If statements - but they dont seem to work.
Possibly because I don't know what I'm doing!Any help would be great.
Thanks.
- BabySnakes0
You replaced the function exactly or just put the if statement in? Are you updating that first link you sent? hmm should work unless i missed something.
- Raybandana0
I added this code - http://jsfiddle.net/vcqe9/1/
So the top of http://delicakitchen.ca/paulette…
Do I need to do more then that? like add a class or something?
- BabySnakes0
Well there is a refreshCustomBoxes() function in your jquery.main.js file that needs to be over written by the one i gave you. Save a back up just incase.
- BabySnakes0
you shouldn't need that function on the main page like you put.
- Raybandana0
ohhh okay. I dont see any instances of refreshCustomBoxes() in my main.js :P
- Raybandana0
Hmm I found it - but doesn't seem to limit the box.
- Raybandana0
never mind - it worked! thanks so much.
- Raybandana0
never mind - it worked! thanks so much.
- Raybandana0
Thats for max characters... i'm looking for max numbers... so if the min is 6... they cant type 5,4,3,2,1... but anything above 6.
- spot130
I'm not 100% clear on what you're trying to do but it sounds like you can either search for specific characters (numbers) in a string (contents of your input) or you can right an 'if equal or less than 5' statement to remove the characters you don't want.
It would be easier to understand if you could provide a usage scenario.
- spot130
String.contains:
http://stackoverflow.com/questio…if integer is greater / less than:
http://stackoverflow.com/questio…RegEx to check for specific characters and number of characters in string:
http://stackoverflow.com/questio…
- Raybandana0
Basically I have an input box. I need a number restriction on that box.
So the restriction is 5 or anything less than than 5. But allow the user to type 6 or anything greater then 6.
Is this possible?
How is this done?