473,499 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Which control changed?

I don't have a particular webpage to point you to; I thought about this
whilst walking my dog this morning and don't have an example page. That
said, this question doesn't really require a "working" example.

I have a form with two <SELECTcontrols. Both contain:
onChange="this.form.submit()"

So whichever one changes, my POST data contains both elements. How can I
know which one changed?

My idea is to include this in the form:
<INPUT TYPE=HIDDEN NAME=CONTROL VALUE="">

Then to change each onChange to something like this:
onChange="this.form.CONTROL.value='CONTROL_A';this .form.submit()"
where I'd use the name of the control in place of CONTROL_A of course.

So now I'll have an additional "CONTROL" value in my POST data telling
me which control changed.

Is this a workable solution? Is there a better way of doing things?

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Nov 15 '07 #1
2 1149
Steve Swift said the following on 11/15/2007 4:17 AM:
I don't have a particular webpage to point you to; I thought about this
whilst walking my dog this morning and don't have an example page. That
said, this question doesn't really require a "working" example.

I have a form with two <SELECTcontrols. Both contain:
onChange="this.form.submit()"

So whichever one changes, my POST data contains both elements. How can I
know which one changed?

My idea is to include this in the form:
<INPUT TYPE=HIDDEN NAME=CONTROL VALUE="">

Then to change each onChange to something like this:
onChange="this.form.CONTROL.value='CONTROL_A';this .form.submit()"
where I'd use the name of the control in place of CONTROL_A of course.

So now I'll have an additional "CONTROL" value in my POST data telling
me which control changed.

Is this a workable solution? Is there a better way of doing things?
A more reliable solution would be to put the default values of the
selects lists into the page you submit to. Then compare them to the
submitted values.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 15 '07 #2
Julien wrote:
...
The name of the changed select box will be passed to in the
QUERY_STRING environment variable that you can read server side, this
even if your form is submitted via "POST".
Thanks, I'll take a look at that mechanism. I'm not expert at reading
JavaScript, so I'll have fun working out how it operates; it doesn't
look too difficult for me.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Nov 15 '07 #3

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

Similar topics

9
7958
by: Lance Johnson | last post by:
I would like for when a tab page changes, that my controls on the previous tab page would receive a visiblechanged event or some other event so they are aware of that. We have db locks in some of...
1
3900
by: Pieter | last post by:
Hi, I have this Warning for several forms when using the DockPanel Suite of Weifen Luo in VS.NET 2005. I read a lot about this CLS-compliant stuff, but I don't now how to chech actually which...
6
6641
by: Tom Rowton | last post by:
This one has me a bit confused and I'm not finding what I need in the MSDN or by searching these forums, so here goes... I have a rather large, complex code-in-page WebForm (don't ask) and a...
2
2868
by: Tascien | last post by:
Guys, I am trying to run through the page controls, if the controls' id is found in the database, then I change the corresponding text from the database. but, the system is coming back with...
4
2581
by: louise raisbeck | last post by:
Hi I know there are many posts on this but cant seem to find simple answer. I have lots of text boxes in a datalist edittemplate control. i dont want to do an update statement for all of them, as...
0
1086
by: KB | last post by:
I have a custom control that inherits from the standard textbox. Whenever the control loses focus (and reaches the validation events) it immediately writes to the datasource even when the text has...
0
871
by: Sirus | last post by:
Something strange is happening when I user UserCosntrol, may be this is a bug. This is what I did. 1. Created a brand new Project. 2. Added a new User Control, and changed the class Inheritance...
13
8596
by: mirandacascade | last post by:
I want to set things up such that a section of code will have been executed by the time one clicks on the drop down arrow on a combo box control. Currently, that section of code resides in the...
5
1415
by: Kevin | last post by:
I want a calculated control to transfer its value to a bound field in a table. I.e. I have a calculated control named txtFinalBid that adds several fields in a table. I want that number to be...
0
7128
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,...
0
7006
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
7215
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...
0
5467
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,...
1
4917
isladogs
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...
0
3096
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...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
661
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
294
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.