Jump to content

How do you use js for a dynamic multi-select list box in Bulk Edit

Recommended Posts

Hi, the below code is used to create comma-delimited text values (in a text255 field) so the user can select multiple values in a list box and save them (separated by commas) in a text field. It's necessary to use this method instead of the Caspio-native 'List' data type because the lookup values need to be dynamic (I wish Caspio would enable this, been waiting FOREVER). 

This method works great for Details and Update datapages but I need it to also work in a Bulk Edit page. I've tried changing 'EditRecord' to 'BulkEditRecord' but it doesn't work. Does anyone know how to modify this code to work in a Bulk Edit page? This is so the user can select multiple records and update them with multiple selections in a listbox. 

<script type="text/javascript">
 var v_state = "[@field:state]" ;
 var o_state = document.getElementById("EditRecordstate") ;
 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) {
     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 ;
 document.addEventListener('DataPageReady', f_listbox);
 //You can also use the line below instead of the eventlistener 
// setTimeout(f_listbox, 20); 


Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...