Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
On Submition.. Ask if want to Cancel or Continue
Old 11-21-2005, 01:18 PM On Submition.. Ask if want to Cancel or Continue
NuWeb.co.uk's Avatar
NuWeb.co.uk is OFFLINE

Posts: 361
Trades: 0
Hello guys, i wont pretend i am realy good with PHP, because im truley not. I have used the codeing
Code:
<input type="submit" value="Submit" onclick="alert('Please ensure that the order is correct before moveing further. Changes can not be made after this point. Continue?')" name="B1">
And this works fine, their is a alert like i wanted, although i want buttons
"CONTINUE" and "CANCEL"
on their

If they click continue, it carries on with the form.
If they click cancel, it does not submit and stays on the form.
__________________

Please login or register to view this content. Registration is FREE


NuWeb 10101101
NuWeb.co.uk is offline
Reply With Quote
View Public Profile Visit NuWeb.co.uk's homepage!
 
 
Register now for full access!
Old 11-21-2005, 01:46 PM
madkad's Avatar
madkad-hosting.com

Posts: 310
Location: UK
Trades: 0
I have this code it gives you to buttons for you to select if you select ok then it will take you to another url and if you select cancle then you will go to a different url

it was made for onliad msg so will need to be played with to work with onclick


Code:
<script language="JavaScript">
var viewer_choice = confirm ("Click \"OK\" to go to Google. Click \"Cancel\" to go to Yahoo!");
if (viewer_choice == true) {document.location = "http://www.yes i want to url.com/";}
else {document.location = "http://www.dont want to url.com/";}
</script>
dont know if that is any good to you
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Great Hosting For You
madkad is offline
Reply With Quote
View Public Profile Visit madkad's homepage!
 
Old 11-22-2005, 10:32 AM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
madkad has the right idea, using confirm.

Just place an 'onsubmit' listener to your <form>:
HTML Code:
<form onsubmit="return confirm('Continue?');">
Basically, when you return false it cancels the action. confirm() returns true on pressing 'OK' and false on 'Cancel'. Returning it's value will give you the effect you want.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 11-22-2005, 01:06 PM
NuWeb.co.uk's Avatar
NuWeb.co.uk is OFFLINE

Posts: 361
Trades: 0
ok i get it now i think.

Thanks for all your help Chroder and madkad.

But, if i put: the start of the form to like:
<form onsubmit="return confirm('Continue?');">
and put the javascript that you said madkad on the page as well>

I have not defined what the script is called for example, so how does it know what to do?

..
__________________

Please login or register to view this content. Registration is FREE


NuWeb 10101101
NuWeb.co.uk is offline
Reply With Quote
View Public Profile Visit NuWeb.co.uk's homepage!
 
Old 11-22-2005, 02:13 PM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
No sure what you mean... confirm() is a built in JS function, so you don't need to define it anywhere on the page for it to work. Or are you referring to pointing the form's action script (<form mehtod="post" action="yourscript.php">) where yourscript.php is the form handling script?
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 11-25-2005, 01:21 AM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
NuWeb, it was just an example <form> tag to illustrate where to place the code You would still place all of your other attributes you needed (method, action, name etc, as funkdaddu pointed out).
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to On Submition.. Ask if want to Cancel or Continue
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26583 seconds with 12 queries