473,401 Members | 2,146 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,401 software developers and data experts.

submit form using a function and a confirm box

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
4 10664

"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
"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

"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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
3
by: Vincent M. | last post by:
Hello, I have a form which allow to submit a file, I'd like to block the submit buton once it has been clicked, so I tried: function SubmitNow(item){ if(item.value=="Please wait") { return...
4
by: Christiaan | last post by:
I am trying to create a small javascript to change the button text and then submit it and do all kinds of form validations. So I have a button with the value "Save", when the button is clicked it...
2
by: Margaret Werdermann | last post by:
Hi all: I'm having a nasty time with a particularly difficult piece of code and was hoping someone might be able to help me. I have a FormMail form that originally worked perfectly. Then, I...
7
by: sindre | last post by:
Hi, Some place I use links to submit forms instead of a submit button. The way I have done this is: <a href="javascript:document.getElementById('<?php print "delete$i"...
13
by: John Kiernan | last post by:
Hey JavaScript gurus... I'm going to try this again. I haven't gotten as much help as I have advice on style<grin>. I appreciate (having programmed in other languages for quite a while) that...
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...
2
by: Billy | last post by:
Hi. I'm new to asp.net and I'm trying to create a confirm dialog box using the confirm() javascript function that will pup once the submit button is pressed. My problem is when I call...
10
by: The Natural Philosopher | last post by:
I am coding up a bit of javascript stuff, and have managed to stumble my way through most of what I want.. But this one has got me stumped. I call submit() and get a javascript error 'Submit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.