Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 20th, 2007, 08:24 PM
Registered User
 
Join Date: May 2007
Location: , , Malaysia.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Selected value from dropdown menu wont display.

Hey people.

I'm baffled by this because it would seem a simple enough problem and yet I've been at it for a few days now.
The code below is supposed to display a value from the database, on the selection of a value in a drop down menu. Basically, if name is chosen from the drop down menu field (also extracted from db) then the department of the person selected should appear.
The department does appear, but the name of the selected person does not.
And when this code is used a few times in the same form, all the selected values in the different drop down menu dont appear.
If i use onchange, it refreshes the entire page and all the other selections made are lost (ie- checkboxes/text input etc).

The code is-

<TR class=colheader >
<td colspan=6 CLASS=template >Postage Mode:</td>
<tr class = form>
<TD> </TD>

<td valign=top>
<input type="radio" name="postmode" value="Normal" checked> Normal<br>
Franked by:
                    <%
                    Response.Write "<select name='lstName' >"
                    Response.Write "<OPTION value=-1>---Select one---" & "</OPTION>"
                    strfields = cstnewpic
                    set obj = objHR.RunQuery(tbpicm ,strfields)
                        if obj.recordcount then
                            obj.movefirst
                                for i =0 to obj.recordcount-1
                                    if strname = obj(cstnewpic ) then
                                        Response.Write "<option value ='" & obj(cstnewpic ) & "'>" & obj(cstnewpic ) & "</option>"
                                    else
                                        Response.Write "<option value ='" & obj(cstnewpic ) & "'>" & obj(cstnewpic ) & "</option>"
                                    end if
                            obj.movenext
                                next
                        end if
                    obj.close

                    Response.Write "</select>"

                    %>

      <br>

<input type="radio" name="postmode" value="arreg">AR Registered<br>
<input type="radio" name="postmode" value="poslaju">Pos Laju<br>
<input type="radio" name="postmode" value="other">Others<br>
<i>Please specify:</i>
<input name="specify"><br>

</td>
</tr>

<TR class=form>
    <TD class ="" width="20%">Remarks:</TD>
    <TD border="1" width="85%" class=normal>
    <input name="time" size="100" ></TD>
</TR>

<TR class=colheader >
<td colspan=6 CLASS=template >Senders Details</td>
<tr class = form>
<TR class=form>
    <TD class ="" width="20%">Requester Name:</TD>
<td>
<%
                    Response.Write "<select name='requester' onselect='document.frmPost.submit();' >"
                    Response.Write "<OPTION value=-1>---Select one---" & "</OPTION>"
                    strfields = cstName
                    set obj = objCESB.RunQuery(tbHRMS,strfields)
                        if obj.recordcount then
                            obj.movefirst
                                for i =0 to obj.recordcount-1
                                    if strname = obj(cstName ) then
                                        Response.Write "<option value ='" & obj(cstName ) & "'>" & obj(cstName ) & "</option>"
                                    else
                                        Response.Write "<option value ='" & obj(cstName ) & "'>" & obj(cstName ) & "</option>"
                                    end if
                            obj.movenext
                                next
                        end if
                    obj.close

                    Response.Write "</select>"

%>
</td>
</TR>

<TR class=form>
    <TD class ="" width="20%">Department: </TD>
    <td>
    <%
    strwhere = cstName &"='"& strR &"'"
                    set obj = objCESB.RunQuery(tbHRMS,cstDept,strwhere)

                    if obj.recordcount then
                        for i =0 to obj.recordcount-1
                        Response.Write obj(cstDept)
                    Next
                    i = 1
                    end if
  %>
 </td>
 </TR>

<TR class=form>
    <TD class ="" width="20%">Date
 </TD>

    <TD border="1" width="85%" class=normal>
    <input name="time" style="WIDTH: 160px; HEIGHT: 22px"></TD>
</TR>
<TR class=form>
    <TD class ="" width="20%">Time: </TD>
    <TD border="1" width="85%" class=normal>
    <input name="time" style="WIDTH: 161px; HEIGHT: 22px"></TD>
</TR>
<TR class=form>
    <TD class ="" width="20%">Telephone Ext:
 </TD>
 <td border="1" width="85%" class=normal>
 <input name="time" style="WIDTH: 161px; HEIGHT: 22px"></td>
 </TR>
 <TR class=form>
    <TD class ="" width="20%">Cost Center:
 </TD>
 <td> </td>
 </TR>
 <TR class=form>
    <TD class ="" width="20%">Remarks </TD>
  <TD border="1" width="85%" class=normal>
    <input name="time" size="100" ></TD>
</TR>
<TR class=colheader >
<td colspan=6 CLASS=template >Postage Information Details</td>
<tr class = form>
<td class ="" width="20%"> Company name: </td>
<td>
<%
                    Response.Write "<select name='compadd' onchange='document.frmPost.submit();' >"
                    Response.Write "<OPTION value=-1>---Select one---" & "</OPTION>"
                    strfields = cstVcomp
                    set obj = objVmaster.RunQuery(tbVmaster,strfields)
                        if obj.recordcount then
                            obj.movefirst
                                for i =0 to obj.recordcount-1
                                    if strname = obj(cstVcomp ) then
                                        Response.Write "<option value ='" & obj(cstVcomp ) & "'>" & obj(cstVcomp ) & "</option>"
                                    else
                                        Response.Write "<option value ='" & obj(cstVcomp ) & "'>" & obj(cstVcomp ) & "</option>"
                                    end if
                            obj.movenext
                                next
                        end if
                    obj.close

                    Response.Write "</select>"

%>
</td></tr>

<tr class=form>
<td class ="" width="20%">Company Address: </td>
<td>
<%
                    strfields = cstVaddr & "," & cstVaddr2
                    strwhere = cstVcomp &"='"& strCO &"'"
                    set obj = objVmaster.RunQuery(tbVmaster,strfields,strwhere)

                    if obj.recordcount then
                        for i =0 to obj.recordcount-1
                        Response.Write obj(cstVaddr)
                        'Response.Write obj(cstVaddr2)
                    Next
                    'i = 1
                    end if
  %>

</td></tr>

<tr class=form>
<td class ="" width="20%">Cheque: </td>
<td valign=top>
<input type="radio" name="cheque" value="Yes" checked> Yes <br>
<input type="radio" name="cheque" value="No">No<br>
</td>
</tr>

<tr class=form>
<td class ="" width="20%">Cost of Postage: </td>
<TD border="1" width="85%" class=normal>
    <input name="time"
    style="WIDTH: 163px; HEIGHT: 22px" size=19></TD></tr>
<tr class=form>
<td class ="" width="20%">Remarks: </td>
<TD border="1" width="85%" class=normal>
    <input name="time" size="100" ></TD>
</tr>

I'd appreciate any help or pointers. Im a bit too new to at ASP. Thanks.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB6 wont display crystal Reports 10.0 cnobles VB How-To 2 September 7th, 2014 09:21 AM
How to highlight selected dropdown values. sheetm J2EE 0 June 5th, 2007 05:04 AM
selected item in dropdown not saved on postback rathbird ADO.NET 3 March 6th, 2006 08:44 AM
Getting selected item in dropdown to match XML juliaPGATOUR XSLT 1 December 11th, 2003 05:56 AM
Title: dropdown list as selected according to the san_only ASP.NET 1.x and 2.0 Application Design 1 June 4th, 2003 01:55 AM



All times are GMT -4. The time now is 05:15 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.