Skip to main content
Inspiring
November 10, 2008
Answered

Javascript Mystery

  • November 10, 2008
  • 4 replies
  • 1809 views
OK folks, I am completely and utterly frustrated!! I have a 12 page form that I have created that has checks built in so that users cannot proceed until they have completed certain values on that form. The form works great on our development server and has been tested to the hilt. However, when I move it over to our live server, the field checks that work on the dev server will not work. Instead I receive and error that resident.length (a radio button with either a yes or no value) is a null value is not an object. Is there a setting that I am missing within CF? Both servers are running CF7 and W2000. Any help would be very much appreciated. Thanks!!
P.S. If you need the code I can provide it, but I know that it works so I do not believe it is a cdoing error.

Thanks!
JK
    This topic has been closed for replies.
    Correct answer Newsgroup_User
    try this:

    instead of running the form check from cfform's onsubmit event, move it
    into onclick even of your submit button:

    onclick="return submitinfo(this.form);"

    [NOTE the change from just "this" to "this.form"!!!]

    you will also have to add code to your form check js function to
    actually submit the form if all checks pass:

    change your last line: else {return true;}
    to: else {formpre.submit();}

    i have been playing with some test code on CF8, and it would still
    submit the cfform no matter what js checks i had in my function called
    from onsubmit() event. when i made the above changes it all worked
    instantly.

    my cf801 creates same js scripts as cf701 on your server.


    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

    4 replies

    Newsgroup_UserCorrect answer
    Inspiring
    November 11, 2008
    try this:

    instead of running the form check from cfform's onsubmit event, move it
    into onclick even of your submit button:

    onclick="return submitinfo(this.form);"

    [NOTE the change from just "this" to "this.form"!!!]

    you will also have to add code to your form check js function to
    actually submit the form if all checks pass:

    change your last line: else {return true;}
    to: else {formpre.submit();}

    i have been playing with some test code on CF8, and it would still
    submit the cfform no matter what js checks i had in my function called
    from onsubmit() event. when i made the above changes it all worked
    instantly.

    my cf801 creates same js scripts as cf701 on your server.


    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    JeffKAuthor
    Inspiring
    November 11, 2008
    Thank you Thank you Thank you!!! That worked. I will probably have to go through all of the other parts of the form and do the same thing. Any ideas as to why?? Frustrating.
    Inspiring
    November 11, 2008
    is it a CFFORM? if so, check that /CFIDE directory is properly mapped as
    virtual folder for your website on your live server and the scripts
    inside /scripts sub-folder in it are web-accessible.

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    JeffKAuthor
    Inspiring
    November 11, 2008
    Yes it is a cfform but i checked the cfide folder and that is mapped properly, plus I have other forms that run on this website that are using js. The javascript that I am using is within the file. I am attaching the code below.
    JeffKAuthor
    Inspiring
    November 11, 2008
    And the error....

    The web site you are accessing has experienced an unexpected error.
    Please contact the website administrator.

    The following information is meant for the website developer for debugging purposes.

    Error Occurred While Processing Request
    Variable NYRESIDENT is undefined.


    The error occurred in D:\securecontent\Admissions\apply\apppresubmit.cfm: line 1

    1 : <cfcookie name="nyres" value="#nyresident#">
    2 : <cfcookie name="felony" value="#felony#">
    3 : <cfcookie name="hisplat" value="#hisplat#">



    --------------------------------------------------------------------------------

    Resources:
    Check the ColdFusion documentation to verify that you are using the correct syntax.
    Search the Knowledge Base to find a solution to your problem.


    Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
    Remote Address 10.1.8.126
    Referrer https://www.mvcc.edu/apply/apppre.cfm
    Date/Time 11-Nov-08 11:00 AM

    Stack Trace (click to expand)

    Inspiring
    November 11, 2008
    Hi,

    - Are you using the same browser to test in both cases?
    (there are differences between Firefox, IE, ...)
    - Do any of the scripts/pages include hard-coded addresses that
    imply a specific server
    (as example: http://testserver... , http://192.168.10.11...)

    cheers,
    fober
    JeffKAuthor
    Inspiring
    November 11, 2008
    I will double check tomorrow but to my knowledge there is no hard-coded address in the scripts. They are merely radio button verifications - the only place that may have hard coded addresses are within the included headers which I did not create.
    As for the browsers - works in both browsers on the dev server but neither on the live server.

    Thanks I will let you know.

    JK
    Inspiring
    November 10, 2008
    Hard to diagnose without a code sample.
    JeffKAuthor
    Inspiring
    November 11, 2008
    I have attached the code. Thanks!