Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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;
    	}
    }

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    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".

  • #3
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nothing is showing on the console.

  • #4
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    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".


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •