User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 423,445 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,905 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

Validating radio button selection for login redirect

Join Date: Mar 2008
Posts: 184
Reputation: Traicey is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 16
Traicey's Avatar
Traicey Traicey is offline Offline
Junior Poster

Re: Validating radio button selection for login redirect

  #3  
May 14th, 2008
If I understand you correctly.... U are struggling with validating radiobutton (i.e) U wana make sure that one of them are seleceted well if thats the case, we can attempt to fix by doing the following, not that I know but I think u need to group ur radio buttons, that means u cant validate each one them, and thats why they merely use the for loop to validate radio buttons

now lets try this solution and see where it takes us

  1. //variable to evaluate if radio button is checked
  2. var optionPanel = false;
  3. //loop to check if the user checked the radio button
  4. for(var x = 0; x < document.formLogin.select_Panel.length; x++)
  5. {
  6. if (document.formLogin.select_Panel[x].checked = true)
  7. {
  8. optionPanel = true;
  9. //code what must be done here if one of the radio buttons are checked
  10. }
  11. }
  12.  
  13. //Code if the radio button is unchecked or unselected
  14. if (optionPanel = false)
  15. {
  16. alert("PLease select one of my radio buttons");
  17. return false;
  18. } else {
  19. alert("Form values are valid");
  20. return true;
  21. }
Last edited by Traicey : May 14th, 2008 at 6:40 am.
Some people get so rich they lose all respect for humanity. That's how rich I want to be.
 
All times are GMT -4. The time now is 2:34 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC