0

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++) {
		nodes[i].removeAttribute("disabled");
		}
	return true;
}
<form action="reservation_summary.php" method="post" name="reservation_form" onsubmit="submit()">
3
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by rowen17
0

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).

0

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.

0

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

0
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");
			}else{
				
				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..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.