Hide Field In Row Using Radio Button

Oct 1, 2009

I have a radio button
called donate
options are : sale , donate
(values for radio buttion
Option sale : 0
Option donate :1

When click on sale a row having field "cost" to be hidden. I had tried a script with hide and show when clicked on button which works fine (toggles hide an show). I am trying following code:
-which toggles the hide/show effect but I want
-when click on donate it should hide row having cost
-when click on sale it should display row having cost

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<html xmlns="[URL]"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Javascript hide table row</title>
</head><body><script type="text/javascript">
function displayRow(){
var donate= document.getElementById("donate");
alert(donate.value)
var row = document.getElementById("captionRow");
var row = document.getElementById("captionRow");
if (donate==0) {
row.style.display = '';
} if (donate==1) {
row.style.display = 'none';
}}
</script>

<table width="300" border="1">
<tr id="captionRow"><th>TH-1</th><th>TH-2</th><th>TH-3</th></tr>
<tr><td>cell-11</td><td>cell-12</td><td>cell-13</td></tr>
<tr><td>cell-21</td><td>cell-22</td><td>cell-23</td></tr>
<tr><td colspan="3"> <label>
<input name="donate" type="radio" value="0" onclick="displayRow()" />
Sale
<input name="donate" type="radio" value="1" onclick="displayRow()"/>
Donate</label></td></tr>
</table><p></p></body></html>

View 1 Replies


ADVERTISEMENT

Hide/Show Text Field On Radio Select

Aug 10, 2006

I'm a *real* JS noob and need to show or hide a text field when a radio is selected. This is what I've tried so far. Code:

View 3 Replies View Related

Show And Hide Radio Button?

Sep 17, 2010

I have to 2 radio buttons and two hidden divs. How would I be able to show and hide them depending on the selection I've chosen?

View 4 Replies View Related

JQuery :: Possible To Hide The 'value' Attribute Of A Radio Button?

Sep 2, 2011

My form has some input like this:<input type="radio" value="email@addr.es" id="edit-submitted-1">I want to hide the attribute value, not eliminate, or change... Is this ossible?I can get the value of this attribute using

: find('#
edit-submitted-1').attr('value');
and modify using:

[code]....

View 5 Replies View Related

Very Basic Show/hide Div With Radio Button?

Apr 2, 2009

i have made this request as simple as possible.When my page loads I would like div1 and div2 to both be hidden

If user clicks Div 1 radio then
div1 = visible
div2 = hidden

[code].....

View 3 Replies View Related

Validating A Radio Button That Has A Field Name With A ^ In It

May 2, 2005

The application I'm helping develop is about 10 pages long and allows users to move back and forth, updating previous selections. Certain pages use Javascript to check current selections and show/hide divs based on those selections. Most of these fields are radio buttons and use simple onClick calls. However, one of these requires that 2 fields be checked for a specific value and if they are both true, display a div.

One problem though... for other reasons these form field names all begin with either a "r^" or a "t^" signifying it as either a text field or radio button. I can get the check to work fine without the "r^" but with it I'm lost. The carrot seems to be causing problems for me and I've tried many different combinations of things to get it to work. Code:

View 2 Replies View Related

Using Value Of Text Field For Radio Button

Aug 19, 2010

I have a checked radio button in one such radio group in my form. Beside this radio button, I have a text field. I want the value that the user inputs into the text field, to be the value of the checked radio button. how to write this code.

View 6 Replies View Related

JQuery :: Show/hide On Radio Button Click

Aug 4, 2009

I'm trying to do a show/hide on a radio button click and I do have it working, but I'd like to make it more...extensible/independent of hard- coding children elements to show hide.

My dummy html structure is:

I left some commented out stuff at the top of the function, hopefully to give you an idea of what I tried.

In particular:

I was trying to get the first ul (the children to show/hide) on "this" (the radio button clicked). I'd like this to be flexible to where you could add more radio button/children and as long as the structure stays the same, the show/hide functionality works.

View 2 Replies View Related

Display/Hide DIV Based On Radio Button Input?

Dec 1, 2009

I'm fairly new to Javascript and would be grateful for any help you can give me. I've had a search on Google and found a couple of potential solutions but nothing seems to work quite right for what I need.

Basically I have a form with several questions followed by Yes/No radio buttons. Dependent on which answer is given, I want to display a different message above the text box.

For example, if you answered 'no' to a certain question then the message above the text box would change to say "Please fill in additional information" or something along those lines.

[Code]...

View 3 Replies View Related

Show/hide Div Based On Radio Button Select

Jul 12, 2007

i would like to have 2 radio buttons each with a associated div when the page loads the first radio button will be checked and its corresponding div will be show when the user checks the other radio button its corresponding div is shown and the first div is hidden:

View 2 Replies View Related

Radio Button Activate Field (Not Greyed Out)

Sep 26, 2011

Go here: [URL] How to accomplish this and send this data to a mysql column! The field will not grey out in i.e.

View 3 Replies View Related

How To Use Radio Button To Activate Selective Field

Oct 20, 2009

How can I use radio-button to activate the selective field on a form using perl/cgi?

View 1 Replies View Related

Populate Text Field With Radio Button Value

Jan 3, 2010

If the user selects the early bird special for member (at 100.00) it populates the text field with the value for that row. Or, if the user selects regular registration for non-member it sets the early bird text field back to 0.00 and populates the text field with he value for the regular expression code. At the same time it populates the total field with the total price. I hope this makes sense. How can I accomplish this using JavaScript or jQuery? The text fields are read only. The table is listed below.

Table code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<html xmlns="[URL]">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head> .....

View 4 Replies View Related

Show New Field When Radio Button Is Selected

May 26, 2006

I have a pair of radio buttons (yes and no) as answers to a question. When the yes radio button is selected, I need a text field to be displayed underneath it. Does anyone know how to do this?

View 2 Replies View Related

JQuery :: Hide/Show Based On Radio Button Selected?

Sep 14, 2009

I am trying to create a script that will display content based on if aradio button is selected, and if the other is selected would hide thecontent. Now, each of these radio buttons are part of a radio group,so their names are the same. Most examples show nput:radio[@name=item] Since I have 2 items that have the same name, I can't usename, so I thought I would try id or value. It isn't working. If I addonly the show, whenever you select either radio button, it shows, andif I add the hide code, it doesn't work at allHere is what I have right now.

$(document).ready(function(){
$('#offices_checkboxes').hide();
$("input:radio[@value=1]").click(function() {

[code]....

View 2 Replies View Related

JQuery :: Show / Hide A <div> When Changing The Selection Of A Radio Button?

Mar 2, 2010

I want that a <div> element will show when yes is selected and when no it should be hidden. For show and hind i will use the functions from the jQuery UI. But I don't find a way to call the hide / show function when the selection change.

The radio selection: <input type="radio" name="lang_anz" value="1"> Yes<br> <input type="radio" name="lang_anz" value="0" checked="checked"> No<br> When I understand the documentation I can request the current value from the radio with: <script type="javascript"> $('input:radio[name=lang_anz]:checked').val(); </script>But how i can now call the show / hide function when I change the selection?

View 1 Replies View Related

Multiple Radio Button Field Form Validation

Oct 28, 2011

I'm only validating one (Consent) radio button with this code but I need to validate multiple different questions/buttons.

<script>
function getRBtnName(GrpName) {
var sel = document.getElementsByName(GrpName);
var fnd = -1;
var str = '';
for (var i=0; i<sel.length; i++) {
if (sel[i].checked == true) { str = sel[i].value; fnd = i; }
} return fnd;
}

function checkForm() {
var chosen = getRBtnName('Consent');
if (chosen < 0) {
alert( "Please choose one answer when you are asked to select a number." );
return false;
} else { return true; }
}

</script>
<form action="congratulations_aff.php" method="post" name="congratulations_aff" onSubmit="return checkForm()">
<table border="0" cellspacing="1" cellpadding="0">
<tr>
<td colspan="3">I consent to providing my electronic signature.</p></td>
</tr>
<tr>
<td colspan="3" valign="top">
<input type="radio" name="Consent" value="Y" />
Yes
<input type="radio" name="Consent" value="N" />
No

<table border="0" cellspacing="1" cellpadding="0">
<tr>
<td>I consent to electronic receipt of my information reporting documentation.</td>
</tr> <tr>
<td valign="top">
<input type="radio" name="Consent1099YesNo" value="Y" />
Yes
<input type="radio" name="Consent1099YesNo" value="N" />
No</td>
</tr>
<tr>
<td valign="top">

For tax purposes are you a U.S. citizen, U.S. resident, U.S. partnership, or U.S. corporation?
<input type="radio" name="USPersonYesNo" value="Y" /> Yes
<input type="radio" name="USPersonYesNo" value="N" /> No
</tr> </table>
<input type="submit" value="submit" value="Submit" />
</form>

View 7 Replies View Related

Radio Button With Text Field (Disable / Enable)

May 10, 2009

I have javasctipt,radio buttons, and textfield in default my textfield is disabled, and when any of radio buttons was click it is disabled also, but when the radio button of the textfield is click it will enable, it works fine and submit the correct data. When I went back to that page the radio button of the text field was checked (ok its fine because it has value) but it didnt show the value of the text field, and it is disabled. I want to repost the input...

Here's my code
index:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<html xmlns="[URL]">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body> .....

View 2 Replies View Related

Validating A Form Field If Radio Button Is Checked

Dec 2, 2004

I have a form that makes visible a text field when a specific radio button is checked. That works. Then I validate to see if a radio button is checked before I let the form be submitted. That works.

BUT - I cannot seem to get it to validate the form field that is made visible to see if it has content or at least the proper content when the form is submitted. Can you tell me what I am doing wrong please?

I can give more info on what kind of validation I want done if needed, but I think my code speaks for itself Code:

View 4 Replies View Related

Jquery :: Radio Button Auto-Fill Another Field

Jul 27, 2011

I'm pretty new to coding. I have a form with two radio buttons to choose from. I would like a custom javascript function (fillShowTypeCost) to automatically update a text field with the correct amount of money, based on which radio button is selected. I originally had this form done with checkboxes and it worked just fine. Since I switched to radios, I am completely lost. I have tried using an array search to determine which value is selected, but I must be doing something wrong, because it isn't working. My codes are below. (The PHP end of things are working great.)

My PHP/HTML Code:
//Radio Button 1:
<input name="showtype" type="radio" id="showtype" value="basic" <?PHP print $basic_status; ?> onclick="fillShowTypeCost(this.form)"> Basic Slideshow

//Radio Button 2:
<input name="showtype" type="radio" id="showtype" value="lovestory" <?PHP print $lovestory_status; ?> onclick="fillShowTypeCost(this.form)"> Love Story

//Text field to be auto-updated
<input name="showtype_cost" type="text" id="showtype_cost" value="<? echo $row_settings['showtype_cost']; ?>">

View 5 Replies View Related

Show / Hide Form Fields Depending On Radio Button Selection

May 29, 2005

How to show and hide form fields depending on a selected radio button.

View 14 Replies View Related

JQuery :: Pass Radio Button Value To Hidden Text Field

Mar 10, 2011

I found the following code to get the value of a radio button (radio1 is the name of both the yes and no radio buttons):

How do I pass this value to a hidden text field?

View 2 Replies View Related

Script To Highlight Text Field With Radio Button Click?

Jul 12, 2009

I am doing donation script. Here is my script so far

<script type="text/javascript">
<!--//
function chkDonation(){
var form = document.forms[0]; // FORM NAME OR PLACE IN FORMS COLLECTION //;
var amount = form['OtherAmount']; // TARGETTED INPUT NAME ( OtherAmount ) //;
amount.style.visibility = 'hidden';
for(var i=0, input=form.getElementsByTagName('input'); i<input.length; i++){
if(input[i].type.match(/radio/i) && input[i].name.match(/DonationAmount/i)){
if(input[i].value.match(/Other/i)){
input[i].onclick = function(){
amount.style.visibility = 'visible'; .....

I have pretty much completed my script but now what I want it to do is to add more forms/field when the "Other" radio button is selected. So when the Other button is checked, I want the script to display more fields/forms below. Only when the "other" button is selected. When "other" selected the script should display fields like "cheque", "cash", "Payment" etc.

View 1 Replies View Related

Show Price In Field When Radio Button Or Checkbox Selected

Jun 19, 2009

I am working on a registration form for a conference. The form has several sections of radio buttons and checkboxes and I would like to have it set up so that if a radio button or checkbox is selected the price related to that selection shows up in the rigjt column of the form and can then be totaled up at the bottom of the page.
1. Show price in field.
2. Total up all of the prices at the bottom of the page.
You can view the registration form at: [URL]

View 9 Replies View Related

JQuery :: Show/hide Form Elements Based On Radio Button Selections ?

Mar 17, 2011

I have a set of radio buttons on my pricing page:

And a corresponding text_field input element div I'd like to display based on which radio button the user selects:

When the page loads, I'd like to see:

When the user clicks on a (different) radio button, or clicks one for the first time, I'd like whichever div is currently showing to be hidden, and the newly selected one to be shown.

Right now I have jQuery code at the bottom of my page that looks like this:

For each of the four options.

When the page loads, the correct div is shown, and when I select a new button, the new div is shown, but the already showing one isn't hidden.

I've read some posts that suggest using change() instead of click(), but others indicate that's problematic in IE.

View 1 Replies View Related

Show / Hide Div Layer / Change Link Color / When Radio Button Is Selected

Aug 16, 2010

I am trying to develop an exam system.Find my code below.I request you to copy the code and save it as an html file .I have 2 problems:

1. Kindly notice that when the quiz is loaded,it shows both the questions by default.I want only question 1 to be visible when the quiz loads.What happens presently is that ,both questions are visible even after I click on the link
Q.1( referring to question 1).However,when I click on
Q. 2,then only question 2 can be seen and then(after clicking on Q.2) if I click on Q.1,then only question 1 can be seen

What I want is that when the page loads only question 1 is visible.Then when I click on Q.2,I can see only question 2 and when I click on Q.1, I can see only question 1.I later plan on adding many questions,so it should be a general solution rather than a solution good only for 2 questions.

2.Also,what I want is that,if someone selects any of the answers of a particular question,it's link color should turn green to indicate to the user that he answered that question.So for,instance,if I select an answer to the first question(select one of London,New York,Seattle,Washington,Chicago), the link Q.1 should turn green.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved