I have a multi-select listbox thanks to this article. The only issue is I need these items separated by ";" instead of ",".
Here is the code with the changes I have made:
<script type="text/javascript">
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 ) {
for (var i=0 ; i < o_state.options.length; i++ ) {
if(o_state[i].value == v_state) {
o_state.remove(i);
break ;
}
}
var o_st = v_state.split("; ") ;
for (var j=0 ; j < o_st.length; j++) {
for (var i=0 ; i < 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 ;
</script>
Even though I have replaced the character it still separates by commas!
Otherwise this functions as intended and I have even paired it with some jquery in order to remove the condition of holding down the control key for multiple selections.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
DataCobalt
I have a multi-select listbox thanks to this article. The only issue is I need these items separated by ";" instead of ",".
Here is the code with the changes I have made:
Even though I have replaced the character it still separates by commas!
Otherwise this functions as intended and I have even paired it with some jquery in order to remove the condition of holding down the control key for multiple selections.
Any and all help is much appreciated!
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.