...

View Full Version : Passing ASP code in the Javacript for disable and enble fields



ClueLess
08-19-2008, 04:58 PM
I'm having this Onchange javascript works just fine for HTML, but how can we use RS asp in it?

If RS("MainSelID") = 1 or 3 we would like to disable other select fields. If the user selects other numbers than enble other select fields


<script language="JavaScript">

function ShowHide(box){
//disable & enble
// var SID ='<%=RS("MainSelID")%>'

var SID=box.id="MainS";

if(SID && box.selectedIndex == '1' || SID && box.selectedIndex == '3'){
document.getElementById('Select1').disabled=true
document.getElementById('Select2').disabled=true
}
else{
document.getElementById('Select1').disabled=false
document.getElementById('Select2').disabled=false
}
}
</script>

<form name="theForm" action="Submit.asp" onsubmit="return Validator(this)">

<select id="MainS" onchange="ShowHide(this)">
<option value="0">Main Sectect</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>

<!--<option selected value=""></option>
<%Do While Not RS.EOF %>
<option value="<%=RS("MainSelID")%>"><%=RS("MainSelID")%></option>
<%RSValIntent.MoveNext()
Loop
' RS.close-->
</select>

<select id="Select1">
<option value="0">Select1</option>
<option value="1">1</option>
<option value="2">2</option>
</select>

<select id="Select2">
<option value="0">Select2 me</option>
<option value="1">1</option>
<option value="2">2</option>
</select>


<br /><br />
<input type="Submit" value="Submit" name="submit">
</form>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum