wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Validation of Forms Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Validation of Forms" Watch "Validation of Forms" New topic
Author

Validation of Forms

Paddy Joshi
Greenhorn

Joined: Oct 13, 2010
Posts: 10
Hi,
I want to validate a form. In which i need to validate if user entered text where number is required. i come to know about isNaN () method. but it will validate floating numbers also and i want integers only. moreover how can i enable a text input only when checkbox is enabled
what i did was ( for number validation)


please help me with this ... thnks in advance ...
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 507

You can try using regular expressions..


Regards, Prasad
SCJP 5 (93%)
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 507

Paddy Joshi wrote:how can i enable a text input only when checkbox is enabled

On click of the checkbox, call one function, based on the value you get from checkbox(whether its checked or unchecked), enable/disable a text box. What difficulty are you facing here?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

your logic looks fine for me except .(dot) in your string . remove that!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Validation of Forms
 
Similar Threads
Checkbox validation - at least one selected
form validator to check for alphabets in a text field
Read input from user until an input is valid
JavaScript?
javascript validation