 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 14th, 2006, 03:03 AM
|
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i'm sorry, but the server i'm given is very out of date and your connection settings cant work. As such, I have to use my connection settings to connect to the database.
If so, is it still possible to use the subsequent codes that you have suggested to achieve what is required?
|
|

January 14th, 2006, 10:21 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
mmmm, interesting.
yes it will work. All you need to do is connect and execute statements,
it does not matter how you connect. I have given you the code to solve your
problem. Look at my first post, all it requires is for you to run 2 sql statements,
get the records and populate your combo boxes. Obviously if you choose to name
your record set something other than getInfo (what I called them) you will need to
find and replace, etc ...
Wind is your friend
Matt
|
|

January 16th, 2006, 02:24 PM
|
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi, it worked.. thanks for your help
but my project's specs have changed slightly.
the combo boxes i mentioned are used on a search page where the inputs are passed into SQL statements to retrieve the data from the database.
therefore the choices in each combo box have changed slightly.
on level 1, there are 3 entries:A,B,C, ALL
on level 2, the entries are tied to one of the entries in level 1, ie those in level 2 will be A.1, A.2, A.3, B.1,B.2,C.1,C.2, ALL....
on level 3, the entries are tied to one of the entries in level 2, ie those in level 3 will be A.1.1, A.1.2, A.1.3, A.2.1,A.2.2,B.1.2,C.2.1, ALL.....
as such, i tried but cant really get the function to work.
any suggestion how to amend the code to cater for this?
|
|

January 16th, 2006, 07:08 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
This is a physical change. Logically there is no change. You say your previous problem
is solved - If so you have your solution in front of you. have a go, when you
run into a specific problem, post it including the information I asked of you during
this post.
This place will work better for you if its clear youve had a go and are not here to get
code written. You should also read replies to your posts and address all questions, these
are being asked for a reason and are fundamental to your solution.
Wind is your friend
Matt
|
|

January 17th, 2006, 11:41 PM
|
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
may i find out how do i retain the values on the drop down box when i submit the form?
Code:
<tr>
<TD align=right width="28%">Requirement Classification Level 2 </TD>
<TD width="54%">
<SELECT size=1 name=SearchClass1 onchange="frmSearch.submit()">
<%for i=0 to nRecClass4-1%>
<option value="<%=arrClass4(0,i)%>" <%if strSearchClass1=arrClass4(0,i) then Response.write "selected"%>><%=arrClass4(1,i)%> : <%=arrClass4(2,i)%></option>
<%next%>
<option <%if strSearchClass1="" or strSearchClass1="All" then Response.Write "selected" %> value="All">All</option>
</select>
</td>
<TD width="47%"> </TD>
</tr>
as the code above, when i make a selection on the drop down box, the form is submitted. However when the form is loaded, it reflects the 1st option in the drop down box instead of retaining the option being selected. any idea how to do it?
|
|

January 18th, 2006, 01:30 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
make sure you are not comparing a string to a integer, Try:
<%if (cint(strSearchClass1)= arrClass4(0,i)) then Response.write " selected " end if %>
Note: the spaces before the s and after the d in "selected"
Are you missing two end if s also? Does that code run problem free?
Wind is your friend
Matt
|
|

January 18th, 2006, 01:38 AM
|
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
sorry, but the problem still exists, ie the drop down list still goes back to the 1st item upon form submit
|
|

January 18th, 2006, 01:53 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Lets print the values to the screen and visualy compare them.
1..what data types should to two values be (integers or strings)?
change this line:
<option value="<%=arrClass4(0,i)%>" <%if strSearchClass1=arrClass4(0,i) then Response.write "selected"%>><%=arrClass4(1,i)%> : <%=arrClass4(2,i)%></option>
To this:
<option value="<%=arrClass4(0,i)%>" <%if strSearchClass1=arrClass4(0,i) then Response.write "selected"%>><%=arrClass4(1,i)%> : <%=arrClass4(2,i) & " - compare:" & strSearchClass1 & " to:" & arrClass4(0,i) %></option>
run the page, right click, view source and post the HTML output of the 'select box code only'
Im gone in 20 mins, we should be able to slove this easy.
Wind is your friend
Matt
|
|

January 18th, 2006, 02:30 AM
|
|
Authorized User
|
|
Join Date: Jan 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
sorry but the line of code gave an error message instead
Microsoft VBScript runtime error '800a000d' Type mismatch: 'arrClass4'
|
|

January 18th, 2006, 02:40 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Do you understand what wew ere doing? Just printing the values you are comparing. Why dont you answer questions when they are asked???????????????? I asked what data types you are expecting
try this:
<option value="<%=arrClass4(0,i)%>" <%if strSearchClass1=arrClass4(0,i) then Response.write "selected"%>><%=arrClass4(1,i)%> : <%=arrClass4(2,i) %> compare: <%= strSearchClass1 %> :to: <%= arrClass4(0,i) %></option>
The working day has just finished in Aussie, good luck.
Wind is your friend
Matt
|
|
 |