By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

how to select an html option using querystring and recordset

P: 4
I have created some pages which I want to be selected inside the page selector OPTION if the pagenr matches request.querystring offset.
I don't get any error while doing so, but it does not execute at all.


Expand|Select|Wrap|Line Numbers
  1. <form id="menu" action="">
  2. <select>
  3. <%                                                            
  4. pagelist = 0
  5. pagelistcounter = 0
  6. do until pagelist > allrecords  
  7.   pagelistcounter = pagelistcounter + 1
  8. %> 
  9.  
  10.  
  11. <option id="<%= pagelist %>" value="?mode=listpoems&poet=<% = request("poet")  %>&offset=<% = pagelist %>" <% if pagelist = request.querystring("offset") then %>selected<% end if %>><%    pagenr = pagelistcounter
  12.  
  13. pagenr=Replace(pagenr, "0", "۰")
  14. pagenr=Replace(pagenr, "1", "۱")
  15. pagenr=Replace(pagenr, "2", "۲")
  16. pagenr=Replace(pagenr, "3", "۳")
  17. pagenr=Replace(pagenr, "4", "۴")
  18. pagenr=Replace(pagenr, "5", "۵")
  19. pagenr=Replace(pagenr, "6", "۶")
  20. pagenr=Replace(pagenr, "7", "۷")
  21. pagenr=Replace(pagenr, "8", "۸")
  22. pagenr=Replace(pagenr, "9", "۹")
  23. %><% = pagenr %></option>
  24.  <%
  25.   pagelist = pagelist + recordsonpage
  26. loop
  27. %>
  28. </select>
  29. </form>
Oct 7 '12 #1
Share this Question
Share on Google+
4 Replies


P: 4
is there anybody who have something to add?
Oct 9 '12 #2

Rabbit
Expert Mod 10K+
P: 12,369
What does the resulting HTML source look like?
Oct 9 '12 #3

P: 4
The resulting Html source should look like this:

Expand|Select|Wrap|Line Numbers
  1. <select>
  2. <option id="1">page 1</option>
  3. <option id="2" selected>page 2</option>
  4. </select>
where the id of option is the same as offset in querystring or pagenr in the loop. by comparing pagenr with offset it should select the option.

Expand|Select|Wrap|Line Numbers
  1. if request.querystring("offset") = pagenr then
  2. option = "selected"
  3. else
  4. option = ""
  5. end if
it's actualy the IF who does not get one of the values correctly inside the loop.

I have also tried javascript and Jquery, but they won't work on my page which I believe is because of some other jquery and javascript functions who disturb the code.
Oct 20 '12 #4

Rabbit
Expert Mod 10K+
P: 12,369
I wasn't asking what it should look like, I was asking what it did look like. In addition, what are the values in the variables if you output them?
Oct 21 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.