468,510 Members | 1,687 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,510 developers. It's quick & easy.

Problem in Response.write statement to retrieve a field in a check

Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a database.
The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving the values, the FinalUpdate field value is not showing up as
it should. e.g.
if for the record the database has a checked field for FinalUpdate(i.e. yes)
then the
chkFinalUpdate checkbox in the form should be checked. Instead it shows
unchecked. I
believe the code to retrive the value of the final update field is not
correct.

Any help is appreciated here for problem resolution. Regards

RELEVANT CODE:

<%

'Declare variables to store field values

Dim l_ColorPreference
Dim l_FoodPreference
Dim l_FinalUpdate

'Get all the fields from the database in the above variable
l_ColorPreference = RS.Fields("ColorPreference")
l_FoodPreference = RS.Fields("FoodPreference")
l_FinalUpdate = Rs.Fields("FinalUpdate")
%>

<!--In the HTML part display the values with proper formatting__>

<td>Color Preference</td>
<td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
"<%Response.Write l_ColorPreference%>"></td>

<td>Food Preference</td>
<td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
"<%Response.Write l_FoodPreference%>"></td>
</tr>

<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write
CInt(l_FinalUpdate)%>"></td>
</tr>
Jul 22 '05 #1
8 2378
chkFinalUpdate should be checked, what, if l_FinalUpdate is greater than 0
or something along those lines? If so, you have to put in logic to check to
see if the value is greater than zero, and if it is, include
checked[="checked"] in your HTML.
<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CInt(l_FinalUpdate) > 0 Then
Response.Write " checked"%>>

Ray at work
"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a database. The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving the values, the FinalUpdate field value is not showing up as it should. e.g.
if for the record the database has a checked field for FinalUpdate(i.e. yes) then the
chkFinalUpdate checkbox in the form should be checked. Instead it shows
unchecked. I
believe the code to retrive the value of the final update field is not
correct.

Any help is appreciated here for problem resolution. Regards

RELEVANT CODE:

<%

'Declare variables to store field values

Dim l_ColorPreference
Dim l_FoodPreference
Dim l_FinalUpdate

'Get all the fields from the database in the above variable
l_ColorPreference = RS.Fields("ColorPreference")
l_FoodPreference = RS.Fields("FoodPreference")
l_FinalUpdate = Rs.Fields("FinalUpdate")
%>

<!--In the HTML part display the values with proper formatting__>

<td>Color Preference</td>
<td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
"<%Response.Write l_ColorPreference%>"></td>

<td>Food Preference</td>
<td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
"<%Response.Write l_FoodPreference%>"></td>
</tr>

<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write
CInt(l_FinalUpdate)%>"></td>
</tr>

Jul 22 '05 #2
Thanks a lot for the help, Ray. I used the following code as per your advise
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE=
"<%=CInt(l_FinalUpdate)%>"<%If CInt(l_FinalUpdate) > 0 Then Response.Write
"checked"%>></td>

However, when the form is displayed, the form is still not displaying the
check box as checked. Earlier, I tried to see what value the variable
i_finalupdate is fetching. It is fetching a value of 1, as it should. Any
idea, why this code is not displayin the check on the check box field? Thanks
again.

"Ray Costanzo [MVP]" wrote:
chkFinalUpdate should be checked, what, if l_FinalUpdate is greater than 0
or something along those lines? If so, you have to put in logic to check to
see if the value is greater than zero, and if it is, include
checked[="checked"] in your HTML.
<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CInt(l_FinalUpdate) > 0 Then
Response.Write " checked"%>>

Ray at work
"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a

database.
The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving the values, the FinalUpdate field value is not showing up

as
it should. e.g.
if for the record the database has a checked field for FinalUpdate(i.e.

yes)
then the
chkFinalUpdate checkbox in the form should be checked. Instead it shows
unchecked. I
believe the code to retrive the value of the final update field is not
correct.

Any help is appreciated here for problem resolution. Regards

RELEVANT CODE:

<%

'Declare variables to store field values

Dim l_ColorPreference
Dim l_FoodPreference
Dim l_FinalUpdate

'Get all the fields from the database in the above variable
l_ColorPreference = RS.Fields("ColorPreference")
l_FoodPreference = RS.Fields("FoodPreference")
l_FinalUpdate = Rs.Fields("FinalUpdate")
%>

<!--In the HTML part display the values with proper formatting__>

<td>Color Preference</td>
<td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
"<%Response.Write l_ColorPreference%>"></td>

<td>Food Preference</td>
<td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
"<%Response.Write l_FoodPreference%>"></td>
</tr>

<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write
CInt(l_FinalUpdate)%>"></td>
</tr>


Jul 22 '05 #3
Did you include a space in " checked" as I did in my code? What does a
View-Source reveal?

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Thanks a lot for the help, Ray. I used the following code as per your advise <td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE=
"<%=CInt(l_FinalUpdate)%>"<%If CInt(l_FinalUpdate) > 0 Then Response.Write
"checked"%>></td>

However, when the form is displayed, the form is still not displaying the
check box as checked. Earlier, I tried to see what value the variable
i_finalupdate is fetching. It is fetching a value of 1, as it should. Any
idea, why this code is not displayin the check on the check box field? Thanks again.

"Ray Costanzo [MVP]" wrote:
chkFinalUpdate should be checked, what, if l_FinalUpdate is greater than 0 or something along those lines? If so, you have to put in logic to check to see if the value is greater than zero, and if it is, include
checked[="checked"] in your HTML.
<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CInt(l_FinalUpdate) > 0 Then
Response.Write " checked"%>>

Ray at work
"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a

database.
The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving the values, the FinalUpdate field value is not showing up
as
it should. e.g.
if for the record the database has a checked field for
FinalUpdate(i.e. yes)
then the
chkFinalUpdate checkbox in the form should be checked. Instead it

shows unchecked. I
believe the code to retrive the value of the final update field is not
correct.

Any help is appreciated here for problem resolution. Regards

RELEVANT CODE:

<%

'Declare variables to store field values

Dim l_ColorPreference
Dim l_FoodPreference
Dim l_FinalUpdate

'Get all the fields from the database in the above variable
l_ColorPreference = RS.Fields("ColorPreference")
l_FoodPreference = RS.Fields("FoodPreference")
l_FinalUpdate = Rs.Fields("FinalUpdate")
%>

<!--In the HTML part display the values with proper formatting__>

<td>Color Preference</td>
<td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
"<%Response.Write l_ColorPreference%>"></td>

<td>Food Preference</td>
<td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
"<%Response.Write l_FoodPreference%>"></td>
</tr>

<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write CInt(l_FinalUpdate)%>"></td>
</tr>


Jul 22 '05 #4
The following is the view source result:

<tr>
<td><input TYPE="SUBMIT" NAME="btnSubmit" VALUE="SUBMIT"></td>
</tr>
This shows no value in the above.
Now, when I did a response.write l_finalupdate where this is the variable to
which
the value of Rs.Fields("FinalUpdate") is assigned, it gives a True results
instead of 1.
Any further thoughts. Thanks.

"Ray Costanzo [MVP]" wrote:
Did you include a space in " checked" as I did in my code? What does a
View-Source reveal?

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Thanks a lot for the help, Ray. I used the following code as per your

advise
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE=
"<%=CInt(l_FinalUpdate)%>"<%If CInt(l_FinalUpdate) > 0 Then Response.Write
"checked"%>></td>

However, when the form is displayed, the form is still not displaying the
check box as checked. Earlier, I tried to see what value the variable
i_finalupdate is fetching. It is fetching a value of 1, as it should. Any
idea, why this code is not displayin the check on the check box field?

Thanks
again.

"Ray Costanzo [MVP]" wrote:
chkFinalUpdate should be checked, what, if l_FinalUpdate is greater than 0 or something along those lines? If so, you have to put in logic to check to see if the value is greater than zero, and if it is, include
checked[="checked"] in your HTML.
<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CInt(l_FinalUpdate) > 0 Then
Response.Write " checked"%>>

Ray at work
"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
> Hi,
> Here is my problem:
>
> I am logging in to a page, where the page retrieves a record from a
database.
> The text boxes are used in the display formto let the users update the
> fields,
> if they desire to.
>
> The colorpreference and foodpreference fields are text fields
> while the FinalUpdate field is a yes/no field in Access Database.
>
> While retieving the values, the FinalUpdate field value is not showing up as
> it should. e.g.
> if for the record the database has a checked field for FinalUpdate(i.e. yes)
> then the
> chkFinalUpdate checkbox in the form should be checked. Instead it shows > unchecked. I
> believe the code to retrive the value of the final update field is not
> correct.
>
> Any help is appreciated here for problem resolution. Regards
>
> RELEVANT CODE:
>
> <%
>
> 'Declare variables to store field values
>
> Dim l_ColorPreference
> Dim l_FoodPreference
> Dim l_FinalUpdate
>
> 'Get all the fields from the database in the above variable
>
>
> l_ColorPreference = RS.Fields("ColorPreference")
> l_FoodPreference = RS.Fields("FoodPreference")
> l_FinalUpdate = Rs.Fields("FinalUpdate")
> %>
>
> <!--In the HTML part display the values with proper formatting__>
>
> <td>Color Preference</td>
> <td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
> "<%Response.Write l_ColorPreference%>"></td>
>
> <td>Food Preference</td>
> <td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
> "<%Response.Write l_FoodPreference%>"></td>
> </tr>
>
> <tr>
> <td>FinalUpdate</td>
> <td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write > CInt(l_FinalUpdate)%>"></td>
> </tr>


Jul 22 '05 #5
You posted the view-source snippet for your submit button, not the checkbox
in question...

As far as the true/false, that's fine, but you were CInt'ing the value
before.

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
The following is the view source result:

<tr>
<td><input TYPE="SUBMIT" NAME="btnSubmit" VALUE="SUBMIT"></td>
</tr>
This shows no value in the above.
Now, when I did a response.write l_finalupdate where this is the variable to which
the value of Rs.Fields("FinalUpdate") is assigned, it gives a True results
instead of 1.
Any further thoughts. Thanks.

"Ray Costanzo [MVP]" wrote:
Did you include a space in " checked" as I did in my code? What does a
View-Source reveal?

Ray at work

Jul 22 '05 #6
Sorry for the screw up. The view source shows as follows:
<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "-1"></td>
</tr>
You are right that I did CInt previously. I must have chagned code and it
got dropped. When I put CInt(l_finalupdate) and wrote a response.write, then
it gave me a -1. I checked the value in the back-end and it shows checked in
the field.
Thanks.

"Jack" wrote:
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a database.
The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving the values, the FinalUpdate field value is not showing up as
it should. e.g.
if for the record the database has a checked field for FinalUpdate(i.e. yes)
then the
chkFinalUpdate checkbox in the form should be checked. Instead it shows
unchecked. I
believe the code to retrive the value of the final update field is not
correct.

Any help is appreciated here for problem resolution. Regards

RELEVANT CODE:

<%

'Declare variables to store field values

Dim l_ColorPreference
Dim l_FoodPreference
Dim l_FinalUpdate

'Get all the fields from the database in the above variable
l_ColorPreference = RS.Fields("ColorPreference")
l_FoodPreference = RS.Fields("FoodPreference")
l_FinalUpdate = Rs.Fields("FinalUpdate")
%>

<!--In the HTML part display the values with proper formatting__>

<td>Color Preference</td>
<td><input TYPE="text" NAME="txtColorPref" SIZE="15" value =
"<%Response.Write l_ColorPreference%>"></td>

<td>Food Preference</td>
<td><input TYPE="text" NAME="txtFoodPref" SIZE="15"value =
"<%Response.Write l_FoodPreference%>"></td>
</tr>

<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "<%Response.Write
CInt(l_FinalUpdate)%>"></td>
</tr>

Jul 22 '05 #7
Well, obviously -1 is not greater than 0... CBool it.

<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CBool(l_FinalUpdate) Then
Response.Write " checked"%>>

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:34**********************************@microsof t.com...
Sorry for the screw up. The view source shows as follows:
<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "-1"></td>
</tr>
You are right that I did CInt previously. I must have chagned code and it
got dropped. When I put CInt(l_finalupdate) and wrote a response.write, then it gave me a -1. I checked the value in the back-end and it shows checked in the field.
Thanks.

"Jack" wrote:
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a database. The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving t

Jul 22 '05 #8
Ray, it works now. Many thanks for this. Regards.

"Ray Costanzo [MVP]" wrote:
Well, obviously -1 is not greater than 0... CBool it.

<input TYPE="checkbox" NAME="chkFinalUpdate"
VALUE="<%=CInt(l_FinalUpdate)%>"<% If CBool(l_FinalUpdate) Then
Response.Write " checked"%>>

Ray at work

"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:34**********************************@microsof t.com...
Sorry for the screw up. The view source shows as follows:
<tr>
<td>FinalUpdate</td>
<td><input TYPE="checkbox" NAME="chkFinalUpdate" VALUE= "-1"></td>
</tr>
You are right that I did CInt previously. I must have chagned code and it
got dropped. When I put CInt(l_finalupdate) and wrote a response.write,

then
it gave me a -1. I checked the value in the back-end and it shows checked

in
the field.
Thanks.

"Jack" wrote:
Hi,
Here is my problem:

I am logging in to a page, where the page retrieves a record from a database. The text boxes are used in the display formto let the users update the
fields,
if they desire to.

The colorpreference and foodpreference fields are text fields
while the FinalUpdate field is a yes/no field in Access Database.

While retieving t


Jul 22 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

38 posts views Thread by jrlen balane | last post: by
5 posts views Thread by Raphael Gluck | last post: by
17 posts views Thread by Newbie | last post: by
reply views Thread by Jack | last post: by
7 posts views Thread by David Shorthouse | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.