473,503 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

form.action

In my <form> tag, I leave off the action='...' specification because I
supply this later inside an onclick event handler, depending on which
button was pushed.

Inside the handler, I have...

form.action = 'index.php?cl=1234';

I added:

alert(form.action);

and verified that 'index.php?cl=1234' appears in the window, but the
page that appeared showed a URL of 'index.php?' without the 'cl=1234'
part. Why can't I give query-string parameters in the form.action
property? How can I pass either GET or POST variables to my target page
when those variable are created in the Javascript function?

Mark
Apr 3 '06 #1
2 1477

Rainman wrote:
In my <form> tag, I leave off the action='...' specification because I
supply this later inside an onclick event handler, depending on which
button was pushed.

Inside the handler, I have...

form.action = 'index.php?cl=1234';

I added:

alert(form.action);

and verified that 'index.php?cl=1234' appears in the window, but the
page that appeared showed a URL of 'index.php?' without the 'cl=1234'
part. Why can't I give query-string parameters in the form.action
property? How can I pass either GET or POST variables to my target page
when those variable are created in the Javascript function?

Mark


Hi Mark

If you know what GET/POST vars may be used in advance you can add some
<input type="hidden" name=""> fields to the html and set their values
later.

If you dont know in advance you could add input elements as needed
using dom methods.

Afraid I don't know why it doesn't work as it is

Tim

Apr 3 '06 #2
Rainman wrote:
In my <form> tag, I leave off the action='...' specification because I
supply this later inside an onclick event handler, depending on which
button was pushed.


Bad idea. The `action' attribute is required. And what about users
without client-side script support?

Use two (or more) submit buttons with different names and/or values,
then evaluate the submit button name/value on the receiving side.
No client-side script is needed on the sending side.
PointedEars
Apr 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3760
by: bissatch | last post by:
Hi, I have been trying to come up with an idea to reduce double submissions where a user clicks refresh and, for example, another row is INSERT into a table. Originally, I would have a form...
10
6591
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> ...
5
8396
by: rjames.clarke | last post by:
I have the following. $result=mysql_query($sql); $nrows=mysql_num_rows($result); for ($i=0;$i<$nrows;$i++) { $row_array=mysql_fetch_row($result); echo "<form name='testform'...
6
13361
by: tencip | last post by:
Hi everyone, So, i've got a form that is very simple. It hold three elements: username, password, and domain. The goal here is to have the form submit the login to an administrative section...
2
1624
by: Myk Quayce | last post by:
I have a small .aspx page that uses old style forms with client-side JavaScript validation. Everything works fine until I try to upate the database with some new information. I must be doing...
4
5310
by: Lee Chapman | last post by:
Hi, Can anyone tell me why in the code below, the call to ClearChildViewState() has no effect? To paraphrase the code: I'm using view state. I have a textbox and a submit button (and a label...
13
69978
by: deko | last post by:
I have a basic feedback form with a submit button. After the "send" button is clicked, I want the user to be redirected to a different page that says "Your message has been sent." How do I do...
6
19134
by: Arthur | last post by:
Hello. How might it be possible to change where a form action is directed based on a selected option. For example I have this: <FORM METHOD = "post" ACTION = ""> And a drop down such as
12
6919
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...
1
3301
by: chromis | last post by:
Hi, I'm having trouble fully implementing the edit section of a contact admin system, so far I have written the following: - Bean (Contact.cfc) - Data Access object (ContactDAO.cfc) - Gateway...
0
7093
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
7353
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...
1
7011
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...
0
7468
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...
0
5596
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,...
0
4689
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...
0
1521
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 ...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.