S
Scott
Relative newbie here,
I'm looking to display the value of radio buttons and check boxes on the
page before submission. So far I can do most of it. When "Hat" is checked
there are to be no color options available. Click on shirt or pants, you
have three options, (actually four if you chose "None"). Shirts and pants
can have multiple colors.
OK, here is the issue, if you choose a color then change your mind and then
un-check the box, it doubles up the 'display' on the page ("strCavTop"). I
want it to clear the 'display' ("strCavTop") of that one value if the box is
clicked to un-check it.
Is there another way to display the data other than a form text box, like a
table cell or something similar? I willing to bet there is a more
economical way to do this, so if there is I'm open to any suggestions.
Thanks Much,
Scott
(Code below)
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function GreyOut() {
chk=document.forms[0]
{
chk.NONE. checked=false;
chk.NONE. disabled=true;
chk.BLUE. disabled=true;
chk.RED. disabled=true;
chk.WHITE. disabled=true;
}
}
////////////////////////////////////////////////////////////////////////////
//////////////////////
function Disab(val) {
frm=document.forms[0]
if(val=="HAT")
{
frm.NONE. disabled=true;
frm.BLUE. disabled=true;
frm.RED. disabled=true;
frm.WHITE. disabled=true;
frm.NONE. checked=true;
frm.BLUE. checked=false;
frm.RED. checked=false;
frm.WHITE. checked=false;
frm.strClassTop.value="HAT";
frm.strCavTop.value="";
}
if(val=="SHIRT")
{
frm.NONE. disabled=false;
frm.BLUE. disabled=false;
frm.RED. disabled=false;
frm.WHITE. disabled=false;
frm.NONE. checked=true;
frm.BLUE. checked=false;
frm.RED. checked=false;
frm.WHITE. checked=false;
frm.strClassTop.value="SHIRT";
frm.strCavTop.value="";
}
if(val=="PANTS")
{
frm.NONE. disabled=false;
frm.BLUE. disabled=false;
frm.RED. disabled=false;
frm.WHITE. disabled=false;
frm.NONE. checked=true;
frm.BLUE. checked=false;
frm.RED. checked=false;
frm.WHITE. checked=false;
frm.strClassTop.value="PANTS";
frm.strCavTop.value="";
}
if(val=="NONE")
{
frm.NONE. disabled=false;
frm.NONE. checked=true;
frm.BLUE. checked=false;
frm.RED. checked=false;
frm.WHITE. checked=false;
frm.strCavTop.value="";
}
if(val=="BLUE")
{
frm.NONE. disabled=false;
frm.NONE. checked=false;
}
if(val=="RED")
{
frm.NONE. disabled=false;
frm.NONE. checked=false;
}
if(val=="WHITE")
{
frm.NONE. disabled=false;
frm.NONE. checked=false;
}
}
////////////////////////////////////////////////////////////////////////////
/////////////////////
function makeBlue() {
frm=document.forms[0]
{
frm.strCavTop.value=frm.strCavTop.value+"//BLUE";
}
}
function makeRed() {
frm=document.forms[0]
{
frm.strCavTop.value=frm.strCavTop.value+"//RED";
}
}
function makeWhite() {
frm=document.forms[0]
{
frm.strCavTop.value=frm.strCavTop.value+"//WHITE";
}
}
////////////////////////////////////////////////////////////////////////////
/////////////////////
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onLoad="GreyOut()">
<FORM NAME="frmMyForm">
<table border="0" width="100%" height="100%" cellspacing="0"
cellpadding="0">
<tr>
<td>
<INPUT TYPE="text" NAME="strClassTop" style="border: 1px solid #FFFFFF;
background-color: #FFFFFF; color:#FF0000; text-align:right" size="21"><INPUT
TYPE="text" NAME="strCavTop" style="border: 1px solid #FFFFFF;
background-color: #FFFFFF; color:#FF0000; text-align:left" size="50"></td>
</tr>
<tr>
<td valign="top">
<div align="center">
<table>
<tr>
<td align="right">HAT</td>
<td align="left">
<input name="classification" type="radio" value="HAT"
onClick="Disab(this.value)"><input type="hidden" name="class"></td>
<td> </td>
<td align="right">None</td>
<td>
<input type="checkbox" value="NONE" name="NONE"
OnClick="Disab(this.value)"></td>
</tr>
<tr>
<td align="right">SHIRT</td>
<td align="left">
<input name="classification" type="radio" value="SHIRT"
onClick="Disab(this.value)"></td>
<td> </td>
<td align="right">BLUE</td>
<td>
<input type="checkbox" value="BLUE" name="BLUE" onClick="Disab(this.value),
makeBlue()"></td>
</tr>
<tr>
<td align="right">PANTS</td>
<td align="left">
<input name="classification" type="radio" value="PANTS"
onClick="Disab(this.value)"></td>
<td> </td>
<td align="right">RED</td>
<td>
<input type="checkbox" value="RED" name="RED" onClick="Disab(this.value),
makeRed()"></td>
</tr>
<tr>
<td align="right"> </td>
<td align="left">
</td>
<td> </td>
<td align="right">WHITE</td>
<td>
<input type="checkbox" value="WHITE" name="WHITE"
onClick="Disab(this.value), makeWhite()"></td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td align="left">
</tr>
</table>
</FORM>
</BODY>
</HTML>
I'm looking to display the value of radio buttons and check boxes on the
page before submission. So far I can do most of it. When "Hat" is checked
there are to be no color options available. Click on shirt or pants, you
have three options, (actually four if you chose "None"). Shirts and pants
can have multiple colors.
OK, here is the issue, if you choose a color then change your mind and then
un-check the box, it doubles up the 'display' on the page ("strCavTop"). I
want it to clear the 'display' ("strCavTop") of that one value if the box is
clicked to un-check it.
Is there another way to display the data other than a form text box, like a
table cell or something similar? I willing to bet there is a more
economical way to do this, so if there is I'm open to any suggestions.
Thanks Much,
Scott
(Code below)
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function GreyOut() {
chk=document.forms[0]
{
chk.NONE. checked=false;
chk.NONE. disabled=true;
chk.BLUE. disabled=true;
chk.RED. disabled=true;
chk.WHITE. disabled=true;
}
}
////////////////////////////////////////////////////////////////////////////
//////////////////////
function Disab(val) {
frm=document.forms[0]
if(val=="HAT")
{
frm.NONE. disabled=true;
frm.BLUE. disabled=true;
frm.RED. disabled=true;
frm.WHITE. disabled=true;
frm.NONE. checked=true;
frm.BLUE. checked=false;
frm.RED. checked=false;
frm.WHITE. checked=false;
frm.strClassTop.value="HAT";
frm.strCavTop.value="";
}
if(val=="SHIRT")
{
frm.NONE. disabled=false;
frm.BLUE. disabled=false;
frm.RED. disabled=false;
frm.WHITE. disabled=false;
frm.NONE. checked=true;
frm.BLUE. checked=false;
frm.RED. checked=false;
frm.WHITE. checked=false;
frm.strClassTop.value="SHIRT";
frm.strCavTop.value="";
}
if(val=="PANTS")
{
frm.NONE. disabled=false;
frm.BLUE. disabled=false;
frm.RED. disabled=false;
frm.WHITE. disabled=false;
frm.NONE. checked=true;
frm.BLUE. checked=false;
frm.RED. checked=false;
frm.WHITE. checked=false;
frm.strClassTop.value="PANTS";
frm.strCavTop.value="";
}
if(val=="NONE")
{
frm.NONE. disabled=false;
frm.NONE. checked=true;
frm.BLUE. checked=false;
frm.RED. checked=false;
frm.WHITE. checked=false;
frm.strCavTop.value="";
}
if(val=="BLUE")
{
frm.NONE. disabled=false;
frm.NONE. checked=false;
}
if(val=="RED")
{
frm.NONE. disabled=false;
frm.NONE. checked=false;
}
if(val=="WHITE")
{
frm.NONE. disabled=false;
frm.NONE. checked=false;
}
}
////////////////////////////////////////////////////////////////////////////
/////////////////////
function makeBlue() {
frm=document.forms[0]
{
frm.strCavTop.value=frm.strCavTop.value+"//BLUE";
}
}
function makeRed() {
frm=document.forms[0]
{
frm.strCavTop.value=frm.strCavTop.value+"//RED";
}
}
function makeWhite() {
frm=document.forms[0]
{
frm.strCavTop.value=frm.strCavTop.value+"//WHITE";
}
}
////////////////////////////////////////////////////////////////////////////
/////////////////////
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onLoad="GreyOut()">
<FORM NAME="frmMyForm">
<table border="0" width="100%" height="100%" cellspacing="0"
cellpadding="0">
<tr>
<td>
<INPUT TYPE="text" NAME="strClassTop" style="border: 1px solid #FFFFFF;
background-color: #FFFFFF; color:#FF0000; text-align:right" size="21"><INPUT
TYPE="text" NAME="strCavTop" style="border: 1px solid #FFFFFF;
background-color: #FFFFFF; color:#FF0000; text-align:left" size="50"></td>
</tr>
<tr>
<td valign="top">
<div align="center">
<table>
<tr>
<td align="right">HAT</td>
<td align="left">
<input name="classification" type="radio" value="HAT"
onClick="Disab(this.value)"><input type="hidden" name="class"></td>
<td> </td>
<td align="right">None</td>
<td>
<input type="checkbox" value="NONE" name="NONE"
OnClick="Disab(this.value)"></td>
</tr>
<tr>
<td align="right">SHIRT</td>
<td align="left">
<input name="classification" type="radio" value="SHIRT"
onClick="Disab(this.value)"></td>
<td> </td>
<td align="right">BLUE</td>
<td>
<input type="checkbox" value="BLUE" name="BLUE" onClick="Disab(this.value),
makeBlue()"></td>
</tr>
<tr>
<td align="right">PANTS</td>
<td align="left">
<input name="classification" type="radio" value="PANTS"
onClick="Disab(this.value)"></td>
<td> </td>
<td align="right">RED</td>
<td>
<input type="checkbox" value="RED" name="RED" onClick="Disab(this.value),
makeRed()"></td>
</tr>
<tr>
<td align="right"> </td>
<td align="left">
</td>
<td> </td>
<td align="right">WHITE</td>
<td>
<input type="checkbox" value="WHITE" name="WHITE"
onClick="Disab(this.value), makeWhite()"></td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td align="left">
</tr>
</table>
</FORM>
</BODY>
</HTML>