473,397 Members | 1,972 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,397 software developers and data experts.

ASP option box secondary value update other field?

I am building a site using ASP and some javascript (to make data entry
easier). I use ASP to create a recordset consisting of ProjectID,
ProjectName, and ProjectMileageRate, and the option box is built from the
recordset. I would like for the txtBillingItemMileageRate field on the form
to be populated with the ProjectMileageRate based on the ProjectID selected
in the combo box. I have experimented enough to see that I can mix ASP and
Javascript as in the following (it is currently triggered by a hyperlink for
experimentation purposes):

function jsUpdateMileageRate() {
document.frmBillingEntries.txtBillingItemMileageRa te.value =
<%=rsUserProjects("ProjectMileageRate")%> ;

}

This function works fine, except that it is simply taking the first
ProjectMileageRate of the recordset.

The following is the code used to create the recordset and option box.

<td width="25%"><font size="2"><select size="1" name="optProject"
onBlur="javascript:jsUpdateTotals()" style="text-align: left; float: left;
font: 10">
<%
SET conn = server.createobject ("adodb.connection")
conn.open "DSN=" & Session("DSN")

SET rsUserProjects = Server.CreateObject("ADODB.Recordset")
rsUserProjects.CursorLocation = 3

strSQL = "SELECT tblUserProjectAuthority.UserID, tblProjects.ProjectName,
tblProjects.ProjectMileageRate," _
& "tblUserProjectAuthority.ProjectID,
tblUserProjectAuthority.UserProjectActive " _
& "FROM tblProjects INNER JOIN tblUserProjectAuthority ON " _
& "tblProjects.ProjectID = tblUserProjectAuthority.ProjectID " _
& "WHERE (((tblUserProjectAuthority.UserID)='" & Session("UserID") & "') AND
" _
& "((tblUserProjectAuthority.UserProjectActive)=True ));"

rsUserProjects.open strSQL,conn

do until rsUserProjects.EOF
%>
<option
<%=rsUserProjects("ProjectID")%>><%=rsUserProjects ("ProjectName")%></option>
<%
rsUserProjects.MOVENEXT
LOOP
%>
</select></font></td>
</tr>

<%
rsUserProjects.CLOSE
SET rsUserProjects = NOTHING
%>

Is there a way to populate the txtBillingItemMileageRate field with the
mileage rate associated with the selected Project? If so, please advise.

Also, I would appreciate any constructive criticism of the existing code.

Thanks
Jul 19 '05 #1
3 1624

"WC Justice" <WC*****@bellsouth.net> wrote in message
news:Dt******************@bignews3.bellsouth.net.. .
I am building a site using ASP and some javascript (to make data entry
easier). I use ASP to create a recordset consisting of ProjectID,
ProjectName, and ProjectMileageRate, and the option box is built from the
recordset. I would like for the txtBillingItemMileageRate field on the
form
to be populated with the ProjectMileageRate based on the ProjectID
selected
in the combo box. I have experimented enough to see that I can mix ASP
and
Javascript as in the following (it is currently triggered by a hyperlink
for
experimentation purposes):

function jsUpdateMileageRate() {
document.frmBillingEntries.txtBillingItemMileageRa te.value =
<%=rsUserProjects("ProjectMileageRate")%> ;

}

This function works fine, except that it is simply taking the first
ProjectMileageRate of the recordset.


This is the be expected, because remember, ASP runs on the server and then
delivers the result to the browser. The recordset object that you're
creating exists in the server's memory, and the javascript function runs in
the browser.

You will either have to dump your recordset values into a javascript array
so that the browser can see those values, or you will have to re-hit the
server to get the new updated value.

See here for some options: http://www.aspfaq.com/show.asp?id=2270

Ray at work
Jul 19 '05 #2
Thanks, I'll check it out.
"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:OR****************@TK2MSFTNGP10.phx.gbl...

"WC Justice" <WC*****@bellsouth.net> wrote in message
news:Dt******************@bignews3.bellsouth.net.. .
I am building a site using ASP and some javascript (to make data entry
easier). I use ASP to create a recordset consisting of ProjectID,
ProjectName, and ProjectMileageRate, and the option box is built from the recordset. I would like for the txtBillingItemMileageRate field on the
form
to be populated with the ProjectMileageRate based on the ProjectID
selected
in the combo box. I have experimented enough to see that I can mix ASP
and
Javascript as in the following (it is currently triggered by a hyperlink
for
experimentation purposes):

function jsUpdateMileageRate() {
document.frmBillingEntries.txtBillingItemMileageRa te.value =
<%=rsUserProjects("ProjectMileageRate")%> ;

}

This function works fine, except that it is simply taking the first
ProjectMileageRate of the recordset.
This is the be expected, because remember, ASP runs on the server and then
delivers the result to the browser. The recordset object that you're
creating exists in the server's memory, and the javascript function runs

in the browser.

You will either have to dump your recordset values into a javascript array
so that the browser can see those values, or you will have to re-hit the
server to get the new updated value.

See here for some options: http://www.aspfaq.com/show.asp?id=2270

Ray at work

Jul 19 '05 #3
Thanks, I'll check it out.
"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:OR****************@TK2MSFTNGP10.phx.gbl...

"WC Justice" <WC*****@bellsouth.net> wrote in message
news:Dt******************@bignews3.bellsouth.net.. .
I am building a site using ASP and some javascript (to make data entry
easier). I use ASP to create a recordset consisting of ProjectID,
ProjectName, and ProjectMileageRate, and the option box is built from the recordset. I would like for the txtBillingItemMileageRate field on the
form
to be populated with the ProjectMileageRate based on the ProjectID
selected
in the combo box. I have experimented enough to see that I can mix ASP
and
Javascript as in the following (it is currently triggered by a hyperlink
for
experimentation purposes):

function jsUpdateMileageRate() {
document.frmBillingEntries.txtBillingItemMileageRa te.value =
<%=rsUserProjects("ProjectMileageRate")%> ;

}

This function works fine, except that it is simply taking the first
ProjectMileageRate of the recordset.
This is the be expected, because remember, ASP runs on the server and then
delivers the result to the browser. The recordset object that you're
creating exists in the server's memory, and the javascript function runs

in the browser.

You will either have to dump your recordset values into a javascript array
so that the browser can see those values, or you will have to re-hit the
server to get the new updated value.

See here for some options: http://www.aspfaq.com/show.asp?id=2270

Ray at work

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: pearl | last post by:
We have a primary OWA (5.5) server and a secondary OWA server. The primary OWA server's change password option truncates first letter of the username when prompted. The secondary OWA server does...
4
by: Mark Kolber | last post by:
I did a little searching on this but couldn't find an answer... On my website, I have a section of stories (www.midlifeflight.com/stories) There are different stores on different pages that are...
3
by: Bill Clark | last post by:
I have about 20,000 records pulled from Excel that I need to update. What I need to do is run an update query that bascially says: If a field is null, update it with the previous record value of...
1
by: Liz Malcolm | last post by:
Hello and TIA. I have a DE form with an option group that if daily is selected todays date is used for start and end date, if weekly is selected Monday - Friday is used. I am trying to add a...
2
by: BG | last post by:
We're having trouble writing the code to update a UI control (label.Text) from a secondary thread. We're using C# with Windows Forms. We have a main form named MainForm, a splash screen form...
1
by: ollielaroo | last post by:
Hi guys, Firstly I did do a search for this one first but I couldn't find anything related in this forum. I am using Dreamweaver MX and trying to build admin pages for an ASP site. My problem is...
20
idsanjeev
by: idsanjeev | last post by:
hello i want to modify multiple rows in database with select option i am using R.update but it can update only one record in database but i wants to more then one record is modify after submit so...
1
flexsingh
by: flexsingh | last post by:
Hello there I have kinda got gotten myself into a sticky situation. I am trying to do something which seams too big to do in my head but I feel I kinda know how to do it. My problem is I have a...
4
by: JHite | last post by:
I am using Access 2003 on Windows XP. This is a simple database that contains “tblStaffers” containing names of the office staffers, “tblProjects” containing names of the office projects, and...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.