HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 10th, 2005, 04:08 PM
sam_sam sam_sam is offline
Contributing User
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jan 2005
Posts: 1,377 sam_sam User rank is Sergeant (500 - 2000 Reputation Level)sam_sam User rank is Sergeant (500 - 2000 Reputation Level)sam_sam User rank is Sergeant (500 - 2000 Reputation Level)sam_sam User rank is Sergeant (500 - 2000 Reputation Level)sam_sam User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 12 h 16 m 54 sec
Reputation Power: 10
Javascript guru help

Hi,

I have two groups pre conference and main conference and i have 3 groups of radio buttons in preconference and one set of radio button in main conference

Code:
 Preconference group 
 
 Group one radion buttons
 <input type="radio" name="Groupone" value="Introduction to Olympic Weightlifting"  /> 
 <input type="radio" name="Groupone" value="Advanced Concepts In Sport-Specific Speed Development"  /> 
 <input type="radio" name="Groupone" value="Strength Training and Conditioning for Tennis"  />
 
 <br><br>
 
 Group two radion buttons
 <input type="radio" name="Grouptwo" value="Training Special Populations" /> 
 <input type="radio" name="Grouptwo" value="Role of Nutritional Supplementation on Energy Expenditure,Athletic Performance, and Body Composition" /> 
 <input type="radio" name="Grouptwo" value="Strength and Conditioning Programs for the Golf Athlete"  /> 
 
 
 
 
 Group three radio buttons
 <input type="radio" name="Groupthree" value="Training the Basketball Athlete:Two Case Studies" /> 
 <input type="radio" name="Groupthree" value="Extreme Balance Training for All Populations"  /> 
 
 
 <br><br>
 
 Main Conference Group
 
 Group Four
 <input type="radio" id="AD" name="Conf" value="All/any day" />
 <input type="radio" id="OD" name="Conf" value="One day" />
 
 



the following code works fine if the user doesnt select one of the radio button in either pre-conference or main conference group

Code:
 
 var arrGroups=new Array(document.forms["frm1"].elements["Groupone"], document.forms["frm1"].elements["Grouptwo"], document.forms["frm1"].elements["Groupthree"], document.forms["frm1"].elements["Conf"]);
    var checkedCount=0;
    for (var i=0; i<arrGroups.length; i++) 
    {
 	  for (var j=0; j<arrGroups[i].length; j++) 
 	 {
 		 checkedCount += (arrGroups[i][j].checked)?1:0;
 	  }
    }
    
    if (checkedCount == 0)
    {
 	  alert(alertMsg += "- Select either Pre-conference symposia or Main conference or Both.\n\n\nThese fields have been highlighted for your attention.");
 	  return false;
    }
 
 

Now i have to add a radio button to each group so now if the user selects none radio button in pre-conference then i have to pop up a alert saying he didnt make the choice same applies if the user selects a none radio button in main conference then pop up alert advising him to make a selection in preconference or main conference .

Code:
 
 ------------------------------------
 
 Preconference group 
 
 Group one radion buttons
 <input type="radio" name="Groupone" value="Introduction to Olympic Weightlifting"  /> 
 <input type="radio" name="Groupone" value="Advanced Concepts In Sport-Specific Speed Development"  /> 
 <input type="radio" name="Groupone" value="Strength Training and Conditioning for Tennis"  />
 <input 	type="radio" name="Groupone" value="0" />None</td>
 
 <br><br>
 
 Group two radion buttons
 <input type="radio" name="Grouptwo" value="Training Special Populations" /> 
 <input type="radio" name="Grouptwo" value="Role of Nutritional Supplementation on Energy Expenditure,Athletic Performance, and Body Composition" /> 
 <input type="radio" name="Grouptwo" value="Strength and Conditioning Programs for the Golf Athlete"  /> 
 <input 	type="radio" name="Grouptwo" value="0" />None</td>
 
 
 
 Group three radio buttons
 <input type="radio" name="Groupthree" value="Training the Basketball Athlete:Two Case Studies" /> 
 <input type="radio" name="Groupthree" value="Extreme Balance Training for All Populations"  /> 
 <input 	type="radio" name="Groupthree" value="0" />None</td>
 
 <br><br>
 ---------------------------
 
 Main conference Group
 
 Group Four
 <input type="radio" id="AD" name="Conf" value="All/any day" />
 <input type="radio" id="OD" name="Conf" value="One day" />
 <input 	type="radio" name="Conf" value="0" />None</td>
 
 ------------------------------------------
 
 


Can someone tell me what change i have to make in the above code to make this happen

thanks,

sammy

Reply With Quote
  #2  
Old February 11th, 2005, 10:17 AM
sam_sam sam_sam is offline
Contributing User
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jan 2005
Posts: 1,377 sam_sam User rank is Sergeant (500 - 2000 Reputation Level)sam_sam User rank is Sergeant (500 - 2000 Reputation Level)sam_sam User rank is Sergeant (500 - 2000 Reputation Level)sam_sam User rank is Sergeant (500 - 2000 Reputation Level)sam_sam User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 12 h 16 m 54 sec
Reputation Power: 10
got it working ;)

Hi ,

i got it working had to do (-1) to the length the code is as follows

Code:
  var arrGroups=new Array(document.forms["frm1"].elements["Groupone"], document.forms["frm1"].elements["Grouptwo"], document.forms["frm1"].elements["Groupthree"], document.forms["frm1"].elements["Conf"]);
    var checkedCount=0;
    for (var i=0; i<arrGroups.length; i++) 
    {
 	  for (var j=0; j<arrGroups[i].length-1; j++) 
 	 {
 		 checkedCount += (arrGroups[i][j].checked)?1:0;
 	  }
    }
    
    if (checkedCount == 0)
    {
 	  alert(alertMsg += "- Select either Pre-conference symposia or Main conference or Both.\n\n\nThese fields have been highlighted for your attention.");
 	  return false;

    } 
 


cheers its working

thanks,

sammy

Reply With Quote
  #3  
Old February 12th, 2005, 04:38 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is online now
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,638 Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 374417 Folding Title: Super Ultimate Folder - Level 1Folding Points: 374417 Folding Title: Super Ultimate Folder - Level 1Folding Points: 374417 Folding Title: Super Ultimate Folder - Level 1Folding Points: 374417 Folding Title: Super Ultimate Folder - Level 1Folding Points: 374417 Folding Title: Super Ultimate Folder - Level 1Folding Points: 374417 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 3 h 3 m 25 sec
Reputation Power: 1902
see? you can solve your problem yourself if you want...

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Javascript guru help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT