Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

prompt box

Status
Not open for further replies.

bretttt

Programmer
Jul 23, 2002
74
US
i have this

<script language=&quot;javascript&quot;>
function doFoo(){
var foo=prompt(&quot;\&quot;Please Enter Tracking Number\&quot;&quot;);
if(foo != null && foo != &quot; &quot;){
document.myForm.myField.value = foo;
document.myForm.submit();
}
}
</script>

it is submiting the form no matter what if the form is blank i do not want it to submit the form
 

brett,

The code looks fine. It is most likely some button or image in your form that is bypassing the onSubmit event, maybe?

Can you post your HTML code as well?

Thanks,
Dan
 
bretttt:

you don't need to start a new thread for the same question that you posted a minute ago!!!!
 
Try changing:
if(foo != null && foo != &quot; &quot;){

To:
if(foo != null && foo != &quot;&quot;){

Adam
while(ignorance==true){perpetuate(violence,fear,hatred);life=life-1};
 
how can i make it if foo isnt blank then redirect to anoter page?

thank you
 
It's seems like there is a different behaviour of prompt between FireFox and Internet Explorer.
In IE when clicking the 'Cancel' button I get the string null
In FF I get a "real" null

Can anyone confirm the behaviour difference? I tried searching for it but got zilch.

thanks.
 
Putting this in your URL bar in IE and FF:

Code:
javascript:alert(typeof(window.prompt('', '')));

running it, and then hitting escape, returns "Object" for both browsers.

Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top