concatenation - Javascript to record multiple selections from a list box will only separate with commas -


i using database platform , have multi-select listbox javascript. issue need these items separated ";" instead of ",". have separating character in code , otherwise code works intended (it stores multiple selections).

here code:

var v_state = "[@field:reason_for_cancelltaion]" ; var o_state = document.getelementbyid("editrecordreason_for_cancelltaion") ; o_state.multiple = true ;  function f_listbox() {   if ( v_state.indexof(";") > 0 ) {     (var i=0 ; < o_state.options.length; i++ ) {       if(o_state[i].value == v_state) {         o_state.remove(i);         break ;       }     }     var o_st = v_state.split("; ");     (var j=0 ; j < o_st.length; j++) {       (var i=0 ; < o_state.options.length; i++ ) {         if(o_st[j]== o_state.options[i].value){           o_state.options[i].selected = true ;           break ;         }        }     }   } } window.onload = f_listbox ; 

any , appreciated!

edit: should have explained bit better, original code has "," 2 ";" exist, thought swapping character enough.

this code designed used caspio , documentation can found here.

if result array named 'result' join whatever chars want with:

result.join(';') 

if result string named 'result' change characters specified with:

result.replace(', ',';') 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -