473,595 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10671

"Janwillem Borleffs" <jw*@jwbfoto.de mon.nl> wrote in message
news:3f******** *************** @news.euronet.n l...

"btopenworl d" <jo**@siteweave .net> schreef in bericht
news:be******** **@sparta.btint ernet.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
"btopenworl d" <jo**@siteweave .net> wrote in message
news:be******** **@hercules.bti nternet.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.gi f">

Richard.
Jul 20 '05 #3

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

Or maybe:-

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


Yes, you're right...

JW

Jul 20 '05 #4

"Janwillem Borleffs" <jw*@jwbfoto.de mon.nl> wrote in message
news:3f******** *************** @news.euronet.n l...

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

Or maybe:-

<form onsubmit="retur n (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
4286
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 that has been modified/clicked the form doesn't always submit. When it does work, a Stored procedure is passed form variables and updates to the db are made. When it doesn't, its as if the form wasn't submitted, it reloads and resets the page, but...
3
5074
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 false ; } else { item.value="Please wait" ;
4
3603
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 should change into "Are you sure" and when you then click the button the form must be submitted. I know this is possible using a simple dialog box but I want to this it this way. This is what I already have, if you have any suggestions please...
2
4889
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 had to add a JavaScript function to the Submit button to make a server function run when the form was submitted. Unfortunately, this JavaScript wouldn't run when the button was designated as a Submit, so I changed the button and placed a...
7
1995
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" ;?>').submit()>Delete?</a>. This method worked perfectly fine. But then I also wanted to add a confirm box to the user where. A confirm("do you really want to delete?"). So I made the function: function controll()
13
1741
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 everyone has their own opinion on HOW things should be done. However, if it does not comes AFTER helping me figure out my problem, please... (fill in your own polite way to say 'save the bandwidth'). I have code in a MouseUp of my save button...
4
4929
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 what I'd like to have happen :
2
1965
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 document.forms.submit() in the script, I would like to execute the code in the click event of the submit button. How could I link this event to the Form.submit function?
10
8588
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 not defined' in Firefox.. My very expensive javascript Bible assures me its built in ..so where oh where have I FSCKED up?
0
7955
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7883
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8261
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8019
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6674
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5839
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3873
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3911
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1490
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.