473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 2585
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: jrlen balane | last post by:
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser =...
4
by: JP SIngh | last post by:
Thanks to Manohar for writing the basic code for displaying the managers and the employees in a tree like structure. I have adapted the code below but it gives me an error "exception occcured"...
5
by: Raphael Gluck | last post by:
Hi I'm fairly new to coding in asp and i'm trying to create a simple if.. else... condition It's for asp web page, and is linked to my database, but i figured since it's a basic question, it...
17
by: Newbie | last post by:
Dear friends, I am having a hard time understanding how to use a SELECT CASE in ASP. I have used it in VB but never in ASP scripting. Scenerio: I have 2 textboxes on a form that I have to...
0
by: Jack | last post by:
I am trying to debug a if else statement by using the following lines of code Response.Write RSreccountCurrentExpense("reccount") & "<br>" If RSreccountCurrentExpense("reccount") < 1 Then...
7
by: David Shorthouse | last post by:
I am attempting to create a "new account creation" asp, but would ideally like the routine to check the Access db for an existing email address and username (called UID below). The select query...
1
by: Steve | last post by:
HI I've run into a big problem I placed my webpage scripting in the code behind here i put out form tags with table linement stufffffffffffffff Response.Write("<form method=post...
5
by: znubbe | last post by:
Hi, I hope anyone can help me with this problem. I have a field of image type in a SQL 2000 database. I'm using this code to insert a document: Dim conn Dim rs Dim oStream
1
by: vinodkus | last post by:
vinod...@gmail.com wrote: Please stop shouting. Total records?? I think (hope) you mean "count of the total records". In
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.