Hi,
I made a function whereby clicking a radio button will show a hidden radio button sub-group, and when it's unchecked, the radio button sub-group hides again and all the radios in the sub-group are made unchecked.
The problem is I don't know how to pass the 3rd parameter, 'custom' in this example, into the function. HTML: -
<input type="radio" name="product" value="standard"
-
onclick="showSubGroup(this,'customOptions','custom');" />
-
<input type="radio" name="product" value="custom"
-
onclick="showSubGroup(this,'customOptions','custom');" />
-
<div id="customOptions" style="display:none">
-
<input type="radio" name="custom" value="1" />
-
<input type="radio" name="custom" value="2" />
-
<input type="radio" name="custom" value="3" />
-
</div>
-
javascript: -
function showSubGroup(selection,showHideItem,btnGroup) {
-
var parentForm = selection.form;
-
if (selection.value == "custom") {
-
document.getElementById(showHideItem).style.display = "block";
-
} else {
-
for (i=0; i < parentForm.btnGroup.length; i++) {
-
parentForm.btnGroup[i].checked = false;
-
}
-
document.getElementById(showHideItem).style.display = "none";
-
}
-
}
-
If I hardcode the name of the input, it works. For example:
(i=0; i < parentForm. custom.length; i++)
parentForm. custom[i].checked = false
How can I pass the element name so it's variable inside the function?
Thanks in advance.
4 4434 Dormilich 8,658
Recognized Expert Moderator Expert
Dormilich, I tried that, but it doesn't work.
Dormilich 8,658
Recognized Expert Moderator Expert
then something’s wrong with your implementation.
EDIT: correction, parentForm = selection.form is wrong
Dormilich, you're right! That works!! I must've clicked too fast before the javascript finished loading. I checked it in FF and IE, and it works perfectly.
I left this code as is: parentForm = selection.form;
You da man, Dorm!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Stephen Williams |
last post by:
Hey i've got bunch of arrays of tick boxes, each array contains somewhere
between 5 and 20.
What I want to do is write a function that returns the captions of every
ticked tick box in an array as a string.
I want to be able to pass to the function the array name, and the lower and
upper limits of the array. But I have no idea how to pass the control name
(array name).
|
by: Sen |
last post by:
This is the Javascript function:
function auto_submit(form_name, value) {
document.form_name.elements.click();
}
This is the XHTML:
<select name="category" onchange="auto_submit(this.form.name,'Select')">
So, when choosing an option from the select list, the Select button is
clicked and the form is submitted. Somehow the function only works when
|
by: dstefani |
last post by:
Hello,
I'm trying to pass a var to a function for it to be used as the name of
a form element.
IE:
function doThis(form, elemName) {
if( form.elemName.value == false ) {
|
by: Maarten Verhage |
last post by:
Hi All,
I've made a modified version of the Expat elements.c example. What I
want the program to do is to recognize a hardcoded
element-name/tag-name and then execute some code which has access to
the data(e.g. "Maarten Verhage" in XML file).
The current situation (problem) is:
1. The XML parser calls the function startElement when it finds a tag,
|
by: wilson |
last post by:
Dear all,
In this time, I want to pass array to function.
What should I declare the parameter in the function?i
int array or int array? Which one is correct?
/********************************************************
Below is my code:
********************************************************/
| |
by: Bob Lehmann |
last post by:
I have a web form (Form1) that I would like to pass to a function, iterate
through it, and retrieve the values of the input elements.
I am able to retrieve the element IDs (function below), but keep hitting a
wall trying to get the values.
Public Function send(ByVal TheForm As System.Web.UI.HtmlControls.HtmlForm)
Dim c As Control
For Each c In TheForm.Controls
|
by: jparulan |
last post by:
Hi All,
I'm using SOAP3.0. I was able to successfully call a WSDL file and get
a value properly. But when the WSDL changed to have a MULTIPLE
<element name> it was failing.
This code works BEFORE: strCurrency =
oSOAP.eServeSearch(CSTR(Request.Form("T1")))
until the WSDL file changed to have more <element name>
T1 is just a field that accepts a STRING
|
by: DMUM via AccessMonster.com |
last post by:
Hello
I am trying to pass the name of my subform to a function/sub but I can't
seem to get it to work. I am using an autokey function (ctrl E) to unlock
text boxes on a subform. I have a few forms in the database that will use
this function, so I need to be able to tell the code which form to unlock.
What I have is as follows:
Public Function akeyEdit()
|
by: adurth |
last post by:
Hi!
Is there any function that converts a string containing characters
that are invalid for use in an element name to a valid one?
Thanks,
Andreas
|
by: conspireagainst |
last post by:
Is there any possible way (I'm using prototype framework) to glean what the name of the container element to be updated (using Ajax.Updater) is?
I have appended at the bottom of prototype.js a function that shows a loading dialog when any AJAX interaction takes place, but I need to cancel it for one particular element and cannot figure out a way without knowing the element name.
Here's the code:
Ajax.Responders.register({
...
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |