| View previous topic :: View next topic |
| Author |
Message |
recsxx
Joined: 14 Oct 2006 Posts: 4
|
Posted: Fri Feb 26, 2010 4:24 pm Post subject: If any of three input filled others must be filled HELP |
|
|
I've been trying to rack my brain around this one for awhile but cant figure it out, perhaps it is a trivial thing but it is not coming to me.
I want to validate a phone number, the input is in three separate fields (area code)-(prefix)-(sufix).
If the user attempts to enter a number then all three fields must be filled and must have the proper amount of digits (3)-(3)-(4) and must evaluate to digits and not characters.
At this point I haven't even tried to evaluate the presence of digits, I can't even figure out how to trigger validation if one of any of the three are filled all the others must be filled also.
Any help would be greatly appreciated. |
|
| Back to top |
|
 |
recsxx
Joined: 14 Oct 2006 Posts: 4
|
Posted: Sun Feb 28, 2010 3:53 pm Post subject: |
|
|
Any takers?
I've notice a few people viewing my post but no one is taking a jab at my problem.
Any suggestions would be greatly appreciated. |
|
| Back to top |
|
 |
recsxx
Joined: 14 Oct 2006 Posts: 4
|
Posted: Sun Mar 14, 2010 7:01 am Post subject: |
|
|
| recsxx wrote: | Any takers?
I've notice a few people viewing my post but no one is taking a jab at my problem.
Any suggestions would be greatly appreciated. |
Figured it out myself.
| Quote: | I could not figure out how to do it with one Group Validator, anything i tried would never work as expected, so what i did was i had to create three vlgroup validators.
So if any one ever needs to do this also, here is what i did.
Keep in mind my error msg(s) are just for testing.
|
Edited:
I ended up figuring this out, this is what i ended up with and it works well.
| Code: |
<vlgroup operator="and" name="mobileGrp" errmsg="Mobile number invalid.">
<vlgroup operator="or">
<vlvalidator type="required" control="mobile_area" negation="true">
<vlgroup operator="and">
<vlvalidator type="regexp" regexp="/\d{3}/" required="true" control="mobile_area">
<vlvalidator type="regexp" regexp="/\d{3}/" required="true" control="mobile_prefix">
<vlvalidator type="regexp" regexp="/\d{4}/" required="true" control="mobile_sufix">
</vlgroup>
</vlgroup>
<vlgroup operator="or">
<vlvalidator type="required" control="mobile_prefix" negation="true">
<vlgroup operator="and">
<vlvalidator type="regexp" regexp="/\d{3}/" required="true" control="mobile_area">
<vlvalidator type="regexp" regexp="/\d{3}/" required="true" control="mobile_prefix">
<vlvalidator type="regexp" regexp="/\d{4}/" required="true" control="mobile_sufix">
</vlgroup>
</vlgroup>
<vlgroup operator="or">
<vlvalidator type="required" control="mobile_sufix" negation="true">
<vlgroup operator="and">
<vlvalidator type="regexp" regexp="/\d{3}/" required="true" control="mobile_area">
<vlvalidator type="regexp" regexp="/\d{3}/" required="true" control="mobile_prefix">
<vlvalidator type="regexp" regexp="/\d{4}/" required="true" control="mobile_sufix">
</vlgroup>
</vlgroup>
</vlgroup>
|
|
|
| Back to top |
|
 |
|