Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

Sponsored Links

Discuss "checkbox selection" in the ASP Development forum.

ASP Development - Learn coding practices and tips to get the best out of your Active Server Pages (ASP). The Classic ASP forum is for ASP/VBScript and ASP/JScript applications.


Reply « Previous Thread | Next Thread »  
 
LinkBack Thread Tools Display Modes
  #1  
Old July 5th, 2008, 09:29 PM
Barn Frequenter

 
Join Date: Mar 2008
Posts: 197
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
todd2006 is an unknown quantity at this point
Default checkbox selection

Hi,

I have this variable

checkstats=rs("Status")

if checkstats has the value Yes then i want the checkbox to be selected

IF it doesnt have any value or its blank then checkbox should not be selected


I have my code like this
Code:
<%
checkstats=rs("Status")
Response.write "Status :-" & checkstats & "<br/>"
%>

<input type="checkbox" name="status" id="status" value="<%=checkstats%>" <%if Trim(checkstats)=Trim(Request.Form("status")) then Response.Write "checked" end if%> >

But it doesnt select the checkbox

any idea

todd
Reply With Quote
Sponsored Links
  #2  
Old July 6th, 2008, 05:13 AM
richyrich's Avatar
Moderator


 
Join Date: Mar 2008
Location: Somewhere only we know...
Posts: 395
Thanks: 26
Thanked 32 Times in 32 Posts
Blog Entries: 1
Rep Power: 1
richyrich will become famous soon enough

Awards Showcase
Classic ASP JavaScript 
Total Awards: 2

Default

Try this:-
Code:
<input type="checkbox" name="status" id="status" value="<%=checkstats%>" <%if Trim(checkstats)=Trim(Request.Form("status")) then Response.Write " checked" end if%> >
You need to response.write "<space>checked" for it to build the checkbox correctly.
Otherwise you have <input type="checkbox" name="status" id="status" value="your_value"checked > which would not check the box.

Hope that helps.
Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > ASP Development

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
checkbox todd2006 ASP Development 18 June 19th, 2008 08:35 PM
checkbox validation todd2006 JavaScript Programming 3 June 18th, 2008 07:22 PM
display problem checkbox todd2006 JavaScript Programming 4 May 30th, 2008 03:58 PM


All times are GMT -4. The time now is 01:32 PM.



Content Relevant URLs by vBSEO 3.2.0