473,545 Members | 1,884 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=1 234';

I added:

alert(form.acti on);

and verified that 'index.php?cl=1 234' 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 1478

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=1 234';

I added:

alert(form.acti on);

and verified that 'index.php?cl=1 234' 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
3761
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 page. When a user submits the form (ie. index.php), I would script it so that when the form action would be the same page but it would use the...
10
6592
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"> This works fine, the form details are collected by RegDetails.asp I am attempting to include javascript server side validation for the
5
8423
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' action='ins_op.php' method='post'>"; lots of form stuff
6
13366
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 depending on which domain someone has chosen. For instance, let's say we have three administrative sites, that all have different URLs, but we want...
2
1628
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 something fundamentally wrong because I can't find any help on this anywhere. Here's my HTML form... <form name="frmNewUser" onSubmit="return...
4
5315
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 that can be ignored). When I press the button the first time, the click handler hides the textbox. Pressing the button a second time unhides the...
13
69982
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 this? I've tried using: header("Location:http://www.mysite.com/send-confirm.php");
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
6922
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...
1
3304
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 (ContactGateway.cfc) - index.cfm - Deals with the business logic - display/form.cfm - Produces the form for both add and edit behaviour
0
7478
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...
0
7923
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7437
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...
0
7773
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 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...
0
5984
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...
0
3448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
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
1
1025
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.