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

Interesting Check Box Problem, for me anyway

Status
Not open for further replies.

Meleagant

Programmer
Aug 31, 2001
166
US
I have something like this....
ASP part of page:

SqlSrtr = Select ChkBox1, ...More... From Table Where....

rs.Open SqlStr,Connection,3,1

If rs.RecordCount > 0 Then
gChkBox1 = ddCursor("ChkBox1")
...More...
End If

If gChkBox = 1 Then
gCheckBoxVal = "CHECKED"
Else
gCheckBoxVal = ""
End If

rs.Close

Right?? Nothing wrong with this, the DB will return 1 or 0 letting me know all the values I need when I fill the page.

HTML Part...

<INPUT Name=&quot;Check1&quot; Type=&quot;checkbox&quot; Value=&quot;1&quot; <%=gCheckBoxVal%> onClick=&quot;jFunc(this.value);&quot;> Click Me

I keep on getting a Type mismatch: '[string: &quot;CHECKED&quot;]' errror.

Logically this should work. Whenever the value from the DB is 1 then the string's value is CHECKED. That value is then plunked into the HTML like any other attribute - value, size, maxlength, whatever. The CHECKED string should sit in there and behave as it was hard coded in there. What am I missing?/Not Seeing? Any help would be great.
 
Value=&quot;<%=gCheckBoxVal%>&quot;

Simple error...Value=&quot;1&quot; <%=gCheckBoxVal%>
your asp is not within the value....

Have Fun...Sharky99 >:):O>
 
No no...I knew that. Okay...What I wanted after all the DB calls and assignments were over was to have something like this:

<INPUT Name=&quot;Check1&quot; Type=&quot;checkbox&quot; Value=&quot;1&quot; CHECKED onClick=&quot;jFunc(this.value);&quot;> Click Me

The var gCheckBoxVal should have contained the string &quot;CHECKED&quot;. Basically the problem is that I have multiple check boxes on a page. The user saves and the next time they bring the page up the appropriate check boxes need to be turned on.

Doesn't matter though, I found what the problem was (didn't put the = after <% ) and got everything working

Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top