I want to perform the submit function before going to my summary page but it's not working...I even tried returning false. but still, it didn't work..

function submit(){
nodes = document.getElementsByClassName('check_boxes');
	len = nodes.length;
	for (i = 0; i < len; i++) {
	return true;
<form action="reservation_summary.php" method="post" name="reservation_form" onsubmit="submit()">

Recommended Answers

All 5 Replies

I am currently learning JavaScript, so forgive me if I am wrong but I was lead to believe that there is no function getElementsByClassName, you have to create it as a function yourself to be able to use it.

I am also not sure that removeAttribute works in IE (not sure what browser you are using).

Member Avatar

What browser are you testing in? As far as I know getElementsByClassName is not supported in any version of IE at the moment (might be in IE 10). If you want this type of functionality in JavaScript, look at using jQuery.

I'm testing this on Opera and Chrome.. and getElementsByClassName is already working because I have another function that is disabling the check_boxes..

Can you show your other function that is disabling the check boxes and the form itself please

function minus_hour(x){
			var hours = document.getElementById("hours_needed").value;

			if(hours !=  1){
				hours = hours - 1;
				document.getElementById("hours_needed").value = hours;
				document.getElementById("check"+x).setAttribute("disabled", "disabled");
				nodes = document.getElementsByClassName('check_boxes');
				document.getElementById("submit").style.display = "";
				len = nodes.length;
				for (i = 0; i < len; i++) {
					nodes[i].setAttribute("disabled", "disabled");


here's the whole function..
by the way, I've already found the solution for my problem..
onsubmit="submit();" i've changed the name of my function to mySubmit() and now it's working properly..
that was a silly mistake on my part..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.