Jump to content

How to remove (not disable and not delete) an option in a "select" list


naamabm

Recommended Posts

Is there a way to remove (not disable and not delete) an option in a "select" list, and restore it later when needed?I have a form with many huge lists ("select" with many "options") that depend on eachother. I am dynamically updating the form through server, and wish to update the list values by sending a mask string. This way I could remove and restore the options without the need to pass the whole list again.I tried many ways but none work:* option.diabled="disabled" is not good because it is still shown* option.style.visibility='hidden' is not good because it is still taking a row* option=null is not good because I will not be able to restore itI need a method similar to the following one for remove/add fields in a form:remove:<field>.style.display='none';restore:<field>.style.display=block';Thank you!!!

Link to comment
Share on other sites

You could use SQL.You can make table with list of it and with while or foreach, you can call whatever you want.Or you could make 2 select box. And when one is selected, will show some values, and other, will show others.

Link to comment
Share on other sites

If the updated data is coming by way of AJAX, that of course is not a solution. It's also not a solution if a change to one element creates a predictable change to a second element, and you want the response to be immediate.You might want to use the select object's add/remove methods for the purpose of display, and keep permanent track of your data in one or more JavaScript structures.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...