Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Dynamic checkbox not displaying correctly

New Here ,
Nov 03, 2006 Nov 03, 2006
I've been going round in circles trying to solve my problem of dynamic checkboxes in an ASP script and I was wondering if anyone can help me. In addition, I've read the Ultradev pages on Adding dynamic content for checkboxes and I can't see what I'm doing wrong.

The check box links to a Yes/No field in MS Access. I have created a filtered recordset.

I want this checkbox in a form that has an update server behavior.

The code for the checkbox that gets generated is:

<input <%If (CStr((rsViewAccess.Fields.Item("fldReadTerms").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="checkbox" type="checkbox" value="checkbox" checked="checked" />

However the above code doesn't display a 'check' or 'uncheck' when the content of the field in the database is 'true' or 'false' respectively. (I've added a control field to view the content of the field - this displays the content of the Yes/No field as 'true' or 'false'). Once manually checked or unchecked by the user, the checkbox updates the database correctly. The problem appears to be only with the display of the content of the Yes/No field using the checkbox.

Many thanks
Sandra

TOPICS
Server side applications
306
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 06, 2006 Nov 06, 2006
LATEST
Hi Sandra,

Have you tried using 1/0 or Yes/No as opposed to True/False?

<input <%If (CStr((rsViewAccess.Fields.Item("fldReadTerms").Value)) =
CStr("Yes")) Then Response.Write("checked=""checked""") :
Response.Write("")%>
name="checkbox" type="checkbox" value="checkbox" checked="checked" />

...or:

<input <%If (CStr((rsViewAccess.Fields.Item("fldReadTerms").Value)) =
CStr("1")) Then Response.Write("checked=""checked""") :
Response.Write("")%>
name="checkbox" type="checkbox" value="checkbox" checked="checked" />

Please note, the above code may not be correct, I'm just using it to
illustrate that you could try "Yes" or "1" rather than "True", to see if it
makes a difference.

I hope this is useful.

Regards
Nath.

"Database Novice" <webforumsuser@macromedia.com> wrote in message
news:eigbtp$rn7$1@forums.macromedia.com...
> I've been going round in circles trying to solve my problem of dynamic
> checkboxes in an ASP script and I was wondering if anyone can help me. In
> addition, I've read the Ultradev pages on Adding dynamic content for
> checkboxes
> and I can't see what I'm doing wrong.
>
> The check box links to a Yes/No field in MS Access. I have created a
> filtered
> recordset.
>
> I want this checkbox in a form that has an update server behavior.
>
> The code for the checkbox that gets generated is:
>
> <input <%If (CStr((rsViewAccess.Fields.Item("fldReadTerms").Value)) =
> CStr("True")) Then Response.Write("checked=""checked""") :
> Response.Write("")%>
> name="checkbox" type="checkbox" value="checkbox" checked="checked" />
>
> However the above code doesn't display a 'check' or 'uncheck' when the
> content
> of the field in the database is 'true' or 'false' respectively. (I've
> added a
> control field to view the content of the field - this displays the content
> of
> the Yes/No field as 'true' or 'false'). Once manually checked or
> unchecked by
> the user, the checkbox updates the database correctly. The problem
> appears to
> be only with the display of the content of the Yes/No field using the
> checkbox.
>
> Many thanks
> Sandra
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines