Login    Forum    Search    FAQ   Blog

Board index » Client-Side Development » Javascript




 Page 1 of 1 [ 2 posts ] 



Author Message
 Post subject: Validating on condition
 Post Posted: Tue Feb 24, 2009 4:52 pm 
Offline

Joined: Sat Feb 21, 2009 3:02 pm
Posts: 36
Hi All,

I just need a simple validation,

actually i have radio button Married?, if yes is selected, i want to show spouse name text box, if no is selected i want to hide it.

Also, i want the required field validation also to fire depending on the condition, i.e if yes is selected, i want the textbox as required field

_________________
What you call dog with no legs?
Don't matter what you call him, he ain't gonna come.


Top 
 Post subject: Re: Validating on condition
 Post Posted: Wed Feb 25, 2009 9:38 pm 
Offline

Joined: Sat Feb 21, 2009 12:42 pm
Posts: 12
to hide and how text box you can use

document.getElementById("textBoxId").style.visibility = 'hidden'; to hide or
document.getElementById("textBoxId").style.visibility = 'visible';

To check the validation

you can use

if (CheckifYesisSelected() && document.getElementById("textBoxId").value !=''){
alert("spouse name is required");
}

CheckifYesisSelected is another function that returns true if yes is clicked

or

if (document.getElementById("textBoxId").style.visibility = 'hidden' && textBoxId.value !=''){
alert("spouse name is required");
}

_________________
Sleep to dream, wake to acheive.


Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 2 posts ] 




Board index » Client-Side Development » Javascript


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
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 post attachments in this forum

Search for:
Jump to:  
cron