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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

alert box with options? 1

Status
Not open for further replies.

derwent

Programmer
May 5, 2004
428
GB
Is it possible to make an alert box pop up when a form is submitted that provides the user with several options?

Here's an example

User clicks submit
box pops up containing some text and options:

text: Have you remembered to complete the thingymajig form?

options: yes and continue (goes to form processing page)
no (goes to thingymajig form page)
what is thingymajig (goes to info page)

Is something like this possible?
 
Not using the alert box in Javascript. You might be better off showing a DIV or something with your own HTML and trapping all the events to make it act like an alert box.

Cheers,
Jeff


[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Not with the standard alert / prompt / confirm boxes, no. If you want the extra 3rd option (what is...), then you will have to use a custom DHTML solution.

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
If I put the info onto the second page is it possible to have two buttons then, the first going to the form action page and the second to another url?

thanks folks
 
You can use window.confirm to have two options (OK and Cancel) and a message.

You can detect which of the buttons was pressed, and forward to the relevant page.

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
You can use window.confirm to have two options (OK and Cancel) and a message.

You cannot change the name of these button, or the order they display on the message box. You cannot change the font of the message box, nor can you make the buttons bold.

These are restrictions of the browser. Not javascript.

Cheers,
Jeff


[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
:eek:(

Looks like a confirm box is the way to go. I have found this code that creates a confirm box and displays an alert box. Is it possible to change the if else to either goto the form action page if OK is clicked and goto another page if cancel is clicked?

<script>
var x=window.confirm("have you completed step 1?")
if (x)
window.alert("Good!")
else
window.alert("Too bad")
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top