Hi. I hope someone out there who is more versed with JavaScript than
I can help me with the following annoying problem. Here's the
problem.
I have a form with the following layout:
Column A Column B Column C
data 4 radio buttons more data
.... ... ...
.... ... ...
The form does have a submit button that leads to a given CGI script.
The form also has submit buttons as onClick events inside of the radio
buttons, that point to a different CGI script. The problem is that I
need to know which particular radio button triggered the onClick
event, because when I receive the form data, I only want to process
the row of data for which an event was triggered. As the script is
now, I just receive everything from the form, without knowing which
row to actually process. The one thing I thought about trying was to
call a function with the onClick event that would receive a given row
id (1 through up to 279), and the use document.write to create a
hidden value for just that id. I don't know if this is workable,
though. Am I on the right track with this idea? Is this doable, or
should I think about trying a different approach?
Thanks!!! 15 2408
In article <b3*************************@posting.google.com> , jr*********@yahoo.com (JR) wrote: Hi. I hope someone out there who is more versed with JavaScript than I can help me with the following annoying problem. Here's the problem.
I have a form with the following layout:
Column A Column B Column C data 4 radio buttons more data ... ... ... ... ... ...
The form does have a submit button that leads to a given CGI script. The form also has submit buttons as onClick events inside of the radio buttons, that point to a different CGI script. The problem is that I need to know which particular radio button triggered the onClick event, because when I receive the form data, I only want to process the row of data for which an event was triggered. As the script is now, I just receive everything from the form, without knowing which row to actually process. The one thing I thought about trying was to call a function with the onClick event that would receive a given row id (1 through up to 279), and the use document.write to create a hidden value for just that id. I don't know if this is workable, though. Am I on the right track with this idea? Is this doable, or should I think about trying a different approach?
Thanks!!!
Don't think you can do document.write after the page has rendered.
Here's what I'd do:
Put in a hidden input field. Create a function to handle the onClick
event. Pass the id of the radio button to the function. The function
then sets the value of the hidden field to whatever the id is.
Make sense?
Thanks for the reply. I'll give this idea a try. It sounds like a
workable solution. If it does work, I'll post the code in my next
reply-someone else out there may have the same problem.
Thanks again.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! jr*********@yahoo.com (JR) wrote in message news:<b3*************************@posting.google.c om>... Hi. I hope someone out there who is more versed with JavaScript than I can help me with the following annoying problem. Here's the problem.
I have a form with the following layout:
Column A Column B Column C data 4 radio buttons more data ... ... ... ... ... ...
The form does have a submit button that leads to a given CGI script. The form also has submit buttons as onClick events inside of the radio buttons, that point to a different CGI script. The problem is that I need to know which particular radio button triggered the onClick event, because when I receive the form data, I only want to process the row of data for which an event was triggered. As the script is now, I just receive everything from the form, without knowing which row to actually process. The one thing I thought about trying was to call a function with the onClick event that would receive a given row id (1 through up to 279), and the use document.write to create a hidden value for just that id. I don't know if this is workable, though. Am I on the right track with this idea? Is this doable, or should I think about trying a different approach?
Thanks!!!
From what I see, the only way is to have a loop, and check each
radio button for the "checked" property. If you give the radio buttons
the same name, they form an array, so you can use a for-loop.
JR wrote: The form does have a submit button that leads to a given CGI script. The form also has submit buttons as onClick events inside of the radio buttons, that point to a different CGI script.
What about users without support for client-side scripting?
The problem is that I need to know which particular radio button triggered the onClick event, because when I receive the form data, I only want to process the row of data for which an event was triggered.
Use several submit buttons with the different name and/or different values.
<input type="image"> may be useful as well, that displays a graphical
submit button, if supported (since HTML 4 IIRC). Then test against the name
or the value of the submit button server-side.
Or use several form elements with different "action" attribute values.
Anything else is considered harmful.
PointedEars
Hi,
I would collect the data input by user, stick them into another form
and submit that form according to the thing that was clicked.
<form name=F1>
<input type=radio name=Rad1
onclick=Chk(this.form,this.name,this.value)>
<input type=button value="OK"
onclick=Chk(this.form,"button","button")>
</form>
.....
<form name=F2 action=Onecgi.cgi>
<input type=hidden name=Val1>
<input type=hidden name=Val2>
</form>
<form name=F3 action=Twocgi.cgi>
<input type=hidden name=Val1>
<input type=hidden name=Val2>
</form>
<script>
function Chk(F,Nm,Val){
if(Nm=="button"{ // submit button - fill F2 then submit it
to Onecgi
document.F2.Val1.value=whatever
document.F2.Val2.value=whatever
document.F2.submit()
}
else{ //radio button - fill F3 then submit it to
Twocgi
document.F3.Val1.value=Nm
document.F3.Val2.value=Val
document.F3.submit()
}
}
</script>
Maybe crude and very redundant but it's 7AM and my brain is not
working ...
HTH
Kien jr*********@yahoo.com (JR) wrote in message news:<b3*************************@posting.google.c om>... Hi. I hope someone out there who is more versed with JavaScript than I can help me with the following annoying problem. Here's the problem.
I have a form with the following layout:
Column A Column B Column C data 4 radio buttons more data ... ... ... ... ... ...
The form does have a submit button that leads to a given CGI script. The form also has submit buttons as onClick events inside of the radio buttons, that point to a different CGI script. The problem is that I need to know which particular radio button triggered the onClick event, because when I receive the form data, I only want to process the row of data for which an event was triggered. As the script is now, I just receive everything from the form, without knowing which row to actually process. The one thing I thought about trying was to call a function with the onClick event that would receive a given row id (1 through up to 279), and the use document.write to create a hidden value for just that id. I don't know if this is workable, though. Am I on the right track with this idea? Is this doable, or should I think about trying a different approach?
Thanks!!!
In article <40**************@PointedEars.de>,
Thomas 'PointedEars' Lahn <Po*********@nurfuerspam.de> wrote: JR wrote:
The form does have a submit button that leads to a given CGI script. The form also has submit buttons as onClick events inside of the radio buttons, that point to a different CGI script.
What about users without support for client-side scripting?
You can please all the people some of the time, and some of the people
all the time, but you can't please all the people all the time.
Steven Daedelus wrote: You can please all the people some of the time, and some of the people all the time, but you can't please all the people all the time.
Careful... uttering that truism around here can get you blacklisted ;)
--
Matt Kruse
Javascript Toolbox: http://www.mattkruse.com/javascript/ jr*********@yahoo.com (JR) wrote in message news:<b3*************************@posting.google.c om>... Hi. I hope someone out there who is more versed with JavaScript than I can help me with the following annoying problem. Here's the problem.
I have a form with the following layout:
Column A Column B Column C data 4 radio buttons more data ... ... ... ... ... ...
The form does have a submit button that leads to a given CGI script. The form also has submit buttons as onClick events inside of the radio buttons, that point to a different CGI script. The problem is that I need to know which particular radio button triggered the onClick event, because when I receive the form data, I only want to process the row of data for which an event was triggered. As the script is now, I just receive everything from the form, without knowing which row to actually process. The one thing I thought about trying was to call a function with the onClick event that would receive a given row id (1 through up to 279), and the use document.write to create a hidden value for just that id. I don't know if this is workable, though. Am I on the right track with this idea? Is this doable, or should I think about trying a different approach?
Thanks!!!
Just capture whatever data you need inside hidden fields (be it
data, or id's, or names of controls, whatever), before you submit the
form.
In article <c9********@news2.newsguy.com>,
"Matt Kruse" <ne********@mattkruse.com> wrote: Steven Daedelus wrote: You can please all the people some of the time, and some of the people all the time, but you can't please all the people all the time.
Careful... uttering that truism around here can get you blacklisted ;)
I know it. It's just that sometimes I can't resist pointing out the
obvious...
Do you ever get the feeling that a lot of the most severe compliance
fascists don't have clients?
Steven Daedelus wrote: In article <40**************@PointedEars.de>, Thomas 'PointedEars' Lahn <Po*********@nurfuerspam.de> wrote:
Please do not write attribution novels, see e.g.
<http://www.holgermetzger.de/netscape/usenet.html>
<http://netmeister.org/news/learn2quote.html> JR wrote: > The form does have a submit button that leads to a given CGI script. > The form also has submit buttons as onClick events inside of the radio > buttons, that point to a different CGI script.
What about users without support for client-side scripting?
You can please all the people some of the time, and some of the people all the time, but you can't please all the people all the time.
But you can do easily here.
PointedEars
Steven Daedelus wrote: Do you ever get the feeling that a lot of the most severe compliance
^^^^^^^^^^ fascists don't have clients?
^^^^^^^^
Godwin's Law. You lose.
PointedEars, F'up2 where it belongs ca*********@hotmail.com (Kien) wrote in message news:<16**************************@posting.google. com>... </script>
Maybe crude and very redundant but it's 7AM and my brain is not working ...
HTH
Kien
If it's crude and redundant, but works, I'm all for it! Thanks very
much for the solution. I found that the best solution for my
particular problem was right along the lines of your script. I call a
given function when the user selects a certain radio button, and pass
to this function data for only the row I want to process. I then
append this data string to my script path, i.e.
path/program.cgi?javascript_params, and then submit the form. This
way, I do get all of the data from the form when it is submitted, but
I know which row of data to process in the receiving script.
Thanks to everyone for the suggestions.
JR
JRS: In article <40************@PointedEars.de>, seen in
news:comp.lang.javascript, Thomas 'PointedEars' Lahn
<Po*********@nurfuerspam.de> posted at Wed, 2 Jun 2004 01:54:48 : Steven Daedelus wrote:
In article <40**************@PointedEars.de>, Thomas 'PointedEars' Lahn <Po*********@nurfuerspam.de> wrote:
Please do not write attribution novels, see e.g. <http://www.holgermetzger.de/netscape/usenet.html> <http://netmeister.org/news/learn2quote.html>
Son-of-RFC1036 (1994) refers to "attribution lines" containing more
than just a name. Note the implication that more than one physical line
may be
needed.
A draft RFC by C H Lindsey (a well-known News expert), dated August
2002, envisages a line containing name, E-address, newsgroup, Message-
ID, date, and time; and that it may be folded. It is called draft-ietf-
usefor-article-08.txt
Therefore, your customary tedious insistence on minimal attributions is
contrary to respected recent thinking.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
JR wrote: Hi. I hope someone out there who is more versed with JavaScript than I can help me with the following annoying problem. Here's the problem.
I have a form with the following layout:
Column A Column B Column C data 4 radio buttons more data ... ... ... ... ... ...
The form does have a submit button that leads to a given CGI script. The form also has submit buttons as onClick events inside of the radio buttons, that point to a different CGI script. The problem is that I need to know which particular radio button triggered the onClick event, because when I receive the form data, I only want to process the row of data for which an event was triggered. As the script is now, I just receive everything from the form, without knowing which row to actually process. The one thing I thought about trying was to call a function with the onClick event that would receive a given row id (1 through up to 279), and the use document.write to create a hidden value for just that id. I don't know if this is workable, though. Am I on the right track with this idea? Is this doable, or should I think about trying a different approach?
Thanks!!!
Since this conversation seems to have drifted from the point, I'll do my
part to direct it back.
Message author bruce seemed to have the answer to the original question
which allows JR to keep his form as it is. I intend to include code
(not tested, just making it up as I type) to support bruce's idea.
<head>....
<script>
function testButtons(buttonArray)
{
len = buttonArray.length
for(i=0;i<len;i++)
{
if(buttonArray[i].checked)
{
widelyVisibleVariable = i;
return true;
{
}
}
</script>
......</head>
<body>
....
<form name=someName action=someServer onSubmit=testButtons(buttonGroupName)>
....
</form>
</body>
On 30/03/2005 17:55, Jeff Sandler wrote:
[snip] Since this conversation seems to have drifted from the point, I'll do my part to direct it back.
This that conversation is almost a year old, was it really necessary
to resurrect it?
[snip]
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matt |
last post by:
I have radio buttons on a form, and when the user makes the selection, it
will trigger the event and send the form to the web server and print the...
|
by: sman |
last post by:
Hi, I recently read this article on About.com on how to create
required fields for a form:...
|
by: HD |
last post by:
Hi.
I have an asp page with radio buttons and a combobox... when the user clicks
a radio button, I want the form to submit so I can execute the...
|
by: MarsVoyager |
last post by:
Hi,
I want to change the value of a submit button when the onChange event is
fired by a Radio Input.
Problem is, it seems the value is modified in...
|
by: IchBin |
last post by:
I can not see what the problem is with this script. I am just trying to
set a radio button by calling setCheckedValue('abbr_letter', 'V'). Sorry
I...
|
by: IchBin |
last post by:
I am trying to set the state of a radio button. I do not see what I am
doing wrong. Sorry, I am new at this.. I need another set of eyes to
look at...
|
by: IchBin |
last post by:
I am trying to set the state of a radio button. I do not see what I am
doing wrong. Sorry, I am new at this.. I need another set of eyes to
look at...
|
by: photoboy |
last post by:
I have racked by brain long enough on this, so now I need the help of someone who knows what they are doing. Here is what I am trying to achieve:
...
|
by: moksha |
last post by:
Hi,
I am new to javascript and i am facing a problem in coding.
plz help me out.
I am using javascript for dynamically creating a...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...
| |