|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Manipulatin a Multiselectable list (adding, deleting, maintaining)
Hey guys i am having some real trouble trying to manipulate a multiselectable list.
The layout is hard to describe, but basically there is a table contining many values (populated by a cfquery's output) some values have children, so if you click next to a parent value (on an img link) you will be taken to a similar page where only the child values are shown, while if you click on any value it will be added to a multiselectable list that is shown at the bottom of the page. Managing this list is my problem. At the moment when you click on a value it will recall the same page with a URL variable addvalue=#value# this value is added to a string that is used to populate the multiselectable list (you still following?...) so the longer the string the more items contained in the list. My problem comes with removing from the multi-selectable list. I want a user to click on an item in the list then click on a remove button and the item is then removed from the list. I have tried this in 2 ways and one is very close to working: 1. Using javascript - the onclick event on the remove button runs the function removefromlist(listobject) and basically it removes the selected value in listobject. This effectively removes the value from the multiselectable list, but i can't then alter the string that holds the contents of the list so when i refresh the page (or click on a parent->child link) the list is populated with the string and the removed item still appears. 2. Recalling The Page - When the remove button is clicked the page is recalled with a deleteID value in the querystring (e.g. page.cfm?deleteID=#deletethis#) My problem here is getting the selected value from the multi selectable list. I know in javascript you can get the value by using the properties of the object (e.g. mulitlist.SelectedIndex.value or multilist.options[d].value ) but i can't reference these attributes in cold fusion so i can't find out what value has been selected by the user. I would like to be able to call a javascript function called getSelected(multibox) but i can't find a way to pass a value back from the javascript to coldfusion (unless it is a form object like a textbox, then textbox.value = mulitlist.SelectedIndex.value would work) If anyone understands my ramblings i hope you can please give me some advice ![]() I assume that calling a javascript function in normal coldfusion code (not in an event) will never work?? I have tried things such as: <cfset var = getSelect(listbox) > <a onFocus="#var# = getSelect(listbox)">change value</a> and within the javascript calls such as: window.var = value; |
|
#2
|
|||
|
|||
|
Nope, I have no idea what you are asking for. If you have a list of items and when the user picks one you want to go to a page that has all the children of that item, why not just create a separate page that does that and pass in the parent value, and that page will display the children?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Quote:
ahh yeah i thought this may be a little hard to follow. Basically i want to know if you can find what is the selected item in a multiselectable list and then put it into a variable without actually submitting the form. |
|
#4
|
|||
|
|||
|
Yes, you can do that with Javascript. I'm not much of a Javascript expert (we can't use it where I work due to the fact that it can be turned off), but you should be able to search the web for help. Basically you can write a function for onChange() that detects the current value with something like:
document.forms.myForm.mySelectBox.value; |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Manipulatin a Multiselectable list (adding, deleting, maintaining) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|