This works in IE but not FF

M

Martin

I have this simple little script that submits a page where some
server-side scripting deletes a record from a database. This works as
expected in IE but it appears that, in FF, the submit is not occurring
(I'm receiving nothing at the server). FWIW, the "confirm" dialog does
pop up and I can click OK/Cancel - but nothing happens after that.

What am I doing wrong?


function DoDelete(x)
{
var resp = confirm('Delete ' + x + '? - Are You Sure?');
if (resp)
{
document.all['deleteThis'].value=x;
document.forms.frmDisplay.submit();
}
}
 
M

Mick White

Martin said:
I have this simple little script that submits a page where some
server-side scripting deletes a record from a database. This works as
expected in IE but it appears that, in FF, the submit is not occurring
(I'm receiving nothing at the server). FWIW, the "confirm" dialog does
pop up and I can click OK/Cancel - but nothing happens after that.

What am I doing wrong?

You are using IE proprietary syntax:
document.all['deleteThis'].value=x; <----
What is "x", a form control?

Mick
function DoDelete(x)
{
var resp = confirm('Delete ' + x + '? - Are You Sure?');
if (resp)
{
document.all['deleteThis'].value=x;
document.forms.frmDisplay.submit();
}
}
 
M

Martin

Mick / David -

Thanks for the response but I still can't get this thing to submit. I
understand what you're saying about the IE-specific syntax. I changed
the way the passed-in value is assigned but the script still does not
submit in Firefox. Here's what I changed it to:

document.getElementById('deleteThis').value=x;

I've also changed the .submit statement to this:

document.forms['frmDisplay'].submit();

but, it didn't seem to make any difference.


BTW, here's the statement that calls the DoDelete function:

<input type="button" name="delIt" value="Delete This Record"
onclick="DoDelete("MyValue");

where "MyValue" is the data that is used by the server-side script to
find the proper record in the database.


Can anyone tell me what the problem is here?

Thanks again.


Martin said:
This works as expected in IE but it appears that, in FF, the submit is not
occurring
document.all['deleteThis'].value=x;

http://www.mozilla.org/docs/web-developer/upgrade_2.html#dom_unsupp
 
M

Mick White

Martin said:
Mick / David -

Thanks for the response but I still can't get this thing to submit. I
understand what you're saying about the IE-specific syntax. I changed
the way the passed-in value is assigned but the script still does not
submit in Firefox. Here's what I changed it to:

document.getElementById('deleteThis').value=x;

I've also changed the .submit statement to this:

document.forms['frmDisplay'].submit();

but, it didn't seem to make any difference.


BTW, here's the statement that calls the DoDelete function:

<input type="button" name="delIt" value="Delete This Record"
onclick="DoDelete("MyValue");

onclick="DoDelete("MyValue");

Should be something like the following:
onclick='DoDelete("MyValue");'

Without knowing what the function is trying to accomplish, it's
difficult to say what else may be wrong.
Mick
where "MyValue" is the data that is used by the server-side script to
find the proper record in the database.


Can anyone tell me what the problem is here?

Thanks again.


Martin wrote:

This works as expected in IE but it appears that, in FF, the submit is not
occurring
document.all['deleteThis'].value=x;

http://www.mozilla.org/docs/web-developer/upgrade_2.html#dom_unsupp
 
M

Martin

Martin said:
Mick / David -

Thanks for the response but I still can't get this thing to submit. I
understand what you're saying about the IE-specific syntax. I changed
the way the passed-in value is assigned but the script still does not
submit in Firefox. Here's what I changed it to:

document.getElementById('deleteThis').value=x;

I've also changed the .submit statement to this:

document.forms['frmDisplay'].submit();

but, it didn't seem to make any difference.


BTW, here's the statement that calls the DoDelete function:

<input type="button" name="delIt" value="Delete This Record"
onclick="DoDelete("MyValue");

onclick="DoDelete("MyValue");

Should be something like the following:
onclick='DoDelete("MyValue");'

Yes, you're correct. That was just a typo that occurred when I wrote
the newsgroup message.
Without knowing what the function is trying to accomplish, it's
difficult to say what else may be wrong.
Mick

Here's the entire function (with the modified statements as suggested
earlier):

function DoDelete(x)
{
var resp = confirm('Delete ' + x + '? - Are You Sure?');
if (resp)
{
document.all['deleteThis'].value=x;
document.forms['frmDisplay'].submit();
}
}

The function executes OK; the problem is that the "submit" does not
occur when the page is being viewed in Firefox.


Any suggestions?

where "MyValue" is the data that is used by the server-side script to
find the proper record in the database.


Can anyone tell me what the problem is here?

Thanks again.


Martin wrote:


This works as expected in IE but it appears that, in FF, the submit is not
occurring

document.all['deleteThis'].value=x;

http://www.mozilla.org/docs/web-developer/upgrade_2.html#dom_unsupp
 
M

Martin

OK, finally figured this out. These lines work in Firefox:

document.forms['frmDisplay'].elements['deleteThis'].value=x;
document.forms['frmDisplay'].submit();
 
R

Randy Webb

Martin said the following on 10/10/2005 4:38 PM:
OK, finally figured this out. These lines work in Firefox:

document.forms['frmDisplay'].elements['deleteThis'].value=x;
document.forms['frmDisplay'].submit();

Imagine that. It works in any other browser as well. And it only took
you 4 or 5 posts to figure out what you were told in the first one. Now,
if we can teach you to not top-post..

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top