Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

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 Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerryŽ experts this July. Register Today!
  #1  
Old January 12th, 2005, 03:24 PM
Patricia Patricia is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 Patricia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
checkCheckboxGroup broken after form consolidation

Hi,

Location: the web page in question

History: I had two different forms on two different pages. I was told to put them onto one web page, so that one form up is high on the page and the other form is near the bottom. Both forms just have checkboxes for registering for classes. Previously on each page, there was javascript that made sure that at least one class was chosen.

Now: I put both forms on one web page and, as requested, are separated vertically by much space. Programmatically, I decided to do away with the two forms and consolidate them. I did this by deleting the ending form tag (</form>) for the first form and the beginning form tag (<form action=…>) for the second form. Programmatically, there is now only 1 form on the web page although physically it still looks like 2 separate forms.

Each section of the form has it’s own ‘Next’ button (a submit tag). Why? Because if the user is looking at the upper form, they only see that section of the form and they may want to go ahead and sign up for the class. Likewise, if they only see the lower form, they will need a submit button there as well. That doesn’t seem to be the problem. I can hit either submit button and get to the next page fine.

Problem: My problem is that now, in Netscape Navigator, after programmatic form consolidation, the javascript that verifies that at least one class has been chosen has suffered trauma.

Specifically, the top “form” and it’s ‘Next’ button work in that it flags an error if no classes are chosen but submits fine when at least one class is chosen.

This is not true of the bottom “form”. It always flags an error even if one class is chosen from it.

You might want to tell me to keep the forms separate but here is why I did not: I want the user to be able to choose classes in both forms if they realize that there are 2 forms to choose from on this page without having to fill out their names and info 2 separate times. That way, they can be linked to either the top or bottom form from some other web page, pick a class, see the link that states that there are even more classes, choose one of those additional classes, press the ‘Next’ button, and see all their classes on the next screen.

Code:

Code:
function checkForm(theForm) 
{
	if (! checkCheckboxGroup(theForm,'chosenClass[]')) return false
}


function checkCheckboxGroup(theForm,theGroupname) {
	var theElements = theForm.getElementsByTagName("input");
	for (var i = 0; i < theElements.length; i++) 
	{
		if (theElements[i].type == 'checkbox' && theElements[i].name == theGroupname && theElements[i].checked)
			return true
	}
	//alert ('No checkboxes with name "' + theGroupname + '" are checked.');
	return false
}

function submitIt(someForm)
{
 //make sure they enter a class
 if (checkCheckboxGroup(document.forms.theForm,'chosen  Class[]') == false)
 {
	alert("You must select at least one class.");
  return false
 }
 return true
}

Any ideas?

Thank you very much for reading all of this!

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > checkCheckboxGroup broken after form consolidation


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 5 hosted by Hostway