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

Dynamic Checkbox not Populating from Database

Community Beginner ,
Nov 01, 2012 Nov 01, 2012

Using a simple insert record then pull info from database and update record web page, however the checkboxes on the update page are not pulling the existing information from the database. The checkbox (checkbox 1,0) is writing '1' to the database when checked and the record added, but the update page does not show the checkbox to be checked on the update page.

Here is the code for the checkbox on the update page:

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

Any ideas?

TOPICS
Server side applications
638
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 01, 2012 Nov 01, 2012
LATEST

Try this instead:

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

Also, why are you converting the field you are testing to a string? What is the datatype in the db? If numeric or boolean why not just:

<input <%If (print_jobs.Fields.Item("pjVarnish").Value) = 1) Then Response.Write("checked") %> type="checkbox" name="pjVarnish" value="1" />

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