0
Update database - checkbox
LEGEND
,
/t5/dreamweaver-discussions/update-database-checkbox/td-p/646599
Feb 28, 2007
Feb 28, 2007
Copy link to clipboard
Copied
I'm using the code below on my update page, but the checkbox
value sin't
being inserted in to the database. Everything else is working fine.
Any Ideas???
Thanks
Andy
Mt checkbox code is:
<input <%If (CStr((ProductsRS.Fields.Item("Accessory").Value)) =
CStr("True")) Then Response.Write("checked=""checked""") :
Response.Write("")%> name="accessory_box" type="checkbox"
id="accessory_box">
if AccessGroupID <> 2 then
if Request("selected") <> "" then
ProductsRS("sagecode")=Request("sagecode")
ProductsRS("Product")=Request("Product")
ProductsRS("Description")=Request("EditorValue")
ProductsRS("offer_text")=Request("offer_text")
ProductsRS("offer_link")=Request("offer_link")
ProductsRS("CategoryID")=Request("CategoryID")
ProductsRS("ManufacturerID")=Request("ManufacturerID")
ProductsRS("ListPrice")=DoNull(Request("ListPrice"))
ProductsRS("Percentage")=DoNull(Request("Percentage"))
ProductsRS("Price")=DoNull(Request("ListPrice"))-discount
ProductsRS("Savings")=discount
ProductsRS("Break1")=DoNull(Request("Break1"))
ProductsRS("Price2")=DoNull(Request("Price2"))
ProductsRS("Break2")=DoNull(Request("Break2"))
ProductsRS("Price3")=DoNull(Request("Price3"))
ProductsRS("Break3")=DoNull(Request("Break3"))
ProductsRS("InStock")=DoNull(Request("InStock"))
ProductsRS("Accessory")=Request("accessory_box")
ProductsRS.Update
being inserted in to the database. Everything else is working fine.
Any Ideas???
Thanks
Andy
Mt checkbox code is:
<input <%If (CStr((ProductsRS.Fields.Item("Accessory").Value)) =
CStr("True")) Then Response.Write("checked=""checked""") :
Response.Write("")%> name="accessory_box" type="checkbox"
id="accessory_box">
if AccessGroupID <> 2 then
if Request("selected") <> "" then
ProductsRS("sagecode")=Request("sagecode")
ProductsRS("Product")=Request("Product")
ProductsRS("Description")=Request("EditorValue")
ProductsRS("offer_text")=Request("offer_text")
ProductsRS("offer_link")=Request("offer_link")
ProductsRS("CategoryID")=Request("CategoryID")
ProductsRS("ManufacturerID")=Request("ManufacturerID")
ProductsRS("ListPrice")=DoNull(Request("ListPrice"))
ProductsRS("Percentage")=DoNull(Request("Percentage"))
ProductsRS("Price")=DoNull(Request("ListPrice"))-discount
ProductsRS("Savings")=discount
ProductsRS("Break1")=DoNull(Request("Break1"))
ProductsRS("Price2")=DoNull(Request("Price2"))
ProductsRS("Break2")=DoNull(Request("Break2"))
ProductsRS("Price3")=DoNull(Request("Price3"))
ProductsRS("Break3")=DoNull(Request("Break3"))
ProductsRS("InStock")=DoNull(Request("InStock"))
ProductsRS("Accessory")=Request("accessory_box")
ProductsRS.Update
TOPICS
Server side applications
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Contributor
,
/t5/dreamweaver-discussions/update-database-checkbox/m-p/646600#M144416
Feb 28, 2007
Feb 28, 2007
Copy link to clipboard
Copied
It is not saving into the DB because you aren't setting the
value of the checkbox: value="true"
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/dreamweaver-discussions/update-database-checkbox/m-p/646601#M144417
Mar 01, 2007
Mar 01, 2007
Copy link to clipboard
Copied
Thanks for that envision3d
That does now show the checkbox as checked if the database field has a value
of 'True'
Now i need to be able to insert the value into the database for my
insert/update page.
The code i'm using for the rest of my insert/update is:
ProductsRS("Accessory")=Request("accessory_box")
ProductsRS.Update
Thanks
Andy
"envision3d" <webforumsuser@macromedia.com> wrote in message
news:es481q$3vv$1@forums.macromedia.com...
> This is because you cannot "response.write" code, this writes to the
> screen.
> And I don't see where you set the value of the checkbox. If you wanted to
> run
> a check then do it before the checkbox maybe somthing like:
>
> <%
> dim chkBoxValue
>
> if (CStr((ProductsRS.Fields.Item("Accessory").Value)) = CStr("True"))
> Then
> chkBoxValue = "checked"
> else
> chkBoxValue = "notChecked"
> end if
> %>
>
> <input type="checkbox" value="<%=chkBoxValue%> name="myCheckBox">
>
That does now show the checkbox as checked if the database field has a value
of 'True'
Now i need to be able to insert the value into the database for my
insert/update page.
The code i'm using for the rest of my insert/update is:
ProductsRS("Accessory")=Request("accessory_box")
ProductsRS.Update
Thanks
Andy
"envision3d" <webforumsuser@macromedia.com> wrote in message
news:es481q$3vv$1@forums.macromedia.com...
> This is because you cannot "response.write" code, this writes to the
> screen.
> And I don't see where you set the value of the checkbox. If you wanted to
> run
> a check then do it before the checkbox maybe somthing like:
>
> <%
> dim chkBoxValue
>
> if (CStr((ProductsRS.Fields.Item("Accessory").Value)) = CStr("True"))
> Then
> chkBoxValue = "checked"
> else
> chkBoxValue = "notChecked"
> end if
> %>
>
> <input type="checkbox" value="<%=chkBoxValue%> name="myCheckBox">
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
LATEST
/t5/dreamweaver-discussions/update-database-checkbox/m-p/646602#M144418
Mar 01, 2007
Mar 01, 2007
Copy link to clipboard
Copied
Its ok - :-)
I was using yes/no instead of ture/false - - - -
Thanks again envision3d
Andy
"Andy" <me@work.com> wrote in message
news:es6954$llk$1@forums.macromedia.com...
> Thanks for that envision3d
>
> That does now show the checkbox as checked if the database field has a
> value of 'True'
> Now i need to be able to insert the value into the database for my
> insert/update page.
>
> The code i'm using for the rest of my insert/update is:
>
> ProductsRS("Accessory")=Request("accessory_box")
> ProductsRS.Update
>
> Thanks
> Andy
>
>
>
>
> "envision3d" <webforumsuser@macromedia.com> wrote in message
> news:es481q$3vv$1@forums.macromedia.com...
>> This is because you cannot "response.write" code, this writes to the
>> screen.
>> And I don't see where you set the value of the checkbox. If you wanted
>> to run
>> a check then do it before the checkbox maybe somthing like:
>>
>> <%
>> dim chkBoxValue
>>
>> if (CStr((ProductsRS.Fields.Item("Accessory").Value)) = CStr("True"))
>> Then
>> chkBoxValue = "checked"
>> else
>> chkBoxValue = "notChecked"
>> end if
>> %>
>>
>> <input type="checkbox" value="<%=chkBoxValue%> name="myCheckBox">
>>
>
>
I was using yes/no instead of ture/false - - - -
Thanks again envision3d
Andy
"Andy" <me@work.com> wrote in message
news:es6954$llk$1@forums.macromedia.com...
> Thanks for that envision3d
>
> That does now show the checkbox as checked if the database field has a
> value of 'True'
> Now i need to be able to insert the value into the database for my
> insert/update page.
>
> The code i'm using for the rest of my insert/update is:
>
> ProductsRS("Accessory")=Request("accessory_box")
> ProductsRS.Update
>
> Thanks
> Andy
>
>
>
>
> "envision3d" <webforumsuser@macromedia.com> wrote in message
> news:es481q$3vv$1@forums.macromedia.com...
>> This is because you cannot "response.write" code, this writes to the
>> screen.
>> And I don't see where you set the value of the checkbox. If you wanted
>> to run
>> a check then do it before the checkbox maybe somthing like:
>>
>> <%
>> dim chkBoxValue
>>
>> if (CStr((ProductsRS.Fields.Item("Accessory").Value)) = CStr("True"))
>> Then
>> chkBoxValue = "checked"
>> else
>> chkBoxValue = "notChecked"
>> end if
>> %>
>>
>> <input type="checkbox" value="<%=chkBoxValue%> name="myCheckBox">
>>
>
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

