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

update record form checkbox

Participant ,
Feb 06, 2007 Feb 06, 2007
In order to use 2 update record forms on a single page, I have used the update server behavior for the first form and I have created an update record processing page for the second form, meaning that the form's action is to go to the processing page containing the update query code. All fields update fine for this second form except for a checkbox field. The checkbox's initial value is dynamically set using dreamweaver's dynamic button. However, the value remains "checkbox" regardless if the box is checked or not. I suppose the update server behavior handled this issue in my first form as this problem did not occur there. Following is the checkbox code. Please advise how to make the value to True or False based on if it is checked or not.

<form ACTION="morecontactsprocessor.asp" method="post" name="morecontacts" id="morecontacts">

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


update Code on morecontactsprocessor.asp's page:


objConn.Execute("UPDATE morecontacts_mor SET firstnm_mor='"&Request.Form("firstnm_mor")&"', lastnm_mor='"&Request.Form("lastnm_mor")&"', phone_mor='"&Request.Form("phone_mor")&"', altphone_mor='"&Request.Form("altphone_mor")&"', fax_mor='"&Request.Form("fax_mor")&"', cellphone_mor='"&Request.Form("cellphone_mor")&"', email_mor='"&Request.Form("email_mor")&"', altemail_mor='"&Request.Form("altemail_mor")&"', emailprob_mor='"&Request.Form("emailprob_mor")&"' WHERE contactid_mor="&Request.Form("contactid_mor")&" ")
Response.Redirect("addcustomer.asp")
TOPICS
Server side applications
478
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
New Here ,
Feb 06, 2007 Feb 06, 2007
Not sure about what's going on there...

But as an alternative idea, I have in the past managed to have two forms work together using the same update script, you just have to do a little hand coding with the hidden form variables that DW tests for as well as an if / then statement around the SQL (with a second SQL statement for your second form). It does break the original server behavior, but it's not too hard to figure out and update in the future.
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
Participant ,
Feb 06, 2007 Feb 06, 2007
LATEST
The truth is that I don't even need to mention that there are 2 update record forms on the page. The focus is the 2nd form and the point is that I am not using dreamweaver's update record sb for this form but rather, I set that the form's action is to go to the processing page containing the update query code. All fields update fine for this form except for a checkbox field. The checkbox's initial value is bound to a recordset value of either True or False and displays properly. However, the value that passes to the update processing page remains "checkbox" regardless if the box is checked or not (for testing purposes I changed the form's method to "get" and saw on the processing page's url that the value of the checkbox form field remains "checkbox" rather than True or False)

Here is the code in focus:

<form ACTION="morecontactsprocessor.asp" method="post" name="morecontacts" id="morecontacts">

<input name="emailprob_mor" type="checkbox" id="emailprob_mor" value="checkbox" <%If (CStr((rs_morecontacts.Fields.Item("emailprob_mor").Value)) = CStr("True")) Then Response.Write("checked") : Response.Write("")%>>
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