473,779 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I select item in <SELECT>

list box based on a POST method to the same page.

frm.cmbList.Val ue=Request.Form ("cmbList") doesn't work.

When the page loads, it reloads the <SELECT>, so not sure how to get the
list to go to the item.

Any ideas?

many thnx,
Kevin
Jul 19 '05 #1
3 3106
K. Lobe wrote:
list box based on a POST method to the same page.

frm.cmbList.Val ue=Request.Form ("cmbList") doesn't work.

When the page loads, it reloads the <SELECT>, so not sure how to get
the list to go to the item.

Any ideas?

Assuming you've got a window_onload event:
frm.cmbList.Val ue="<%=Request. Form("cmbList") %>"
Bob Barrows
Jul 19 '05 #2
At the end of the page... you want to make sure this doesn't execute until
after the <select> has loaded.

Something like this... see a JavaScript newsgroup for better syntax and
examples (the only ASP-related part here is getting the ASP variable into
client-side script).

<script>
var selected = 0;
for (i=0; i<document.frm. cmbList.options .length; i++)
{
if (document.frm.c mbList.options[i].value ==
"<%=request.for m("cmbList")%>" )
{
selected = i;
i = document.frm.cm bList.options.l ength;
}
}
document.frm.cm bList.selectedI ndex = selected;
</script>

You could also consider building the select list in ASP, e.g.

<%
dim options(3)
options(0) = "foo"
options(1) = "bar"
options(2) = "fu"
options(3) = "barred"
response.write "<select>"
for i = 0 to 3
response.write "<option value='" & options(i) & "'"
if options(i) = request.form("c mbList") then
response.write " selected"
end if
response.write ">" & options(i)
next
response.write "</select>"
%>

"K. Lobe" <no*********@sn sc.com> wrote in message
news:eD******** ******@TK2MSFTN GP11.phx.gbl...
list box based on a POST method to the same page.

frm.cmbList.Val ue=Request.Form ("cmbList") doesn't work.

When the page loads, it reloads the <SELECT>, so not sure how to get the
list to go to the item.

Any ideas?

many thnx,
Kevin

Jul 19 '05 #3
Worked! Thanks.
"Bob Barrows" <re*******@yaho o.com> wrote in message
news:ub******** ******@TK2MSFTN GP10.phx.gbl...
K. Lobe wrote:
list box based on a POST method to the same page.

frm.cmbList.Val ue=Request.Form ("cmbList") doesn't work.

When the page loads, it reloads the <SELECT>, so not sure how to get
the list to go to the item.

Any ideas?

Assuming you've got a window_onload event:
frm.cmbList.Val ue="<%=Request. Form("cmbList") %>"
Bob Barrows

Jul 19 '05 #4

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

Similar topics

2
3825
by: Andrea | last post by:
Hi, I'm trying to emulate part of our client-server application as a web site so customers can use it, and I'm stuck when it comes to re-ordering items in a list. Basically we have a list of available articles ("availableItems") and a list of articles already in an issue ("selectedItems"). What I want is to be able to move articles freely between the two lists and then on submission add them to the issue (which I can), but also move...
9
3202
by: Salve Håkedal | last post by:
When I select Februar here and sends, selection returns to Januar. I know why: no option is marked selected... But can php get this right in an easy way? <html><head><title>Part of a bigger page</title></head> <?php $form =" <form action=\"$_SERVER\" method=\"post\"> <select name=obs_mnd> <option value=\"Jan\">Januar</option> <option value=\"Feb\">Februar</option>
2
4573
by: Mad Scientist Jr | last post by:
I'm trying to get javascipt select all items in a HTML form <SELECT> control and submit the form to an asp.net page. For some reason when the link is clicked, you can see the items all get selected, but then they are somehow unselected as the form posts. Any idea? My Html and ..net code follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD>
7
7898
by: Felix Natter | last post by:
hi, I have a php-Script which gets passed a Boat-ID and this is used to mark an element in a <select> as the default: <select name="boote" multiple="multiple" size="5"> <option value='43'>Aisha</option> <option value='40'>Amsterdam</option> <option value='55'>Asmaa</option> <option value='20'>Beau Rivage</option> <option value='48'>Blue Perl</option>
4
11265
by: headware | last post by:
I have a <select> control that contains many entries. It allows the user to multi-select a group of them, click a button, and store the selected data in a database. Normally they do this starting at the top of the list moving down towards the bottom. The problem I was having was that the <select> control was scrolling back to the top of the page after the postback and the user would lose their place in the <select> control forcing them to...
2
6439
by: Joachim Bauer | last post by:
I'm using the code below to display a menu that opens when the mouse goes over the main menu item (try it in your browser to understand the behaviour). It uses "position:absolute" and a switch between "display='none'" and "display=''". However the problem is that - in Internet Explorer 6 the dropdown (<select>...) always hides the menu
6
2408
by: Bonge Boo! | last post by:
This has got to be obvious, but I can't make it work. I have a form called with 3 pull down menus. They are linked to a database which generates the values for the <SELECT? Pull-downs. Lets say I have values selected for all three pull down menus. When I change the first "top-level" menu I want to reset both the second and third menus to the "default" state.
5
8320
by: Brian Foley | last post by:
Hello, I am used to using the label tag with check boxes and radio buttons in html forms. This allows me to click on the text of the label to activate/deactivate the check box / button, rather than having to click on the (possibly small) box or button. I recently tried to assign a label to a select "drop down list", but found that when I clicked on the label text to bring it into focus, the select box was reset to the first entry. ...
6
13024
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this is not an ASP.NET related question, but I know this group is knowledgeable and quick with responses. Thanks
0
10138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7485
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.