473,386 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

submit onlick prompt not working with IE??!!

Hello,

Very odd this?

I have a form which has

<input name="Submit" type="Submit" value="Click to send _
when finished" onclick="getName()">

and

function getName() {
var yourname = prompt("please give your first name and _
second name","type first name and second name here");
document.demoForm1.name.value = yourname;
}

This works OK with Firefox but not with Internet Explorer! No window
comes up asking for the name - just skips this part and sends the form
info by email.

Why should this be?!

Cheers

Geoff
Apr 10 '07 #1
4 2265
Geoff Cox said the following on 4/10/2007 4:40 AM:
Hello,

Very odd this?

I have a form which has

<input name="Submit" type="Submit" value="Click to send _
when finished" onclick="getName()">

and

function getName() {
var yourname = prompt("please give your first name and _
second name","type first name and second name here");
document.demoForm1.name.value = yourname;
}

This works OK with Firefox but not with Internet Explorer! No window
comes up asking for the name - just skips this part and sends the form
info by email.

Why should this be?!
Because the form is getting submitted before the prompt comes up.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 10 '07 #2
On Tue, 10 Apr 2007 08:38:09 -0400, Randy Webb
<Hi************@aol.comwrote:
>Geoff Cox said the following on 4/10/2007 4:40 AM:
>Hello,

Very odd this?

I have a form which has

<input name="Submit" type="Submit" value="Click to send _
when finished" onclick="getName()">

and

function getName() {
var yourname = prompt("please give your first name and _
second name","type first name and second name here");
document.demoForm1.name.value = yourname;
}

This works OK with Firefox but not with Internet Explorer! No window
comes up asking for the name - just skips this part and sends the form
info by email.

Why should this be?!

Because the form is getting submitted before the prompt comes up.
Randy,

I don't think so because it works for me with IE and Mozilla - someone
else does not see the prompt with IE, not even after the form has been
submitted.

Cheers

Geoff
Apr 10 '07 #3
Lee
Geoff Cox said:
>
On Tue, 10 Apr 2007 08:38:09 -0400, Randy Webb
<Hi************@aol.comwrote:
>>Geoff Cox said the following on 4/10/2007 4:40 AM:
>>Hello,

Very odd this?

I have a form which has

<input name="Submit" type="Submit" value="Click to send _
when finished" onclick="getName()">

and

function getName() {
var yourname = prompt("please give your first name and _
second name","type first name and second name here");
document.demoForm1.name.value = yourname;
}

This works OK with Firefox but not with Internet Explorer! No window
comes up asking for the name - just skips this part and sends the form
info by email.

Why should this be?!

Because the form is getting submitted before the prompt comes up.

Randy,

I don't think so because it works for me with IE and Mozilla - someone
else does not see the prompt with IE, not even after the form has been
submitted.

Cheers

Geoff
Avoid using the onclick handler of a submit element.
Using the onsubmit handler of the form is more reliable.
Neither should be used to obtain more information from the user,
since there's little opportunity to validate the new data.
--

Apr 10 '07 #4
On 10 Apr 2007 08:37:59 -0700, Lee <RE**************@cox.netwrote:

>Avoid using the onclick handler of a submit element.
Using the onsubmit handler of the form is more reliable.
Neither should be used to obtain more information from the user,
since there's little opportunity to validate the new data.
Thanks Lee, in fact I have gone back to using a simple text box!

Cheers

Geoff
Apr 10 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Syed Ali | last post by:
Hello, I have 1 HTML form with 4 submit buttons and 10 textfield entry areas. If submit button1 is pressed I need to make sure that all 10 textfield entries have been filled before submitting...
2
by: Kenneth | last post by:
Is there anyway to create a javascript function to submit a form in the same html file?
3
by: sancha | last post by:
Hi, i am in a bit of a delima here. I need to submit an action through javascript so i used document.forms.action='/search.do?&submitaction=Add Minus' document.forms.submit(); since i am...
4
by: gimme_this_gimme_that | last post by:
Hi, This is sort of a : How to build a Yes/No dialog box qquestion. Or perhaps a question about getting javascript variables from a pop-up window and processing them on a submit. This is...
1
by: Mark | last post by:
Hi - on my site, overnight, my submit buttons have suddenly stopped working in IE. Firefox is fine. The link button works perfectly - the two submit buttons however do not. It works in IE...
3
by: Amer Neely | last post by:
I have a simple form that is giving me grief in IE (6) and has me stumped. It works fine with Mozilla. No JavaScript involved. Visit http://www.softouch.on.ca/cgi-bin/confirmation_ie.pl Other...
0
by: V1RuZ | last post by:
Hi all, I'm having some trouble getting my php code to work properly. I'm submitting three different variables from a vxml form to my php. I then need the php to deposit the variables into files...
4
by: j1dopeman | last post by:
Hi, I'd like to use a button to save and then submit a form. I can set the onlick of the button to mahButton_click or submit, but I can't figure out how to do both. It looks like c# can't...
13
Frinavale
by: Frinavale | last post by:
I've been trying all morning to cancel a form submit to the server. I have a JavaScript Object that determines whether or not the page should be submitted to the server depending on whether the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.