X-code.com Forum Index Welcome to X-code Forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

If any of three input filled others must be filled HELP

 
Post new topic   Reply to topic    X-code.com Forum Index -> VDaemon v3.x
View previous topic :: View next topic  
Author Message
recsxx



Joined: 14 Oct 2006
Posts: 4

PostPosted: Fri Feb 26, 2010 4:24 pm    Post subject: If any of three input filled others must be filled HELP Reply with quote

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
View user's profile Send private message
recsxx



Joined: 14 Oct 2006
Posts: 4

PostPosted: Sun Feb 28, 2010 3:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
recsxx



Joined: 14 Oct 2006
Posts: 4

PostPosted: Sun Mar 14, 2010 7:01 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    X-code.com Forum Index -> VDaemon v3.x All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group