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 2558
In article <b3************ *************@p osting.google.c om>, jr*********@yah oo.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*********@yah oo.com (JR) wrote in message news:<b3******* *************** ***@posting.goo gle.com>... 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(thi s.form,this.nam e,this.value)>
<input type=button value="OK"
onclick=Chk(thi s.form,"button" ,"button")>
</form>
.....
<form name=F2 action=Onecgi.c gi>
<input type=hidden name=Val1>
<input type=hidden name=Val2>
</form>
<form name=F3 action=Twocgi.c gi>
<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.Val 1.value=whateve r
document.F2.Val 2.value=whateve r
document.F2.sub mit()
}
else{ //radio button - fill F3 then submit it to
Twocgi
document.F3.Val 1.value=Nm
document.F3.Val 2.value=Val
document.F3.sub mit()
}
}
</script>
Maybe crude and very redundant but it's 7AM and my brain is not
working ...
HTH
Kien jr*********@yah oo.com (JR) wrote in message news:<b3******* *************** ***@posting.goo gle.com>... 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*********@nu rfuerspam.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*********@yah oo.com (JR) wrote in message news:<b3******* *************** ***@posting.goo gle.com>... 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********@new s2.newsguy.com> ,
"Matt Kruse" <ne********@mat tkruse.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? 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 button, without any event
handling, and it works fine.
However, in Case 2, which is what I am trying to do, it has the problem that
even when the user clicks the button, it won't show the value automatically.
But wait until user selects another...
|
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 are no instructions on how to
make checkboxes and radio buttons required. I've tried adding these to
my form, but I'm having no luck. Anyone know how to add radio buttons
and checkboxes using the existing code mentioned on the url?
Thank you!
|
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 combobox... I have 2 radiobuttons:
<input type="radio" name="terriprod" value="E">E
<input type="radio" name="terriprod" value="D">D
I have tried adding an OnClick event to each of the radio button...
|
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, not when its value is changed by the user.
How can I make the value on the submit button change immediately upon action
on the radio input and not when focus changes ?
Thanks...
|
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 type="text/javascript">
function setCheckedValue(radioObj, newValue) {
if(!radioObj)
| |
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 button with this
link of code:
echo 'SCRIPT language=JavaScript
setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //?
<snip of code>
|
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 button with this
link of code:
echo 'SCRIPT language=JavaScript
setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //?
<snip of code>
|
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) that need to be validated when the submit button is clicked. Instead of the standard alert window popping up (which I have now), I want the radio button background color to change from the table color (E2E2E2) to red (FF0000) for both buttons...
|
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 buttons and check box.
I am adding two radio buttons once for a row.Now my problem is the radio buttons in all the rows that added dynamically are behaving as same group i.e
when i am selecting a radio button in second row,radio button in first row...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |