|
 |
asp_databases thread: Load default value into check box from database
Message #1 by "Rich Hoffmann" <rich@h...> on Wed, 12 Feb 2003 15:41:04
|
|
I am creating a member profile page for members to be able to modify. I
do a SELECT into an access database and then load a table with the
results. All the text boxes fill in with the data from the database for
the member to review/modify, but the check boxes will only display the
default value specified in Front Page Check Box Properties...they will not
update with the database field value. I have several of these fields that
need to be 1 for checked and 0 for not checked. What am I missing???
Check box program:
<tr>
<td width="250" bgcolor="#808080" align="right" bordercolor="#000000">
Publish Information in Members' Directory?</td>
<td width="303">
<input type="checkbox" name="PublishDecline" value="<%
=PublishDecline%>" tabindex="13" style="text-align: center; font-size:
2mm">
</td>
</tr>
Message #2 by Mark Eckeard <meckeard2000@y...> on Wed, 12 Feb 2003 07:54:29 -0800 (PST)
|
|
Setting the value to 0 or 1 will not check the box.
You need to do something like this:
if PublishDecline = 0 then
<input type="checkbox" value="0" checked>
<input type="checkbox" value="1">
else
<input type="checkbox" value="0">
<input type="checkbox" value="1" checked>
end if
Mark.
--- Rich Hoffmann <rich@h...>
wrote:
> I am creating a member profile page for members to
> be able to modify. I
> do a SELECT into an access database and then load a
> table with the
> results. All the text boxes fill in with the data
> from the database for
> the member to review/modify, but the check boxes
> will only display the
> default value specified in Front Page Check Box
> Properties...they will not
> update with the database field value. I have
> several of these fields that
> need to be 1 for checked and 0 for not checked.
> What am I missing???
>
> Check box program:
>
> <tr>
> <td width="250" bgcolor="#808080" align="right"
> bordercolor="#000000">
> Publish Information in Members'
> Directory?</td>
> <td width="303">
> <input type="checkbox" name="PublishDecline"
> value="<%
> =PublishDecline%>" tabindex="13" style="text-align:
> center; font-size:
> 2mm">
> </td>
> </tr>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
Message #3 by Colin.Montgomery@C... on Wed, 12 Feb 2003 15:47:06 -0000
|
|
check for it being True in your database and if so add the CHECKED keyword
to the <INPUT...> tag like so:
<form>
<input type="checkbox" name="large" checked>Large
<br>
<input type="checkbox" name="small">Small
</form>
In the above example the first checkbox will be checked. You might want to
just do a reponse.write of the field in your database to see what it's
holding/returning. I.e. it might return True, Yes or 1 etc.
This will depend on your DB, provider etc.
HTH,
Col
-----Original Message-----
From: Rich Hoffmann [mailto:rich@h...]
Sent: 12 February 2003 15:41
To: ASP Databases
Subject: [asp_databases] Load default value into check box from database
I am creating a member profile page for members to be able to modify. I
do a SELECT into an access database and then load a table with the
results. All the text boxes fill in with the data from the database for
the member to review/modify, but the check boxes will only display the
default value specified in Front Page Check Box Properties...they will not
update with the database field value. I have several of these fields that
need to be 1 for checked and 0 for not checked. What am I missing???
Check box program:
<tr>
<td width="250" bgcolor="#808080" align="right" bordercolor="#000000">
Publish Information in Members' Directory?</td>
<td width="303">
<input type="checkbox" name="PublishDecline" value="<%
=PublishDecline%>" tabindex="13" style="text-align: center; font-size:
2mm">
</td>
</tr>
*******
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the
intended recipient, please telephone or email the sender and delete this message and any attachment from your system. If you are
not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.
For further information about Clifford Chance please see our website at http://www.cliffordchance.com or refer to any Clifford
Chance office.
Message #4 by "Rich Hoffmann" <rich@h...> on Wed, 12 Feb 2003 17:20:18
|
|
Thanks Mark and Colin. I appreciate the help!!!
Message #5 by "Rich Hoffmann" <rich@h...> on Wed, 12 Feb 2003 19:19:44
|
|
This code gets the check boxes to display correctly on load. However, I
also need the operator to be able to check or uncheck the box and get the
correct value to POST on a SUBMIT. This does not appear to be working
properly. I notice there is no "name" given in this example. Also, is
this server or browser side code?
> Setting the value to 0 or 1 will not check the box.
You need to do something like this:
if PublishDecline = 0 then
<input type="checkbox" value="0" checked>
<input type="checkbox" value="1">
else
<input type="checkbox" value="0">
<input type="checkbox" value="1" checked>
end if
Mark.
--- Rich Hoffmann <rich@h...>
wrote:
> I am creating a member profile page for members to
> be able to modify. I
> do a SELECT into an access database and then load a
> table with the
> results. All the text boxes fill in with the data
> from the database for
> the member to review/modify, but the check boxes
> will only display the
> default value specified in Front Page Check Box
> Properties...they will not
> update with the database field value. I have
> several of these fields that
> need to be 1 for checked and 0 for not checked.
> What am I missing???
>
> Check box program:
>
> <tr>
> <td width="250" bgcolor="#808080" align="right"
> bordercolor="#000000">
> Publish Information in Members'
> Directory?</td>
> <td width="303">
> <input type="checkbox" name="PublishDecline"
> value="<%
> =PublishDecline%>" tabindex="13" style="text-align:
> center; font-size:
> 2mm">
> </td>
> </tr>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
Message #6 by "Drew, Ron" <RDrew@B...> on Wed, 12 Feb 2003 15:14:56 -0500
|
|
Give the <input> a name for each and the post should work.
Both client and server code
-----Original Message-----
From: Rich Hoffmann [mailto:rich@h...]
Sent: Wednesday, February 12, 2003 2:20 PM
To: ASP Databases
Subject: [asp_databases] Re: Load default value into check box from
database
This code gets the check boxes to display correctly on load. However, I
also need the operator to be able to check or uncheck the box and get
the
correct value to POST on a SUBMIT. This does not appear to be working
properly. I notice there is no "name" given in this example. Also, is
this server or browser side code?
> Setting the value to 0 or 1 will not check the box.
You need to do something like this:
if PublishDecline =3D 0 then
<input type=3D"checkbox" value=3D"0" checked>
<input type=3D"checkbox" value=3D"1">
else
<input type=3D"checkbox" value=3D"0">
<input type=3D"checkbox" value=3D"1" checked>
end if
Mark.
--- Rich Hoffmann <rich@h...>
wrote:
> I am creating a member profile page for members to
> be able to modify. I
> do a SELECT into an access database and then load a
> table with the
> results. All the text boxes fill in with the data
> from the database for
> the member to review/modify, but the check boxes
> will only display the
> default value specified in Front Page Check Box
> Properties...they will not
> update with the database field value. I have
> several of these fields that
> need to be 1 for checked and 0 for not checked.
> What am I missing???
>
> Check box program:
>
> <tr>
> <td width=3D"250" bgcolor=3D"#808080" align=3D"right"
> bordercolor=3D"#000000">
> Publish Information in Members'
> Directory?</td>
> <td width=3D"303">
> <input type=3D"checkbox" name=3D"PublishDecline"
> value=3D"<%
> =3DPublishDecline%>" tabindex=3D"13" style=3D"text-align:
> center; font-size:
> 2mm">
> </td>
> </tr>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
Message #7 by Mark Eckeard <meckeard2000@y...> on Wed, 12 Feb 2003 12:54:37 -0800 (PST)
|
|
Rich,
Sorry, it's server-side (asp). In my attempt to be
brief, I should have stated that.
<%
if PublishDecline = 0 then
response.write("<input type=""checkbox""
name=""Chkbox1"" value=""0"" checked>")
response.write("<input type=""checkbox""
name=""Chkbox1"" value=""1"">")
else
response.write("<input type=""checkbox""
name=""Chkbox1"" value=""0"">")
response.write("<input type=""checkbox""
name=""Chkbox1"" value=""1"" checked>")
end if
%>
--- Rich Hoffmann <rich@h...>
wrote:
> This code gets the check boxes to display correctly
> on load. However, I
> also need the operator to be able to check or
> uncheck the box and get the
> correct value to POST on a SUBMIT. This does not
> appear to be working
> properly. I notice there is no "name" given in this
> example. Also, is
> this server or browser side code?
>
> > Setting the value to 0 or 1 will not check the
> box.
> You need to do something like this:
>
> if PublishDecline = 0 then
> <input type="checkbox" value="0" checked>
> <input type="checkbox" value="1">
> else
> <input type="checkbox" value="0">
> <input type="checkbox" value="1" checked>
> end if
>
> Mark.
> --- Rich Hoffmann <rich@h...>
> wrote:
> > I am creating a member profile page for members to
> > be able to modify. I
> > do a SELECT into an access database and then load
> a
> > table with the
> > results. All the text boxes fill in with the data
> > from the database for
> > the member to review/modify, but the check boxes
> > will only display the
> > default value specified in Front Page Check Box
> > Properties...they will not
> > update with the database field value. I have
> > several of these fields that
> > need to be 1 for checked and 0 for not checked.
> > What am I missing???
> >
> > Check box program:
> >
> > <tr>
> > <td width="250" bgcolor="#808080" align="right"
> > bordercolor="#000000">
> > Publish Information in Members'
> > Directory?</td>
> > <td width="303">
> > <input type="checkbox" name="PublishDecline"
> > value="<%
> > =PublishDecline%>" tabindex="13"
> style="text-align:
> > center; font-size:
> > 2mm">
> > </td>
> > </tr>
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
|
|
 |