File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Urgent !! Deleting elements from Combo Box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Urgent !! Deleting elements from Combo Box" Watch "Urgent !! Deleting elements from Combo Box" New topic
Author

Urgent !! Deleting elements from Combo Box

Aman Rustogi
Greenhorn

Joined: May 11, 2001
Posts: 22
Hi,
I need to delete a few elements from my combo box based on certain condition. I'm able to add contents into Combo Box at run-time using OPtion object but not able to delete.
How can I go about doing this ... plz guide me
Thanking u in advance,
Aman
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Aman
I assume your using the options array to add the new items to your list. To delete and item just set its index to null. If you have a list named myList do this:
myList.options[2] = null;
This will remove the 3rd item from the options array and also compress the array. If the original options were 'item1, item2,item3,item4' after the above line it would now be:
'item1,item2,item4'
hope that helps
Dave

PS you'lleed to refresh the page to get the actual list on the screen to change. history.go(0); works but it must be the last thing you do.


Dave
Aman Rustogi
Greenhorn

Joined: May 11, 2001
Posts: 22
Thx Dave.
But i guess i cannot refresh the page as it contains hell lot of data.
Newayz thx for providing the tip !!
aman
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
Hi,

Just a suggestion here, but if the form/page contains a lot of data it might be more userfriendly to break it down into several small steps which are presented/filled in separately.
This way the user might feel it's less tedious and you could do your refresh and have more dynamic content!

Terry


Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Urgent !! Deleting elements from Combo Box
 
Similar Threads
help me to clear Jcombo during runtime
Problem with updating look and feel colors of swing components dynamically
adding items in combo box?
On button click populate combobox
Dynamic addition of items to combo inJSP