By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,719 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,719 IT Pros & Developers. It's quick & easy.

submit form using a function and a confirm box

P: n/a
I am submitting a form using an image as the link to a js file.
The image calls a js function which checks fields- issuing alerts for
errors - if no errors it then submits the form.
I would like to have a final confirm box run from the function before the
form is submitted.
I guess I would have to use the return statement somehow but I can't see
quite how.
Any help gratefully accepted

John
--
__________________________________________________ __________________
The information in this message is confidential and is intended solely
for the addressee. If you are not the recipient intended by SiteWeave,
any disclosure, copying, distribution or any action taken or omitted to
be taken in reliance on it, is prohibited.

Please note that all business is subject to our terms and conditions,
available upon request or through our website.

www.siteweave.net
__________________________________________________ __________________

Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Janwillem Borleffs" <jw*@jwbfoto.demon.nl> wrote in message
news:3f***********************@news.euronet.nl...

"btopenworld" <jo**@siteweave.net> schreef in bericht
news:be**********@sparta.btinternet.com...
I am submitting a form using an image as the link to a js file.
The image calls a js function which checks fields- issuing alerts for
errors - if no errors it then submits the form.
I would like to have a final confirm box run from the function before the form is submitted.
I guess I would have to use the return statement somehow but I can't see
quite how.
Any help gratefully accepted


A simple

<form onsubmit="if (formValidated()) return confirm('Submit form?'); else
return false"....>

should to do it.

JW

thanks - could you tell me what the end of the validation script does - at
the moment it is submitting the form - document.form1.submit() - this seems
to bypass the onsubmit part of the form. I can't use a normal submit button
because I am using an image to trigger the submission

thanks
John
Jul 20 '05 #2

P: n/a
"btopenworld" <jo**@siteweave.net> wrote in message
news:be**********@hercules.btinternet.com...
<snip>
... . I can't use a normal submit button
because I am using an image to trigger the submission


<input type="image" src="example.gif">

Richard.
Jul 20 '05 #3

P: n/a

"Richard Cornford" <Ri*****@litotes.demon.co.uk> schreef in bericht
news:be*******************@news.demon.co.uk...

Or maybe:-

<form onsubmit="return (formValidated()&& confirm('Submit form?'));">


Yes, you're right...

JW

Jul 20 '05 #4

P: n/a

"Janwillem Borleffs" <jw*@jwbfoto.demon.nl> wrote in message
news:3f***********************@news.euronet.nl...

"Richard Cornford" <Ri*****@litotes.demon.co.uk> schreef in bericht
news:be*******************@news.demon.co.uk...

Or maybe:-

<form onsubmit="return (formValidated()&& confirm('Submit form?'));">


Yes, you're right...

JW


Is the onsubmit called if the form is submitted via a function?

John
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.