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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkboxes-BIG TROUBLE!! 1

Status
Not open for further replies.

Christiana

Technical User
Apr 24, 2001
21
0
0
CY
I have 2 recordsets. The one gets all the possible values for an item(TypeOfItem)-rs and the other gets the actual value (ItemValue)-rs2.
I present all the possible values of this item in a checkbox like this:
<%rs.MoveFirst
while (NOT rs.EOF)%>
<input type=&quot;Checkbox&quot; name=&quot;ItemVal&quot;>
<%=rs(0)%><BR>
<%
rs.movenext
wend
%>

if the checkbox is the same as the real value
I want to check the checkbox.
(I use VBScript for server-side but for client-side I have to use JScript to be compatible with Netscape)
I've used something like this:
<body onload=&quot;ChangeCheck()&quot;>

<script Language=&quot;JScript&quot;>
<!--function ChangeCheck(){

if(window.document.Change.ItemVal==rs2(&quot;RealValue&quot;))
window.document.Change.ItemVal.checked=true;
}

But it seems I can't use the rs2 inside JScript.

I tried using server-side code but I have to refresh the page to see the check.
I've tried AddHeader &quot;Refresh&quot; &quot;1&quot; and META REFRESH but it keeps refreshing every 1 second. I just want to refresh it once.
Is there a solution to this?

Pls help.Thank you in advance
Christiana




 
>The one gets all the possible values for an item(TypeOfItem)-rs and the other gets the actual value (ItemValue)-rs2

So rs2 has only one value?
if yes, you must must insert 'checked' in the correct <option>. Eg

while not rs.eof
response.write &quot;<input type=checkbox name=Itemval &quot; &_
&quot;value=&quot; & rtrim(rs(0))
if rs(0) = rs2(0) then
response.write &quot; checked&quot;
end if
response.write &quot;>&quot; & rs(0)
rs.movenext
wend

br
Gerard
(-:

Better a known bug then a new release.
 
foxbox is right, but I'll add a comment by saying that your fundamental issue up there is that you are trying to mix a server side object (your recordset) into client side code --

They can mix, but you should mix them in the way that foxbox has mentioned -- by writing out the client side code with server side reponse.write's --

There's a FAQ over in the vbscript forum that talks about this very issue.

good luck! :)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top