Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-28-2012, 06:32 PM   PM User | #1
twooly
New to the CF scene

 
Join Date: Aug 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
twooly is an unknown quantity at this point
validate problem

So I'm starting to go nuts on why I can't get this figured out. I'm so close but can't figure out why the whole function doesn't process. lll the entries/output run as I expect but it just won't run all the code in the function. I highlighted code below that I never see ran.

Any tips would be helpful.

Thanks

Code:
function validate(){
	var vresult = 0;
	var form = document.getElementById("form_opt");
	var inputs = form.getElementsByTagName("input");
	arr = new Array(1);
	for (var i = 0; i < inputs.length; ++i) {
		if (inputs[i].type == "radio"){
			arr[i] = inputs[i].name;
		}
	}
	arr = sort_and_unique(arr);
	for (var i =0; i < arr.length; i++){
		if (!checkRadio("form_opt",arr[i])){
			//alert(arr[i] + " empty");
			vresult = 1;
		}
		//alert(arr[i] + " " + getSelectedButton(document.form_opt[arr[i]]));
		if (getSelectedButton(document.form_opt[arr[i]]) == 1) {
			var arFieldName = arr[i].split("_");
			var vServer = arFieldName[1];
			var txtField = "reason_" + vServer;
			//alert(txtField + " " + document.form_opt[txtField].value.length);
			if (document.form_opt[txtField].value.length == 0){
				vresult = 1;
				alert(txtField + " not filled " + vresult);
			}
		}
		alert(vresult);
	}
	
	//I never see anything past here
	alert(vresult);
	
	if (vresult != 0) {
		alert("There are problems with the form results. Please verify you have selected install/not install for all servers and for servers you do not want .Net installed you inputed a reason.");
		return false;
	}
	else {
		return true;
	}
}
twooly is offline   Reply With Quote
Old 08-28-2012, 07:08 PM   PM User | #2
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 941
Thanks: 7
Thanked 95 Times in 95 Posts
WolfShade is an unknown quantity at this point
Check the error console for messages.
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Old 08-28-2012, 07:25 PM   PM User | #3
twooly
New to the CF scene

 
Join Date: Aug 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
twooly is an unknown quantity at this point
Nothing is showing on the console.
twooly is offline   Reply With Quote
Old 08-28-2012, 07:38 PM   PM User | #4
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 941
Thanks: 7
Thanked 95 Times in 95 Posts
WolfShade is an unknown quantity at this point
One thing I would do is replace:
var form = document.getElementById("form_opt");

with:
var form = document.forms["form_opt"];

Check to make sure the error isn't in your "sort_and_unique()", "checkRadio()", or "getSelectedButton()" functions.

I'm not sure what this is supposed to do, but it looks like it's concerning every radio button within a particular form.



__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:14 AM.


Advertisement
Log in to turn off these ads.