|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
double validation
Is it possible to validate a text field (in both the numeric and decimal function) simultaneously using onkeypress/onchange in a single line code?
the code shown below is for the different text field, how to combine them to become one only? <tr> <td align="right">Account Number</td> <td><input type="text" name="actno" size="25" maxlength="15" onkeypress="validate_numeric()"> </td> </tr> <tr> <td align="right">Amount</td> <td><input type="text" name="amount" onchange="checkDecimal(this.form.amount,2)"> </td> </tr> |
|
#2
|
||||
|
||||
|
You may want to modify your validate_numeric() function to accept the a parameter, similar to the checkDecimal function... I would have it accept the field you're validating (like your checkDecimal function)
Then you could simply do the following: Code:
function combinedValidate(obj, d) {
validate_numeric(obj);
checkDecimal(obj, d);
}
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > double validation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|