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 2512
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
selected value. In Case 1, I just use submit...
|
by: sman |
last post by:
Hi, I recently read this article on About.com on how to create
required fields for a form:
http://javascript.about.com/library/scripts/blformvalidate.htm
Everything works great except that there...
|
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 ASP code in
order to change the list shown in 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 the gui only when the Radio
Input looses focus,...
|
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 am new to javascript.
<html>
<head>
<script...
|
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 this snip of code. I am trying to set the radio...
|
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 this snip of code. I am trying to set the radio...
|
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:
First, I have two radio buttons (both unchecked)...
|
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 table row which contains text boxes and radio...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |