Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

uncheck a checkbox 1

Status
Not open for further replies.

44nato44

Programmer
Dec 12, 2008
115
NL
I have a procedure which clears out any textfields on a web site, but I would like to also do that with checkboxes, I hope somebody can advice what it might be.

I tried document.getElementById('IntakeFormReceived').value =
These values
0 or '' or "" or "off"

Anybody know what I should use

This is the code :

function addParticipant() {
// check if any changes are outstanding
if (!checkChanges()) { return false; }

if (document.getElementById('addbtn').value=="Add Participant") {
// disabled buttons
document.getElementById('addbtn').value="Cancel";
document.getElementById('savebtn').disabled=true;
document.getElementById('savebtn').className="btn1dis";
document.getElementById('prevbtn').disabled=true;
document.getElementById('prevbtn').className="btn2dis";
document.getElementById('nextbtn').disabled=true;
document.getElementById('nextbtn').className="btn3dis";
document.getElementById('searchbtn').disabled=true;
document.getElementById('searchbtn').className="btn4dis";

// empty all text fields and move to tab2
newParticipant = true;
var sels = document.getElementsByTagName('select');
var i;
for (i=0; i<sels.length; i++) {
sels.selectedIndex = 0;
}
var inps = document.getElementsByTagName('input');
for (i=0; i<inps.length; i++) {
if (inps.type=="text") { inps.value = ""; }
}
document.getElementById('Notes').value = "";
document.getElementById('IntakeFormReceived').value = "Off";
showTab(2);
} else {
// re-enable buttons
document.getElementById('addbtn').value="Add Participant";
document.getElementById('searchbtn').disabled=false;
document.getElementById('searchbtn').className="btn4";
newParticipant = false;
showParticipant(curParticipant,true);
}
}
 
Hi

Code:
document[teal].[/teal][COLOR=darkgoldenrod]getElementById[/color][teal]([/teal][green][i]'yourcheckboxid'[/i][/green][teal]).[/teal]checked[teal]=[/teal][b]false[/b]

Feherke.
 
Sorry, that did not work
I checked in Chrome and IE

I am not a java script expert
 
Sorry I cannot do that :(

This is the html code for the checkbox

<tr><td colspan="3"></td><td class="darkbg" width="180">Intake Form Received: </td><td class="darkbg"><input type="checkbox" class="autowidth" onchange="fieldChanged(this);" name="IntakeFormReceived"<% If RecSet("IntakeFormReceived")= true Then Response.Write(" checked='checked'") %> /></td></tr>

Hope it might help a bit
 
Hi

No, server-side code is not helpful in debugging client-side problem.

However one thing can be deduced with certailn probability : your [tt]checkbox[/tt] has no [tt]id[/tt] attribute.

In your initial code you handled most of the elements by [tt]id[/tt].
As you posted no HTML, I supposed that your [tt]checkbox[/tt]es also have [tt]id[/tt]s.
When I posted the solution, I used 'yourcheckboxid' as placeholder, supposing that you will get the meaning and will replace it with the [tt]id[/tt] of your [tt]checkbox[/tt].

Have you set the [tt]id[/tt]s correctly ? I mean identically in the [tt]checkbox[/tt] tag's [tt]id[/tt] attribute and the [tt]getElementById()[/tt] function's parameter ?


Feherke.
 
cool, thanks a lot that was it :)

as I said my java script knowledge is not the best

wont forget this though
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top