Jump to content

check in the checkbox not visible


raghup

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...