Is there a way to use 'document.form. submit()' to submit a form to a url
other than that specified in the Form element?
--
Ed Jay (remove M to respond by email) 8 17868
"Ed Jay" <ed***@aes-intl.com> wrote in message
news:7b******** *************** *********@4ax.c om... Is there a way to use 'document.form. submit()' to submit a form to a url other than that specified in the Form element?
-- Ed Jay (remove M to respond by email)
Yes. Change the form's "action=" value.
"McKirahan" <Ne**@McKirahan .com> wrote: "Ed Jay" <ed***@aes-intl.com> wrote in message news:7b******* *************** **********@4ax. com... Is there a way to use 'document.form. submit()' to submit a form to a url other than that specified in the Form element?
-- Ed Jay (remove M to respond by email)
Yes. Change the form's "action=" value.
Please elaborate.
I presume you mean something like document.form.? ??=new-url? Is this a
'permanent' change, i.e., do I have to reinitialize the page to return to
the original action?
--
Ed Jay (remove M to respond by email)
Ed Jay <ed***@aes-intl.com> wrote: "McKirahan" <Ne**@McKirahan .com> wrote:
"Ed Jay" <ed***@aes-intl.com> wrote in message news:7b****** *************** ***********@4ax .com... Is there a way to use 'document.form. submit()' to submit a form to a url other than that specified in the Form element?
-- Ed Jay (remove M to respond by email)
Yes. Change the form's "action=" value. Please elaborate.
I presume you mean something like document.form.? ??=new-url? Is this a 'permanent' change, i.e., do I have to reinitialize the page to return to the original action?
Never mind. :-)
document.form.a ction = "new url" works and isn't permanent.
Thanks. (I was about to try rewriting the entire Form element with
innerHTML, but the outcome is only temporarily useful.)
--
Ed Jay (remove M to respond by email)
Lee <RE************ **@cox.net> wrote: Ed Jay said: Is there a way to use 'document.form. submit()' to submit a form to a url other than that specified in the Form element?
No, but you can change the URL specified in the Form object: document.form.a ction=myNewUrl; document.form.s ubmit();
But you should consider using the onSubmit handler, instead of the submit() method.
Thanks, Lee. I'm using onSubmit to call a preliminary validation script
and then submit() to actually submit the form.
I have a multi-page server-side app with the last page a report. I want to
be able to edit an earlier page and resubmit the edited data directly to
the last page; hence...
--
Ed Jay (remove M to respond by email)
Lee <RE************ **@cox.net> wrote: Ed Jay said:
Thanks, Lee. I'm using onSubmit to call a preliminary validation script and then submit() to actually submit the form.
Don't do that. If you want to actually submit the form, have the onsubmit handler return true. If you don't want it to submit, return false.
<form action="whateve r" onsubmit="retur n myValidation(th is)">
I respect your advice, but please 'splain me why it's a bad idea to use
submit().
--
Ed Jay (remove M to respond by email)
Ed Jay said the following on 12/28/2005 5:48 PM: Lee <RE************ **@cox.net> wrote:
Ed Jay said:
Thanks, Lee. I'm using onSubmit to call a preliminary validation script and then submit() to actually submit the form.
Don't do that. If you want to actually submit the form, have the onsubmit handler return true. If you don't want it to submit, return false.
<form action="whateve r" onsubmit="retur n myValidation(th is)">
I respect your advice, but please 'splain me why it's a bad idea to use submit().
Disable javascript and then try to document.formNa me.submit().
At least by using the onSubmit, you leave the form useable by nonJS
browsers.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Lee <RE************ **@cox.net> wrote: Ed Jay said: Lee <RE************ **@cox.net> wrote:
Ed Jay said:
Thanks, Lee. I'm using onSubmit to call a preliminary validation script and then submit() to actually submit the form.
Don't do that. If you want to actually submit the form, have the onsubmit handler return true. If you don't want it to submit, return false.
<form action="whateve r" onsubmit="retur n myValidation(th is)"> I respect your advice, but please 'splain me why it's a bad idea to use submit().
The simple answer is that it's simpler. The browser is already in the process of submitting the form. It's just waiting for the onSubmit handler to give it permission to proceed by returning anything except false. Why go to the extra step of invoking the submit() method?
Understood. Of course, one could argue that as you're already in a js
routine validating or whatever, it's just as simple to finish in the js.
:-) A more complete answer includes considerations of users who don't have Javascript enabled, the chance that some browsers will be confused by having submit() invoked while they're already in the process of submitting the form, and the fact that the submit() method is frequently accidentally clobbered by adding a form element named "submit".
Yes, you're both 100% correct in this regard. That said, my visitors are
clients using the application as a paid-for service. I require that js be
enabled to take advantage of the service. If they don't want to do that
because they think it makes their system more secure or it blocks popups,
or whatever, we'll be supplying them with dedicated Opera or Firefox with
custom ini files in which js will be enabled.
Certainly, though, for generic web-based application, I agree...use js
sparingly.
Thanks much for the comments and explanation.
--
Ed Jay (remove M to respond by email)
Randy Webb <Hi************ @aol.com> wrote: Ed Jay said the following on 12/28/2005 5:48 PM: Lee <RE************ **@cox.net> wrote:
Ed Jay said:
Thanks, Lee. I'm using onSubmit to call a preliminary validation script and then submit() to actually submit the form.
Don't do that. If you want to actually submit the form, have the onsubmit handler return true. If you don't want it to submit, return false.
<form action="whateve r" onsubmit="retur n myValidation(th is)">
I respect your advice, but please 'splain me why it's a bad idea to use submit().
Disable javascript and then try to document.formNa me.submit().
At least by using the onSubmit, you leave the form useable by nonJS browsers.
Understood. Thank you.
--
Ed Jay (remove M to respond by email) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Varun |
last post by:
Hi There,
I have a form("myRequest.asp") and the values from it are
retrieved into the page ("output_Print.asp") on which I have two
buttons('Save As Complete' and 'Save As Incomplete'). When the 'Save
as Incomplete' button is Clicked the form will be going to the
"SaveAsincomplete.asp" without validation of the fields. And when the
'save as complete' is clicked certain fileds are to be validated and
by the function return value, if false...
|
by: Chris |
last post by:
Heres my problem:
<a href="javascript:void(document.buysell.submit())" target="_parent"
onMouseOver="MM_swapImage('members','','images/membersf2.gif',1)"
onMouseOut="MM_swapImgRestore()"><img src="images/members.gif"
alt="Back to members page" name="members" width="270" height="25"
border="0"></a>
I get the error "document.buysell" is null or not an object, but my
form name is buysell and when using the submit button, which is not
|
by: Miles Davenport |
last post by:
My Javascript is rather rusty :( ... and I need to do change some form
values, in the folowing way:
(1).
I have the following a href (wrapped in PHP), which calls processForm.
====
<input type="hidden" name="myHiddenValue">
href="javascript:void(0)" onClick="processForm(\'' . $form_name
|
by: skubik |
last post by:
Hi everyone.
I'm attempting to write a Javascript that will create a form within a
brand-new document in a specific frame of a frameset. The problem is
that I can create the form and input element using createElement(), but
when I go to append the form element into the new document, the script
halts and I get the following error in my Javascript Console (Firefox 1.0):
__tmp_newDoc.body has no properties.
|
by: jiing.deng |
last post by:
I want to transfer a value "re1" to ldapDeleteUserExec.php
The "alert(document.ha)" appears a dialog and shows "undefined."
The "alert(document)" shows "object"
But there seems some problem:
The error msg said "document.ha.re1" is null or not a object
and can't transfer to the ldapDeleteUserExec.php
My friend told me that may be a DOM(Document Object Model) problem.
| |
by: terence.parker |
last post by:
I have a PHP application which I wrote last year - and the JavaScript
worked fine then. For some reason, now it doesn't - neither on IE nor
Firefox. Has something changed?
When I click on my HTML link now (which executes a JS function), the
firefox JS console tells me:
Error: document.SubjectsForm.submit is not a function
Any help would be much appreciated. Thanks!
|
by: davidkarlsson74 |
last post by:
Error: document.getElementById("folderMenu").cells has no properties
File: http://www.volkswagen.se/tillbehor/js/foldermenu.js
Rad: 49
The function activates different DIV:s, but doesn't seem to work on
FireFox or Netscape. What could be wrong?
The function:
function setActiveTab(tabNo) {
|
by: vunet |
last post by:
It is recommended by some sources I found to create IFrames in IE
using
document.createElement('<iframe src="#">')
instead of document.createElement('iframe').
Why and what browser versions to use it? IE5 or IE6?
Thanks
|
by: ChrisLA |
last post by:
Hi;
I've seen lots of discussion & disagreement on this issue, so any good explanation would be appreciated.
Some people seem to think that "document.GetElementByID("MyName").submit(); should and does work. I and others have experienced that it should & doesn't work. I'll give you a little file that I tested with IE 6, FF 3, Opera & Chrome. Only the form button, document.myname.submit(); and document.forms.submit(); worked. Take a...
|
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: 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: 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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |