I have created a form which has two submit buttons. The first is a
preview button to view the data they have entered into a formated
page. The second actually submits the data for saving. The two
submit buttons have onclick events defined for both the targets and
actions. These are both working OK.
However, I have an onsubmit event in the form tag which validates the
data which is also triggered when the preview button is clicked. I
want to block this behavior.
Is there a way to determine which button is clicked in the validation
function, or bypass it altogether? Perhaps there is a better way to
trigger the validation than onsubmit?
TIA! 5 2010
Tyrone Slothrop a écrit :
>
Is there a way to determine which button is clicked in the validation
function, or bypass it altogether? Perhaps there is a better way to
trigger the validation than onsubmit?
on my idea everything has to happen in form's onsubmit
<form onsbmit="if(but ==1) return dothat(); else return dothis();" ... >
<input type=submit onclick="but=1" ... >
<input type=submit onclick="but=2" ... >
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Tyrone Slothrop said:
> I have created a form which has two submit buttons. The first is a preview button to view the data they have entered into a formated page. The second actually submits the data for saving. The two submit buttons have onclick events defined for both the targets and actions. These are both working OK.
However, I have an onsubmit event in the form tag which validates the data which is also triggered when the preview button is clicked. I want to block this behavior.
Is there a way to determine which button is clicked in the validation function, or bypass it altogether? Perhaps there is a better way to trigger the validation than onsubmit?
I would do the preview processing locally, and do away with the
bogus submit button completely. That also allows you to avoid
the onclick handler in the "real" submit button, and so probably
even allows people with scripting disabled to use your form.
--
On Thu, 28 Dec 2006 19:46:47 +0100, ASM
<st************ *********@wanad oo.fr.invalidwr ote:
>Tyrone Slothrop a écrit :
>> Is there a way to determine which button is clicked in the validation function, or bypass it altogether? Perhaps there is a better way to trigger the validation than onsubmit?
on my idea everything has to happen in form's onsubmit
<form onsbmit="if(but ==1) return dothat(); else return dothis();" ... > <input type=submit onclick="but=1" ... > <input type=submit onclick="but=2" ... >
Merci.
In short:
<form onsubmit="if(bu tton){validateF orm();}">
<input type="submit" onclick="button =true;">
Tyrone Slothrop a écrit :
On Thu, 28 Dec 2006 19:46:47 +0100, ASM
<st************ *********@wanad oo.fr.invalidwr ote:
>on my idea everything has to happen in form's onsubmit
<form onsbmit="if(but ==1) return dothat(); else return dothis();" ... > <input type=submit onclick="but=1" ... > <input type=submit onclick="but=2" ... >
Merci.
In short:
<form onsubmit="if(bu tton){validateF orm();}">
<input type="submit" onclick="button =true;">
all depends if you have one or more actions on submitting
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Tyrone Slothrop escreveu:
In short:
<form onsubmit="if(bu tton){validateF orm();}">
<input type="submit" onclick="button =true;">
The bellow code works just on Firefox :(
<input type="submit" name="save" />
if(event.origin alTarget.name == "save")
--
Jonas Raoni Soares Silva http://www.jsfromhell.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matt |
last post by:
The ASP page has multiple buttons, and when the user clicks different
buttons, it will submit the form data to different URLs.
My first approach was to use BUTTON type, and triggers javascript function
to submit the form data. However, it didn't work properly and I changed to
use SUBMIT type.
<INPUT TYPE="BUTTON" NAME="action1" VALUE="Return to Main Search Page"
onClick="action1()">
|
by: geotso |
last post by:
Hi.
I supose that my problem has a javascript solution so, I kindly ask for your
help:
I want to use a link to open one of two files (*not both*) stored each one
in a different partition of my disk. For example:
When a user clicks the link in question, IE searches for the first path
(F:\Folder\file.htm) and opens the file (not procceeding with the second
path). However, if IE can't locate the first file (file or path don't
|
by: hzgt9b |
last post by:
Using VB .NET 2003,
I have a windows application that performs a series of file actions (copy,
move, delete) but the actions are completing before the window is painted on
the screen... how can I force the form to be painted on the screen first,
then the actions start? Or should I pause the app for a few seconds while the
form paints.
Any suggestion woudl be appreciated!
|
by: asad.naeem |
last post by:
hi to all
this is the problem about inheritence. I have designed a form with some
essential controls which are required for every form which will
inherited from it. for example i have Button1 on parent form and this
button is visible to me on inherited form.
The problem is:
I have written a click event of the button1 on both of the forms. tell
me the way if i click the button on inherited form only parents' click
event will be called and...
|
by: newbie |
last post by:
i have a form in which a hidden field (initial value as '0', and my
javascript set it to '1' when an event is trigged).
In the same form, i have a reset field. But I realized that the hidden
field is not reset to '0' when i push the
reset button. If I simply change the node from
"<input type="hidden" id='IsChanged' value='0'>"
to
"<input type="text" id='IsChanged' value='0'>"
Everything is working as expected (the value is reset to '0'...
| |
by: xNephilimx |
last post by:
lHi guys!
I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still lack some JavaScript solid knowdlege)
The problem is that when I try to send a form's content with Ajax (I'm using the prototype library), for some reason the latin characters (accents and stuff, like áéíóú) turn a mess when I try to store them in...
|
by: Daniel Klein |
last post by:
I'm pretty new at php and web stuff so please be gentle with me.
I'm trying to get a form to submit when the user presses the Enter
key. I do not want to use javascript. I've googled this to death and
cant find the answer (only hints), except on the 'Experts Exhange'
page and you have to pay to get the answer :-(
Why is this such a secret in the open source world we live in?
Daniel Klein
|
by: inepu |
last post by:
I have 3 tables, Actions, Objects and AO, where "AO" a table that relates Actions and Objects, each row is a pair the other tables' keys)
I have a form that is generated with values from Objects, each form page only shows info on one Object. What I would like to do is to add a list box that shows what Actions are available for this Object.
I would guess that the listbox would have to be populated by the query
"select Actions.* from...
|
by: |
last post by:
Hi,
After installing SP1 for VS2008 and SP1 for .NET 3.5 we get the following
warning in a VS2005 build:
error CS0618: Warning as Error: 'System.Windows.UIElement.BitmapEffect' is
obsolete: 'Avoid using BitmapEffects as they have very poor performance
characteristics. They will be deprecated in a future version. Consider
using the UIElement.Effect property and ShaderEffects where appropriate
instead.'
|
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...
|
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,...
| |
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...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| | |