campbelc
asked on
Easy onselect question
Offering 30 points because that's all I have. :(
My problem is I need to display a text box (Start Date) if the user selects any item from a drop down list (Frequencies) other then Once.
This is for a Standing Orders/Remote Order Entry application that when the user is placing an order (Medical) and they would like the patient to be drawn more then once (Standing Order) they then need to provide a Start date as well. By default I don't want the start date to be shown because how my layout is, it would confuse many people.
Here is the code I have so far, although there has to be a way to automate this, I have 30 test slots that would all need to potentially use this script:
function showDate(freq1)
{
if (document.update.freq1.val ue!="Once" )
document.getElementById('T ZTStartDat e1').style .visibilit y = "visible";
else
document.getElementById('T ZTStartDat e1').style .visibilit y = "hidden";
}
function showDate(freq2)
{
if (document.update.freq2.val ue!="Once" )
document.getElementById('T ZTStartDat e2').style .visibilit y = "visible";
else
document.getElementById('T ZTStartDat e2').style .visibilit y = "hidden";
}
etc.. for all 30 tests.. I know I know there HAS to be an easy way to script this.
<tr bgcolor="ffffff">
<td><input type="hidden" name="test1" value="COMPLETE BLOOD COUNT (CBC)">COMPLETE BLOOD COUNT (CBC)</td>
<td><select name="test11dx" class="small_black"><optio n value="1" selected>1<option value="2">2<option value="3">3<option value="4">4</select></td>
<td><select name="test12dx" class="small_black"><optio n value=""><option value="1">1<option value="2">2<option value="3">3<option value="4">4</select></td>
<td><select name="test13dx" class="small_black"><optio n value=""><option value="1">1<option value="2">2<option value="3">3<option value="4">4</select></td>
<td><select name="test14dx" class="small_black"><optio n value=""><option value="1">1<option value="2">2<option value="3">3<option value="4">4</select></td>
<td><select name="freq1" class="small_black" onchange="javascript:showD ate(freq1) "><option value="Once">Once<option value="Weekly">Weekly<opti on value="Daily">Daily<option value="Random">Random<opti on value="Mon&Thur">Mon & Thurs<option value="Annual">Annual<opti on value="BiWeekly">BiWeekly< option value="Quarterly">Quarterl y<option value="SemiAnnual">SemiAnn ual<option value="3Weeks">3 Weeks<option value="4Months">4 Months<option value="BIMONTHLY">BiMonthl y</select> </td>
<td><font id="TZTStartDate1" style="visibility:hidden"> <input type="text" name="TZTStartDate1" class="cellbox" size="10" onFocus="javascript:vDateT ype='1'" onKeyUp="DateFormat(this,t his.value, event,fals e,'1')" onBlur="DateFormat(this,th is.value,e vent,true, '1')"><img align="bottom" src="/images/cal.jpg" border="0" onclick="javascript:showCa l('TZTStar tDate1')"> </font></t d>
<td><input type="text" name="TZTStopDate1" class="cellbox" size="10" onFocus="javascript:vDateT ype='1'" onKeyUp="DateFormat(this,t his.value, event,fals e,'1')" onBlur="DateFormat(this,th is.value,e vent,true, '1')"><img align="bottom" src="/images/cal.jpg" border="0" onclick="javascript:showCa l('TZTStop Date1')">< /td>
</tr>
<tr bgcolor="ffffff">
<td><input type="hidden" name="test2" value="HEPATIC FUNCTION PANEL">HEPATIC FUNCTION PANEL</td>
<td><select name="test21dx" class="small_black"><optio n value="1" selected>1<option value="2">2<option value="3">3<option value="4">4</select></td>
<td><select name="test22dx" class="small_black"><optio n value=""><option value="1">1<option value="2">2<option value="3">3<option value="4">4</select></td>
<td><select name="test23dx" class="small_black"><optio n value=""><option value="1">1<option value="2">2<option value="3">3<option value="4">4</select></td>
<td><select name="test24dx" class="small_black"><optio n value=""><option value="1">1<option value="2">2<option value="3">3<option value="4">4</select></td>
<td><select name="freq2" class="small_black" onchange="javascript:showD ate(freq2) "><option value="Once">Once<option value="Weekly">Weekly<opti on value="Daily">Daily<option value="Random">Random<opti on value="Mon&Thur">Mon&Thurs <option value="Annual">Annual<opti on value="BiWeekly">BiWeekly< option value="Quarterly">Quarterl y<option value="SemiAnnual">SemiAnn ual<option value="3Weeks">3 Weeks<option value="4Months">4 Months<option value="BIMONTHLY">BiMonthl y</select> </td>
<td><font id="TZTStartDate2" style="visibility:hidden"> <input type="text" name="TZTStartDate2" class="cellbox" size="10" onFocus="javascript:vDateT ype='1'" onKeyUp="DateFormat(this,t his.value, event,fals e,'1')" onBlur="DateFormat(this,th is.value,e vent,true, '1')"><img align="bottom" src="/images/cal.jpg" border="0" onclick="javascript:showCa l('TZTStar tDate2')"> </font></t d>
<td><input type="text" name="TZTStopDate2" class="cellbox" size="10" onFocus="javascript:vDateT ype='1'" onKeyUp="DateFormat(this,t his.value, event,fals e,'1')" onBlur="DateFormat(this,th is.value,e vent,true, '1')"><img align="bottom" src="/images/cal.jpg" border="0" onclick="javascript:showCa l('TZTStop Date2')">< /td>
</tr>
etc..
Please please help!
My problem is I need to display a text box (Start Date) if the user selects any item from a drop down list (Frequencies) other then Once.
This is for a Standing Orders/Remote Order Entry application that when the user is placing an order (Medical) and they would like the patient to be drawn more then once (Standing Order) they then need to provide a Start date as well. By default I don't want the start date to be shown because how my layout is, it would confuse many people.
Here is the code I have so far, although there has to be a way to automate this, I have 30 test slots that would all need to potentially use this script:
function showDate(freq1)
{
if (document.update.freq1.val
document.getElementById('T
else
document.getElementById('T
}
function showDate(freq2)
{
if (document.update.freq2.val
document.getElementById('T
else
document.getElementById('T
}
etc.. for all 30 tests.. I know I know there HAS to be an easy way to script this.
<tr bgcolor="ffffff">
<td><input type="hidden" name="test1" value="COMPLETE BLOOD COUNT (CBC)">COMPLETE BLOOD COUNT (CBC)</td>
<td><select name="test11dx" class="small_black"><optio
<td><select name="test12dx" class="small_black"><optio
<td><select name="test13dx" class="small_black"><optio
<td><select name="test14dx" class="small_black"><optio
<td><select name="freq1" class="small_black" onchange="javascript:showD
<td><font id="TZTStartDate1" style="visibility:hidden">
<td><input type="text" name="TZTStopDate1" class="cellbox" size="10" onFocus="javascript:vDateT
</tr>
<tr bgcolor="ffffff">
<td><input type="hidden" name="test2" value="HEPATIC FUNCTION PANEL">HEPATIC FUNCTION PANEL</td>
<td><select name="test21dx" class="small_black"><optio
<td><select name="test22dx" class="small_black"><optio
<td><select name="test23dx" class="small_black"><optio
<td><select name="test24dx" class="small_black"><optio
<td><select name="freq2" class="small_black" onchange="javascript:showD
<td><font id="TZTStartDate2" style="visibility:hidden">
<td><input type="text" name="TZTStopDate2" class="cellbox" size="10" onFocus="javascript:vDateT
</tr>
etc..
Please please help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works like a champ!
var s0 = document.getElementById('S
var s1 = document.getElementById('S
var s2 = document.getElementById('S
var s3 = document.getElementById('S
var boxes = 4;
function CheckDupes(){
var out = '|';
for(var i=0; i<boxes; i++){
t = eval('s'+i);
if(out.indexOf('|'+t[t.sel
alert('Duplicate');
return false;
}
out+=t[t.selectedIndex].va
}
return true;
}