PDA

View Full Version : Javascript will not work on first visit


dcb286193
12-22-2009, 11:31 AM
I have a form that calculates price according to items selected in drop down menus using Javascript. The very first time you visit the page it will not call the function to calculate. If you close the window then re-open it the calculation works just fine.

Hope someone can point me in the right direction as to why this is happening.

Jimmy Wu
12-22-2009, 12:04 PM
How was this Javascript created? Are you importing it from another file or is it inline? Make sure the import happens before the calculation if it is imported.

Unfortunately, since this code doesn't seem to be generated by any WebAssist products, it is not supported by us, but there may be users on the forum that can help you on this issue.

dcb286193
12-22-2009, 02:55 PM
The Javascript is created in-line.

You are correct it was not generated by any WebAssist product. I don't want to give anyone the wrong idea about the products produced by WebAssist. They are robust and very functional and if their is a issue they are here to support it and do a fine job at that.

I appreciate your response. I do however, seem to have an undefined index (new session variable) in the code which is defined after the Javascript code. So when you first enter the page it creates an error, then after canceling and re-entering the page since the index (session variable) was previously defined the error no longer exists.

Defining the index (session variable) prior to the Javascript codes seems to have solved the problem. Thanks