Jump to content

check in the checkbox not visible


raghup
 Share

Recommended Posts

Hi,I am trying to create an update pages in asp using vbscript. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>The update page has checkboxes. How do I make the check in the checkbox visible. I am using the following code.<input name="RecievedNotification" type="checkbox" id="RecievedNotification" value = "<%If RecievedNotification = "-1" Then Response.Write("checked=""checked""") : Response.Write("")%>" />Is this correct? If it is why is the check not visible? If not correct please help.CheersRaghu

Link to comment
Share on other sites

<input name="RecievedNotification" type="checkbox" id="RecievedNotification" value = "<%If RecievedNotification = "-1" Then Response.Write("checked=""checked""") : Response.Write("")%>" />Is this correct? If it is why is the check not visible? If not correct please help.
Its not correct, it produces invalid HTML. The resulting HTML will look like this:
<input name="RecievedNotification" type="checkbox" id="RecievedNotification" value = "" />or<input name="RecievedNotification" type="checkbox" id="RecievedNotification" value = "checked="checked"" />

That's obviously not right because value and checked are two distinct attributes.You want this instead:

<input name="RecievedNotification" type="checkbox" id="RecievedNotification" value="y" <%If RecievedNotification = "-1" Then Response.Write("checked=""checked""") : Response.Write("")%>" />

Link to comment
Share on other sites

Its not correct, it produces invalid HTML. The resulting HTML will look like this:
<input name="RecievedNotification" type="checkbox" id="RecievedNotification" value = "" />or<input name="RecievedNotification" type="checkbox" id="RecievedNotification" value = "checked="checked"" />

That's obviously not right because value and checked are two distinct attributes.You want this instead:

<input name="RecievedNotification" type="checkbox" id="RecievedNotification" value="y" <%If RecievedNotification = "-1" Then Response.Write("checked=""checked""") : Response.Write("")%>" />

<input name="RecievedNotification" type="checkbox" id="RecievedNotification"  <%If rsCheckLists.Fields.Item("RecievedNotification") = True Then Response.Write("checked=""checked""") : Response.Write("")%> />

works better. Thanks for the tip. I experimented.CheersRaghu

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...