Time:
Scotland: Fri, 9:54 pm
Rhode Island: Fri, 4:54 pm
Florida: Fri, 4:54 pm
New Mexico: Fri, 2:54 pm
California: Fri, 1:54 pm

Click here to visit Livelife365.com

Click here to visit nmdarts.com



Buy this Ad Space.

180px wide.

Please get in touch with KH@ if you are interested and make an offer.

CLICK HERE TO GET AUCTION BAR NOW
US$10 per year - Save $100s!
The Fabulously Unfair
WebX Auction Bar. For Ebay etc.
Ro-Sham-Bo the opposition. Laugh like Eric Cartman when you win! CLICK HERE NOW!


More information and sign-up.

WebXpertz Hosting.
Custom fit from $5pm. PHP/MySQL
You'll save money, we'll save money. Seems fair to me. Interested? If so Please PM me here and tell me what you need. Thanks!


Please click here for more information

For continued disscussion on this topic : Simple confirm msg/NS4.x just screwed up?


Cybian
01-21-2002, 11:49 PM
Hello all! I have a quick and easy question. I have a form that will delete a record and confirms it with an easy strip of code. Now this has been working fine until someone has to use Netscape 4.7. I tried it with a workstation that uses NS4.0 and sure enough I got this error. The error is:

JavaScript Error:
http://my site/file_modify.cfm, line 79

TheForm is not defined.

Now the simpe javascript is as follows:

<CFIF action EQ "delete">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--

function AreYouSure()
{
var msg = "___________________________________________\n\n" +
"You are about to delete this File.\n" +
"___________________________________________\n";
if (confirm(msg)) TheForm.submit();
else return false;
}

//-->
</SCRIPT>
</CFIF>

This looks perfectly fine to me. That is the forms names so what is with this error? Is it just another case of how Netscape 4.x can't handle javascript? Thanks in advance!

wmacey
01-22-2002, 12:02 AM
where does TheForm come from.....is it the actual name of the form in the HTML?

why not pass the form into the function

so that the Function signature is AreYouSure(inputForm)
{


and then have document.inputForm.submit();


Not sure I answered that very well...but let me know

Cybian
01-22-2002, 12:18 AM
The actually form name on the same page is called "TheForm".

The function "AreYouSure" is being called out by the CF action "delete" on the form.

This javascript is in conjunction with a coldfusion form (TheForm) when being submitted to the action cfm page with these variables "add, edit and delete". The javacript only comes into play when the user wants to delete a record. If you notice the code is wrapped in a CFIF action variable "delete". So after a user confirms it (clicks OK), the form then is submitted to the action page. Which will then delete the record in the database.

Besides the javascript being wrapped in the CFIF statement, it seems pretty straight forward. Except if NS4.x doesn't understand this strip of code "if (confirm(msg)) TheForm.submit();?"

Cybian
01-22-2002, 01:26 AM
Added document to this strip of code and it works in NS4.x now:

from:
if (confirm(msg)) TheForm.submit();

to:
if (confirm(msg)) document.TheForm.submit();

Guess NS wants document to be stated. Works now.

lorddog
01-22-2002, 02:27 AM
it's not nn4 but all browsers.
you have to define the path to the form name as
document.formname.elementname or
document.formname.method()

if you passed the form to the function it would of worked as is


<form onSubmit="return AreYouSure(this);" ...

and the function would look like this.
function AreYouSure(TheForm) { ...
TheForm would replace the document.formname

of course this last way you shouldnt name the form the same as the variable you use in the function.

Lorddog