How does one go about submitting a form with a link - but submitting
it to a new window AND to a page different to that described within
the action="" option of the <form> tag?
Say, for example, I have a simple form such as the following:
<form method="POST" action="submit. php" name="AForm">
Name: <input type="text" name="Name" length="20"><br >
Age: 15 <a href="age.php"> change age</a><br>
<input type="submit" name="submit" value="submit">
</form>
Clicking 'submit' will submit to 'submit.php' - but I want the link to
submit to 'age.php'.
This example is an oversimplificat ion of what I want to do - yes, I
know that in the example above I don't NEED to submit a link into a
new window... But, it's an example.
I know one can use ONCLICK="docume nt.formName.sub mit();return true;" -
but that submits to the same form defined in <form action> .
I know as well that I can use "onClick=window .open('link.php ','Popup
Window','toolba r=no,
location=no,dir ectories=no,sta tus=no,menubar= no,scrollbars=n o,
resizable=no,co pyhistory=no,wi dth=500,height= 500,top=20,left =
100')" (or something similar) to open a link to a new window.
But how do I combine the two - AND submit to a different location?
Basically, what i'm doing is one of those pages with customer
information - and for one of those choices I want to popup a new
window with a <select> . That submit will then send the data back to
the originating PHP page - and will reload it.
IDEALLY, I wouldn't even do it like this - just have javascript
replace the values on the originating page without reloading (and
resubmitting everything)... so if anyone knows how to do that, even
better!
Thanks,
Terence 2 73352
1. If you just want to open a new default window for output:
<form action="submit. php" target="_blank" >
2. If you want to redirect to a window with custom properties (size,
position etc.):
<script>
function redirectOutput( myForm) {
var w = window.open('ab out:blank','Pop up_Window','... params...');
myForm.target = 'Popup_Window';
return true;
}
</script>
<form action="submit. php" onSubmit="redir ectOutput(this) ">
....
</form>
Terence Parker <te*****@parker .com.hk> wrote in message
news:a9******** *************** ***@posting.goo gle.com... How does one go about submitting a form with a link - but submitting it to a new window AND to a page different to that described within the action="" option of the <form> tag?
Say, for example, I have a simple form such as the following:
<form method="POST" action="submit. php" name="AForm"> Name: <input type="text" name="Name" length="20"><br > Age: 15 <a href="age.php"> change age</a><br> <input type="submit" name="submit" value="submit"> </form>
Clicking 'submit' will submit to 'submit.php' - but I want the link to submit to 'age.php'.
This example is an oversimplificat ion of what I want to do - yes, I know that in the example above I don't NEED to submit a link into a new window... But, it's an example.
I know one can use ONCLICK="docume nt.formName.sub mit();return true;" - but that submits to the same form defined in <form action> .
I know as well that I can use "onClick=window .open('link.php ','Popup Window','toolba r=no, location=no,dir ectories=no,sta tus=no,menubar= no,scrollbars=n o, resizable=no,co pyhistory=no,wi dth=500,height= 500,top=20,left = 100')" (or something similar) to open a link to a new window.
But how do I combine the two - AND submit to a different location?
Basically, what i'm doing is one of those pages with customer information - and for one of those choices I want to popup a new window with a <select> . That submit will then send the data back to the originating PHP page - and will reload it.
IDEALLY, I wouldn't even do it like this - just have javascript replace the values on the originating page without reloading (and resubmitting everything)... so if anyone knows how to do that, even better!
Thanks,
Terence
Hi Terence,
Terence Parker wrote: How does one go about submitting a form with a link - but submitting it to a new window AND to a page different to that described within the action="" option of the <form> tag?
I'm a little confused here ... You always submit to a web server and
you submit to the action="" uri. The returned content can be directed to
another window.
Say, for example, I have a simple form such as the following:
<form method="POST" action="submit. php" name="AForm"> Name: <input type="text" name="Name" length="20"><br > Age: 15 <a href="age.php"> change age</a><br> <input type="submit" name="submit" value="submit"> </form>
Clicking 'submit' will submit to 'submit.php' - but I want the link to submit to 'age.php'.
If you want to submit to "age.php", why put "submit.php " as the value of
the action attribute? Put "age.php" there.
This example is an oversimplificat ion of what I want to do - yes, I know that in the example above I don't NEED to submit a link into a new window... But, it's an example.
I know one can use ONCLICK="docume nt.formName.sub mit();return true;" - but that submits to the same form defined in <form action> .
That's what it's supposed to do. Now, I do believe you can set the value
of action dynamically, something like
document.forms["formName"].action="uri";
before doing the submit...
I know as well that I can use "onClick=window .open('link.php ','Popup Window','toolba r=no, location=no,dir ectories=no,sta tus=no,menubar= no,scrollbars=n o, resizable=no,co pyhistory=no,wi dth=500,height= 500,top=20,left = 100')" (or something similar) to open a link to a new window.
But how do I combine the two - AND submit to a different location?
Basically, what i'm doing is one of those pages with customer information - and for one of those choices I want to popup a new window with a <select> . That submit will then send the data back to the originating PHP page - and will reload it.
IDEALLY, I wouldn't even do it like this - just have javascript replace the values on the originating page without reloading (and resubmitting everything)... so if anyone knows how to do that, even better!
Ah .. so we finally get to what the real need is. I think this last idea
is probably best; forget that popping up of extra windows. If you can do
it without the popups, good. If you can dynamically update the page
without making a round trip to the server, that's probably better, too.
For myself, I'd rather see you post some code with the specifics of what
you want in the <select> and what you'd like to see happen when the user
selects something. That might give a better starting point for advice
that can contribute to the solution that you'd ideally like to implement.
Regards,
Stephen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mark Michel |
last post by:
Hi. I have made an html form which I would like to send by e-mail. When
the recipient receives the e-mail form, I would like them to be able to fill
it out and click the Submit button which will submit to an ASP page. This
ASP page contains the code to submit the form data to a database. The page
works fine when viewed through a browser,...
|
by: Matt |
last post by:
The problem is I have 3 buttons that need to submit the form to different
URL.
My approach is to declare <input type="submit"> rather than <input
type="button">.
And put the following in the JavaScript:
InputForm.action="URL LOCATION"
InputForm.method="POST";
I think we don't need InputForm.submit(); because <input type="submit">.
|
by: Matt |
last post by:
The following program submit a FORM DATA to a new window using HTTP POST,
and postprocess.asp couldn't get the form data. If I do in GET method and
pass by
query string in windowURL, then it works. But I need HTTP POST method, are
there
any workarounds?
<html>
<script type="text/javascript">
function checkAndSubmitForm(theForm)
|
by: CJM |
last post by:
Can somebody clarify if/how/when a simple form is submitted when the <Enter>
key is pressed?
As I understood it, if you have a form with a single submit button, if enter
is pressed, the form should be submitted as if the button is pressed. Is
this correct?
Does this behaviour vary across browsers?
Chris
|
by: Matt |
last post by:
The problem is I have 3 buttons that need to submit the form to different
URL.
My approach is to declare <input type="submit"> rather than <input
type="button">.
And put the following in the JavaScript:
InputForm.action="URL LOCATION"
InputForm.method="POST";
I think we don't need InputForm.submit(); because <input type="submit">.
| |
by: Terence Parker |
last post by:
I have a form which enables users to type in some text in a <TEXTAREA>,
allowing them to use HTML. I have defined two submit buttons - one to
submit as usual, but one which I would like to popup another window and
submit the typed text to different action/script to give a preview.
So far I have done this (removing the excess formatting HTML...
|
by: Andy Kasotia |
last post by:
I have an ASP UI with VB Dll as a COM object that access the DB2
Database.
I have a "Calculate" button on the ASP Page which when clicked does form
validation (javascript) and submits the form (Javascript) to the same
ASP page. When the ASP page receives the form information it stores all
the form information in VB properties and then...
|
by: AndrewWithy |
last post by:
We have an aspx page that is submitting a form that redirects to a 3rd party
website to take a payment from the customer. We have had 19 instances over a
3 day period where the user never made it to the 3rd party site but were
redirected back to the page that was submitted. These 19 instances came from
only 3 users, with 2 users repeating...
|
by: sam |
last post by:
Hi All,
I have a form with 4 checkboxes and 4 text boxes and one submit button.
The form should work such a way when I select a particular checkbox and
give a url in text box, the form should get submitted to that url
entered in the text box. Is this possible. I know to submit form by
metioning the action attribute only. How do this with...
|
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...
|
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. ...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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
| |