Clearing Value When Checkbox Is Unchecked?

Mar 24, 2010

I have a working script here regarding generating a <div> that contains a <input> text. My concern is whenever the checkbox is unchecked, the <input> type hides but the value is still there (the one inputted)

Here is my code for reference:

HTML Code:
<script type="text/javascript">
function showCheckBoxDiv (DivName, box) {
vis = (box.checked) ? "block" : "none";

[Code]....

Say for example, I click the checkbox, the field appears, I inputted something on the field, but I unchecked the checkbox, when I click again the checkbox the value I input is still in the field. Is there any way, it can be cleared as soon as the checkbox is unchecked?

View 2 Replies


ADVERTISEMENT

Delete Rows With Unchecked Checkbox?

Oct 27, 2010

I have a table with about 20rows, which contain a checkbox and a bit of text each. What I'm trying to find a way to do is to have delete button at the bottom of the page.When i clicked on DELETE button, it should delete records of checked checkbox rows. I need to delete all the table rows which contain CHECKED textboxes.and remaining checkboxes should be displayed. And we should keep remaining checkboxes in ARRAYLIST.

I need to do this in JavaScript (which is what I'm having trouble with) / if in rear case JSP is accepted- I've been able to get bits of it to work at various times, but I'm running out of time.

View 7 Replies View Related

Checkbox Problem - Checkboxes Submitting That Are Unchecked

Jul 23, 2005

I am having a problem in my struts application with the checkboxes in
my form. I have an array of checkboxes, some of which may be already
selected when the form loads. My problem is when the user then
deselects one or more of these checkboxes and submits the form -
they're being submitted as if they were still checked, when the user
has infact deselected them.

I've heard that this is a common problem, but I don't seem to be able
to find the problem / resolution with any search criteria. If anybody
knows the fix for this it would be greatly appreciated (if there is a
solution without using Javascript I would prefer this as we're trying
to write the application so it's not too dependant on Javascript . . .

View 4 Replies View Related

Show Hide Textbox When Checkbox Is Checked And Unchecked?

May 20, 2009

"show hide textbox when checkbox is checked and unchecked" without using 'window.onload' function

below is the code with window.onload function. if i use this, got some problem. using window.onload function i got this code through coding forums. after that i did some changes according to my requirement.

<html>
<head>
<style type="text/css">
tr {
height: 0.75em;

[Code]....

View 1 Replies View Related

If The Checkbox Was Unchecked - Text Would Be Removed And The Field Writable

Mar 4, 2010

I wrote a small piece of javascript a while ago to add some text to a text box and mark it as read only if a check box was checked. If the checkbox was unchecked, the text would be removed and the field writable.

It was working great until I accadently deleted the file and had to start over from an old backup that didn't have the new functionality.. Now I have it so if you check the box, it puts the correct text, and marks the field read only, hoverer now I can't uncheck the checkbox.

Here is what I have this far:

HTML:

View 2 Replies View Related

Enable/disable A Textbox On That Row If Checkbox Is Checked/unchecked?

Dec 23, 2010

I have a gridview with a checkbox (CheckBoxActiveClient) in the first column and a textbox (Copies) in the 5th column. I want that row's textbox (Copies ) to be disabled if the checkbox is unchecked in that row.
I wrote a javascript function for this but it doesn't work.

Code:
<script type="text/javascript">
function EnableTextBox()

[code]....

View 8 Replies View Related

JQuery :: Clicking Checkbox Doesn't Change Its Checked/unchecked Status?

Apr 2, 2010

I have a set of checkboxes that trigger events on a page. Clicking a checkbox triggers the event correctly and the checked attribute changes in the page source, but in the rendered browser view the checkbox status remains changed. If I load the page with the checkboxes checked, they always remain checked in the browser view. If I load the page with checkboxes unchecked, they always remain unchecked in the browser view.

If I remove the jquery code the checkboxes work as expected, but obviously don't trigger any events. I've tested this in both Safari and Firefox with the same results.

[Code]...

On another note, I'm having problems with the back button when using the forum. If I am looking through a multi-page search and click on a topic and then click the back button, I go to the first page of the search instead of the last page I was looking at. Similarly, when I first previewed this post and clicked "back" I was returned to the topic list instead of the compose-post page.

View 2 Replies View Related

Pass Checkbox Status To Jave Method As Parameter - Checked Is True And Unchecked Is False

Feb 23, 2009

I've one checkbox,I need to capture the status of this checkbox(i.e checked is "true" and unchecked is "false") to the java method as parameter.

I've check box like this

code:

Javascript to get the status of check box like this..

I need to pass the return value of the javascript to the java method in command link action like thiss.

View 1 Replies View Related

Clearing Two Popups And Text Fields On Checkbox Selection Not Working In Ie7

Mar 6, 2009

why isn't this working ok in ie7?:

[URL]

the javascript is:

Code:
<script type="text/javascript">
/* <![CDATA[ */
function closed_changed(day) {

[Code].....

it should call closed_changed(), which sees if it's ticked/checked, if it is it calls clear_open() and sets the four open related input elements to empty/blank (because a shop can't be open and closed at the same time). works fine in firefox (pc and mac) and safari. not ie7. why not? (the intended clear does happen but only when another subsequent closed box is ticked; it works on the previous day which was ticked; so it's lagging one behind)

View 2 Replies View Related

Parent Child Checkbox - Only Same Name Of Child And Parents Should Be Unchecked

Oct 28, 2010

I have created parent child checkboxes. When one child is selected, then parent of that child, other child of same name and parent of that same name's child will be selected... Now I want if I unchecked any child, then only same name of child and parents should be unchecked or if I unchecked Parent Child, then same name of parent and child will be unchecked.

[Code]...

View 1 Replies View Related

Remove The Div Contents If It's Unchecked

Aug 6, 2009

I have a check box right now that calls an onClick event. Here is the Input:

<input name="usePad" type="checkbox" value="usePad" id="usePad" onclick="showBind('padShow','padOk')" />
Here is the Script:
var xmlhttpshowBind;
var showBindDiv;
function showBind(BindPage,BindDiv) {
xmlhttpshowBind=GetXmlHttpObject();
[Code]...

It works great to fill the div called for, but I would like it to remove the div contents if it's unchecked, I'm not sure how to do this?

View 6 Replies View Related

Check Unchecked Radio

Jul 9, 2007

have multiple radio check buttons, and one of them, if checked, changes a div to a drop down menu.

The problem is I can't find a way to go back the way it was before clicked.

this is the javascript code:

function showinput(el){
{
put('<select name="country" size="1"><option>test</option>');
}
}

The put function:
function put(text){
obj = document.getElementById('theme');
obj.innerHTML = text;
}

Now in showinput, how can I tell it to change back when radio is not checked?

View 6 Replies View Related

JQuery :: Looping Through All Unchecked Checkboxes?

Aug 26, 2009

I have a function which is executed whenever someone clicks a checkbox on the page. There are lots of checkboxes on the page. I want the function to be performed on only the unchecked boxes. I've tried this two ways, neither of which has worked. Here are the two methods I've tried.

Method #1
$(".item input:unchecked").each(
function() {
if ($(this).val() > diff) {

[Code]....

Where diff is an integer and the values of the checkboxes are all integers. The problem is the function ends up getting run on all checkboxes, even boxes that have been checked.

View 3 Replies View Related

Validation: Get An Unchecked Radio Group's Name?

Jun 11, 2007

I'm working on validating radio buttons in a form. I want to require that a button be selected from required radio button groups before accepting the submit. Not all the radio button groups are required to have a selection.

One problem I'm having is that I can't return the name of the radio button group. I want to switch case on the name of the radio button group.

I do have an id for each individual radio button, so I can confirm that the for loops are working, but my alert tells me that radiogroups[j] is an [object] and radiogroups[j].name is undefined.

And there is a problem with the logic, too. If just one of the radio button sets is checked, the form validates. Code:

View 17 Replies View Related

How To Get Values From Checked / Unchecked Checkboxes

Jan 25, 2011

I have a for and lets say 4 checkboxes. I want to get the values of the checkboxes that are checked & to get the values of the checkboxes that are not checked. So if someone check the A & C checkbox I will get that A&C has this value (because they are checked!) and B,&D has this value(because they are not checked). Example this is my table....

<table >
<tr>
<td><label><input type="checkbox">A</label></td>
<td><label><input type="checkbox">B</label></td>
<td><label><input type="checkbox">C</label></td>
<td><label><input type="checkbox">D</label></td>
</tr>
</table>

View 2 Replies View Related

JQuery :: Get Checked Or Unchecked Check Box Value From Group?

Jul 6, 2010

I am extensively started using jQuery in my project.But I got stopped where I need to get either checked or unchecked checkbox values from group of check boxes.

<input type="checkbox" name="attribute" id="attribute" > ONE
<input type="checkbox" name="attribute" id="attribute" > TWO
<input type="checkbox" name="attribute" id="attribute" > THREE

[code]....

View 12 Replies View Related

Change Class When Radio Checked/unchecked?

Jul 28, 2011

change the color of text in a table row when a checkbox was checked. I am trying to replicate this but with radio buttons, but it doesn't remove the class when deselected like the checkbox did.

function change(obj) {
var tr=obj.parentNode.parentNode.parentNode;
if(obj.checked) {[code]...

View 2 Replies View Related

Submit Adding Back In Checkboxes That Were Unchecked In Javascript

Jul 23, 2005

The following script is supposed to have high categories as radio buttons and mid categories as check boxes. Clicking the radio button is supposed to select all checkboxes under it and submit the form.

RADIO (ID = 0001-1 VALUE="")
CHECK (ID=0001-0011)
CHECK (ID=0001-0012)
RADIO (ID = 0001-2 VALUE="")
CHECK (ID=0001-0021)
CHECK (ID=0001-0022)

The code appears to be checking and unchecking the correct checkboxes. But when the submit occurs, the buttons that were unchecked become checked again.


function handleHighCatSelect(obj)
{
var highCatName = obj.name;
var highCatNameInMidCat = highCatName.substring(0,5) + "00" +
highCatName.substring(5,6);
alert(highCatName);
var length = document.frm.elements.length;
for (var i=0;i<length;i++)
{
var formObj = document.basicSearchMFSFrm.elements[i];
var currName = formObj.name;
var currValue = formObj.value;

if ((formObj.type == 'radio' || formObj.type == 'checkbox')
&& (currName.indexOf(&#55612;&#57201;-') != -1) )
{
if ((currName.indexOf(highCatNameInMidCat) != -1) ||
(currName == highCatName ) )
{
formObj.checked = true;
}
else
{
formObj.checked = false;
}
}
}
frm.submit();
}

View 2 Replies View Related

Onblur Not Working When Tracking Unchecked Radio Button?

Aug 30, 2009

I have the following code which aims to change the color of a parent div when the user unselects the radio button. However it doesn't work.

<div class="jquerycorner"><input type="radio" name="hat" value="4" onblur="if(!this.checked) { this.parentNode.style.backgroundColor='#000000';}">10</div>

However the following code works when I try to detect radio button selection.

<div class="jquerycorner"><input type="radio" name="hat" value="1" onclick="this.parentNode.style.backgroundColor='#FFC0CB';">5</div>

View 2 Replies View Related

Clearing Arrays On The Fly

Jul 12, 2005

Have an array l am building up during end user selections. There is an option to clear all selections, how do l then clear the array?

View 7 Replies View Related

Clearing Innerhtml On Mozilla

Dec 1, 2005

i'm having some problems getting innerhtml to clear on mozilla, but it
works fine in ie. my page is setup such that i have a div:

<div id="otherModel"></div>

on a select from a combo box, in my javascript i execute:
div = document.getElementById("otherModel");
depending on what's selected in a combobox, i execute:
var inner2 = "<p>Other Model:<br />";
inner2 = inner2 + "<input type='text' id='otherModel' ";
inner2 = inner2 + "size=&#3920;' maxlength=&#3930;' value='Enter Model'>";
div.innerHTML = inner2;
or simply:
div.innerHTML = "test";

This all works fine independantly; it'll either fill with my textbox,
or the test string. but if the innerhtml is filled with the text box,
then i make a new selection that fills it with "test", it doesn't clear
out the text box.

If i replace the variable inner2 with simple text, everything seems to
work great (but i need a text box!).

View 2 Replies View Related

JQuery :: Clearing Fields In Div?

Jun 9, 2009

how can i clear the feilds in using jquery just like reset form in html.

View 4 Replies View Related

Clearing Textarea After 'reset'

Dec 7, 2009

I have a table with numerous textareas that I am able to clear once - the first time the textarea is clicked the default value is cleared and everything is OK.However, at a certain point the user might press a 'Clear' button linked to a function I wrote to reset the values back to the defaults. At this point clicking into the textarea does not clear it.

View 2 Replies View Related

Clearing One Textbox After Submit?

Nov 17, 2010

I'm trying to have a textbox clear after it has been filled and submitted. this is my form look....

<form action="" name="webForm" id="webForm">
<div id="title0" class="pageTitle">Enter Student Dropping A Course: </div>
<div id="fieldName">Name: <input type="text" id="fName" name="fName" size="40" maxlength="60" /></div>

[Code]....

View 3 Replies View Related

Clearing A List Menu

Apr 3, 2004

How do I clear a list menu?

View 1 Replies View Related

Clearing A Form Field Once

Apr 9, 2001

I have a page with multiple text fields, each of which has an example for an initial value. I've added the appropriate code so that onFocus() the example is cleared away, and a blank field is left behind. Trouble is, I only want that to happen once, so that the field isn't cleared if the user attempts to edit what they wrote earlier. Anybody know of a way to do that with only a few lines of code? Here's my existing code:


Code:
<script language="JavaScript">
<!--
function clearField(fieldName) {
fieldName.value = "";
}
// -->
</script>

<p>Person's Name: <input type="text" name="name" size="30"
value="John Smith" tabindex="2" onFocus="clearField(this)"></p>

View 2 Replies View Related







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