Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Javascript Mystery

Explorer ,
Nov 10, 2008 Nov 10, 2008
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
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 11, 2008 Nov 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 w...
Translate
Advisor ,
Nov 10, 2008 Nov 10, 2008
Hard to diagnose without a code sample.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 11, 2008 Nov 11, 2008
I have attached the code. Thanks!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 10, 2008 Nov 10, 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 10, 2008 Nov 10, 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 10, 2008 Nov 10, 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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 11, 2008 Nov 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 11, 2008 Nov 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)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 11, 2008 Nov 11, 2008
quote:

Originally posted by: JeffK
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)




I don't see the three lines with cfcookie in the code sample you posted. Can you post the code for apppresubmit.cfm?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 11, 2008 Nov 11, 2008
Here is preappsubmit - basically just setting cookies for the remainder of the app process. Thanks!

<cfcookie name="nyres" value="#nyresident#">
<cfcookie name="felony" value="#felony#">
<cfcookie name="hisplat" value="#hisplat#">
<cfcookie name="uscit" value="#uscit#">
<cfcookie name="hsstdnt" value="#hsstdnt#">
<cfcookie name="collcr" value="#collcr#">
<cfcookie name="ssn" value="">
<cflocation url="app.cfm">
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 11, 2008 Nov 11, 2008
In order to handle browsers without Javascript enabled I suggest that you check for the existence of the form fields you are requiring, and that they contain acceptable values. If not redirect the browser to the data entry page.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 11, 2008 Nov 11, 2008
JR, Agreed, but I would still like to know why the js is not working on the live server when it works fine on the development server.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 11, 2008 Nov 11, 2008
What are the CF versions on each server? It is possible that an update changed the way cfform is handled under the hood and the difference is at the root of your problem.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 11, 2008 Nov 11, 2008
Just some small items just in case - There are some minor differences between the servers. First the dev server is running 7.00 while live server is running 7.01, ASP.NET is running on the live server and finally the code is being run under https on the live server. Thanks!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 11, 2008 Nov 11, 2008
quote:

Originally posted by: JeffK
Just some small items just in case - There are some minor differences between the servers. First the dev server is running 7.00 while live server is running 7.01, ASP.NET is running on the live server and finally the code is being run under https on the live server. Thanks!


I wouldn't expect .NET or SSL to be an issue but 7.00 vs 7.01 may account for the difference.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 11, 2008 Nov 11, 2008
I reviewed the changes between 7 and 7.01 and there was no mention of any issues with js. I don't think this is the problem but I am going to investigate further - it may mean upgrading the dev srvr.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 11, 2008 Nov 11, 2008
if <cfcookie name="nyres" value="#nyresident#"> is line 1 in your page,
where ARE you setting #nyresident# variable?
sure you are not forgetting to <cfinclude> some template?
or scope the var to correct scope (session/application/form/url/etc?
if it is set in one of the persistent scopes - is that scope enabled on
the prod server? is that var set in that scope on the prod server?

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 11, 2008 Nov 11, 2008
while i am having a look at your code, the next debugging step on your
side may be to have a look at generated page source of the page on your
dev comp and on the server, and check if they differ and where...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 11, 2008 Nov 11, 2008
Azadi,
Thanks will do. Just some small items just in case - There are some minor differences between the servers. First the dev server is running 7.00 while live server is running 7.01, ASP.NET is running on the live server and finally the code is being run under https on the live server. Thanks!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 11, 2008 Nov 11, 2008
OK I found two instances of code that was not the same:

First the Development Server code of the function '_CF_checkpreapp'

function _CF_checkpreapp(_CF_this)
{
//reset on submit
_CF_error_exists = false;
_CF_error_messages = new Array();
_CF_error_fields = new Object();
_CF_FirstErrorField = null;

....

}
return false;
}else {
return true;
}
}

And now the Live server (please note the changes at the end:

return false;
}else {
// run userdefined onSubmit javascript.
return submitinfo(this)
return true;
}
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 11, 2008 Nov 11, 2008
Here is the second which is found in the form tag - note the name change of the onsubmit javascript program name.

Dev Server:
<form name="preapp" action="apppresubmit.cfm" method="POST" onsubmit="return submitinfo(this)">

Live Server:
<form name="preapp" action="apppresubmit.cfm" method="POST" onsubmit="return _CF_checkpreapp(this)">
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 11, 2008 Nov 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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 11, 2008 Nov 11, 2008
LATEST
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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources