1. Welcome! Please take a few seconds to create your free account to post threads, make some friends, remove a few ads while surfing and much more. ClutchFans has been bringing fans together to talk Houston Sports since 1996. Join us!

Java Script Question

Discussion in 'BBS Hangout' started by pirc1, May 8, 2012.

  1. pirc1

    pirc1 Member

    Joined:
    Dec 9, 2002
    Messages:
    14,138
    Likes Received:
    1,882
    this code does not create the frame I thought it would. It won't even reach the intended page, I have setup print statement there, it never printed.



    frames['ID'].location = "SwitchValidation.cfm?FieldName=ID&TransactionID=" + document.forms['Maintain'].elements['TransactionID'].value + "&Year=" + document.forms['Maintain'].elements['Year'].value + "&AcctNumberOrig=" + document.forms['Maintain'].elements['AcctNumberOrig'].value + "&ID=" + document.forms['Maintain'].elements['ID'].value + "&AmountOrig=" + document.forms['Maintain'].elements['AmountOrig'].value;

    What could be the cause? a similar code for a different process works just fine.

    What would be the way to make at least go to the SwitchValidation.cfm page?
     
  2. DrLudicrous

    DrLudicrous Member

    Joined:
    May 9, 2002
    Messages:
    3,936
    Likes Received:
    203
    What browser are you using? Firefox and chrome are both pretty good about reporting javascript errors. Is the print statement before or after that line? If it's before then there is something else causing the problem.

    To just make it go to SwitchValidation.cfm try leaving off the querystring, that would at least tell you if the error is happening while building the querystring.

    frames['ID'].location = "SwitchValidation.cfm";
     
    1 person likes this.
  3. pirc1

    pirc1 Member

    Joined:
    Dec 9, 2002
    Messages:
    14,138
    Likes Received:
    1,882
    I am testing in chrome, there is no error reported but it never reach the cfm page. I can alert before the frame code but not after, it seems it just went to never land. I will try the bare SwitchValidation.cfm.

    frames['ID'].location = "SwitchValidation.cfm";[/QUOTE] did not generate anything either, but if I just type in the URL for "http://..../SwitchValidation.cfm" that works just fine.
     
    #3 pirc1, May 8, 2012
    Last edited: May 8, 2012
  4. pirc1

    pirc1 Member

    Joined:
    Dec 9, 2002
    Messages:
    14,138
    Likes Received:
    1,882
    did not generate anything either, but if I just type in the URL for "http://..../SwitchValidation.cfm" that works just fine.[/QUOTE]

    What is real strange is now if I put

    frames['ID'].location = "SwitchFormValidation.cfm"; in a different function, it works but does not in this function.
     
  5. SwoLy-D

    SwoLy-D Member

    Joined:
    Jul 20, 2001
    Messages:
    37,618
    Likes Received:
    1,456
    Did you grab this code from somewhere else? It doesn't seem to me that you wrote this code yourself, because you're asking about a generated code from fields and values that might not be defined (Undef).

    One of those
    Code:
    .value
    s is probably undefined or null at the time the code reads the values. :eek:

    THIS here will work ALWAYS, as long as a frame named "ID" exists within the page containing this script:
    Code:
    frames['ID'].location = "SwitchValidation.cfm";
    So, one of these here values:

    Code:
    document.forms['Maintain'].elements['TransactionID'].value
    document.forms['Maintain'].elements['Year'].value
    document.forms['Maintain'].elements['AcctNumberOrig'].value
    document.forms['Maintain'].elements['ID'].value
    document.forms['Maintain'].elements['AmountOrig'].value
    Is null or UNDEF.

    While in the page, run this here code in the location bar of the browser or in the JavaScript debug window without spaces:
    Code:
    javascript:alert(document.forms['Maintain'].elements['TransactionID'].value);alert(document.forms['Maintain'].elements['Year'].value);alert(document.forms['Maintain'].elements['AcctNumberOrig'].value);alert(document.forms['Maintain'].elements['ID'].value);alert(document.forms['Maintain'].elements['AmountOrig'].value);
    So make sure all those values contain something BEFORE running that statement, otherwise, make each value a default BEFORE the user picks from the form.
     
    1 person likes this.
  6. pirc1

    pirc1 Member

    Joined:
    Dec 9, 2002
    Messages:
    14,138
    Likes Received:
    1,882

    Thanks Swoly, I think I found the problem, I did not setup the onchange and onblur functions for the text boxes that should call the javascript funcition!
     

Share This Page

  • About ClutchFans

    Since 1996, ClutchFans has been loud and proud covering the Houston Rockets, helping set an industry standard for team fan sites. The forums have been a home for Houston sports fans as well as basketball fanatics around the globe.

  • Support ClutchFans!

    If you find that ClutchFans is a valuable resource for you, please consider becoming a Supporting Member. Supporting Members can upload photos and attachments directly to their posts, customize their user title and more. Gold Supporters see zero ads!


    Upgrade Now