Hello,
I have a drop-down list that I would like for it to retain the selected value (but it's not working). The following is my code : -
<select name="trophyscope" size="2" onChange="
-
<%String item = (String renderRequest.getPortletSession().getAttribute("trophyscope");
-
%>
-
<option selected="true" value="<%=item%>">"<%=item%>"</option>
-
"
-
>
-
I wonder if someone could please point me to what I am doing wrong?
Thank you,
Akino
7 3383 Dormilich 8,658
Recognized Expert Moderator Expert
since I don’t know that programming I can only answer in general. you need to set that option element as selected, which has the passed value.
Compared to my stuff, you've got some xtra "" in the value= attribute. See if this fixes it: -
<option selected="true" value="<%=item%>"><%=item%></option>
-
Actually, its not in the attribute itself. Its what's in between your start and finishing option tags. (Minor mistake in my description--just look at the example).
Hello C CSR,
Thank you so much for your reply. Removing the extra " : -
<option selected="true" value="<%=item%>"><%=item%></option>
-
allows my code to work. But it adds an extra item to my drop down list. I wonder if you or someone could please tell me how to set
the selected item on a drop down list without adding a new item to
the list?
Thank you again,
Akino
Akino:
Post a larger section of your code (from <Form to /Form> if you can). Meanwhile I'll look at mine again to see how I avoided that. I wrote mine originally a while back and I've just been cut&pasting ever since.
If I remove the "option selected" line altogether, I get a blank in the combo before I click the arrow (the same if I leave the line in but put nothing between the >< , regardless of the value= attribute). I find that no matter whether the initial appearance is blank or contains some text, I always see it duplicated (highlighted) at the top of the dropdown when I click (even the blank line) but that's to indicate the current selection if the user doesn't choose something else. This by nature, but does not refer to your question about the duplicate highlighted item along with the same item being shown further down in the list.
What I did in some cases, is put some text in there that is not actually a searchable item, like "Select" for example, and leave my default value in the "option selected" line a preferred value from my list. This way the value is there but what you see is "Select." Then when you click the arrow, all the items in the list appear once, BUT, in keeping with the nature of the combo, the text "Select" is highlighted at the top in the drop list.
So, you either have a highlighted blank line at the top after you click, with nothing showing in the box before you click, or you have "Select" highlighted at the top after you click. But in the list of "true" items, nothing is duplicated. My workaround, to demonstrate, is as follows:
CODE
Valueless text:
<option selected value="<%=item% >"><%Response.w rite "Select"%></option>
Other option are: Blank
<option selected value="<%=item% >"></option>
OR
no option selected line at all
CODE
I don't think you can eliminate the highlighted duplication of what's already in the combo before you click. Ergo, do you want the combo to first appear blank, put some text in there like "Select item," OR, the 3rd option is to eliminate the "option selected" line completely; then, the first item in your recordset for the list will automatically appear (depending on how you were sorted) , but you still have the duplicate in the highlight, but in the highlight ONLY.
Did you follow all that?
I hope the Moderaror doesn't tear up my code. I forgot to put it in the "CODE blocks."
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Speaker |
last post by:
Hi I am a newbie to SQL.
I have a historical list of digatal points listed by time.ie: 3 fields
PointName;Date/Time;State.
I need to return a list of When a specific point chsnges state.
For example a list everytime Point A transitions to State 1.
|
by: Joseph Barron |
last post by:
Here is a SIMPLE problem that I'm trying to solve.
It works in Netscape 6.2, but IE6 gives ""No such interface
supported."
Below are page1.htm and page2.htm .
In page1.htm, there are two dropdown lists. If you change the
selection of the left one (e.g. choose parentoption2), it
should open up page2.htm in a popup window.
|
by: Toonman |
last post by:
I have a webpage with a <form> consisting of a large table grid of dropdown
lists used to make changes in a database. Some of these dropdown lists have
the same value. I'm trying to make it so that when a user mouses over one
of the dropdown lists, that dropdown list, and all other dropdown lists
having that same value are highlighted with a yellow background color. Then
on a mouseout the yellow highlights go away.
The goal is to it...
|
by: Justin Bartels |
last post by:
Hi,
I have been struggling with an unusual problem with a
dropdownlist web control for quite some time now.
Cutting straight to the problem, I am setting the
selected item in the dropdownlist using the IndexOf
method of the list's items collection (in my debugging
case this successfully sets the selectedindex to 15).
After postback, the selecteditem is always the first item
in the list, losing the selection I set previously (And
|
by: starbuck |
last post by:
Hi
In asp.net/vb.net is there a trigger for a dropdown list when focus moves to
next control.
I want other fields to be filled after a user selects a account reference
and tabs to the next field
Thanks in advance
| |
by: jung_h_park |
last post by:
From: jung_h_park@yahoo.com
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Dropdown List not retaining its SelectedValue
Date: Mon, 26 Jun 2006 21:02:57 -0700
Hello,
My dropdown list control does not retain its SelectedValue. Unless I
read the SelectedValue right after the control has been loaded,
populated, and assigned with its original value (and of course that is
|
by: fezzabett |
last post by:
i have one question. i have two different dropdown list. one to select members,and another one to select department. so i want function when i click on one button for example i named it 'add another option' button', so it will duplicate that two dropdown list below the two main dropdown list.when i want to remove it,so it will remove the the dropdown list.please someone help me.
|
by: dhoward |
last post by:
How do you default a dropdown list when a particular item is selected? I have a two drop down lists, one for state and one for county.
If the user chooses a state outside of Alabama, I need the county to default to “Out of state” and without allowing the user to change it without changing the state back to Alabama.
This is what I tried, which didn’t work
If lstBusState.selectedItem.Value = “Al” then
...
|
by: rote |
last post by:
If you have a look at this site below you will notice that after typing some
text and the list is too long the textbox will give
you like a dropdown list
http://www.tuyr.net/AutoComplete/AutoComplete.aspx
How can i achieve this i have set all the properties on that page but still
don't get the dropdown list..when my list is too long
Or is there a way to page it etc..
Any ideas what 'm missing
Thanks in Advance
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |