Web Analytics Made Easy -
StatCounter 'undefined' form input value inside JS function - CodingForum

Announcement

Collapse
No announcement yet.

'undefined' form input value inside JS function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 'undefined' form input value inside JS function

    Hello all,

    I'm developing an account lookup, mostly in ASP, that displays a list of radio buttons to select one account from those found in a recordset. Here is a snip of the account display, after the recordset is populated:
    Code:
    Response.Write("<form name='custLookup' method='get' action='acctLookup.asp'>")
    		
    	do while not rsAcctLU.EOF
    		Response.Write("<input type='radio' name='CustID' value='" & rsAcctLU("CustomerID") & "'>" & rsAcctLU("CustomerID"))
    		Response.Write(rsAcctLU("CustomerName") & " - " & rsAcctLU("CustomerCity") & ", " & rsAcctLU("CustomerState") & "<br>")
    		rsAcctLU.MoveNext
    	loop
    	Response.Write("<input type='submit' name='submitID' onClick='updateParent();'></form>")
    The call at the end to updateParent() is where stuff gets funny. That function looks like this:
    Code:
    function updateParent(){
    
    parentform = opener.document.New_FTR_Form;
    
    localform = document.custLookup;
    
    //update your parents form data with local form data
    parentform.AcctID.value = localform.CustID.value;
    
    
    //close the child
    self.close();
    }
    if I output localform.CustID.value, I get 'undefined' and can't figure out why. Thanks for any help you can give.

  • #2
    View the source of the page as the browser sees it with the view source button. Check what is actually written. Might be something in there you didn't expect. Perhaps there is no value from the result set, or maybe a quote embedded funny.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

    Comment

    Working...
    X