Jump to content

Search the Community

Showing results for tags 'update page'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Caspio Bridge
    • Caspio Apps for Ukraine
    • General Questions
    • Caspio JavaScript Solutions
    • Tables, Views and Relationships
    • Import/Export and DataHub
    • DataPages
    • Deployment
    • Security, Authentications, Roles, SAML
    • Styles and Localizations
    • Parameters
    • API and Integration
    • Calculations and aggregations
    • User JavaScript and CSS Discussions

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


MSN


Website URL


ICQ


Yahoo


Skype


Location


Interests

Found 1 result

  1. So this is something that has been addressed a couple of different times but not of the Javascript solutions work for me. I have an update page that has 3 listboxes with multi-select enabled. I need the update page to display the multiple selections in the listbox separately and not in one long sentence separated by commas. Here are two of the different scripts I have tried to use, neither has worked. First: <script> // Function for selecting corresponding elements from the list box. function select_ (){ // get listbox element var o_els = new Array("EditRecordStatus","EditRecordMarket_Sector","EditRecordDivisions"); for (var k=0; k< o_els.length; k++ ) { var o_el = document.getElementById(o_els[k]); // Enable multiselect for listbox o_el.multiple="multiple"; // get listbox length var len = o_el.options.length; // get selected element var selected = o_el.options[len-1].value; // verify if selected element contains comas, if yes, do the following if (selected.indexOf(",") != -1 ){ // Split selected option into array var m_array = new Array();m_array=selected.split (","); // Delete last option from the listbox o_el.options.remove(len-1); // Go through listbox and select each option, if it is present in array for( var i=0; i< m_array.length; i++ ){for( var j=0; j< len-1; j++ ){ // Trim spaces while comparing elements from array and listbox if( m_array.replace(/^s+|s+$/g, '') == o_el.options[j].value ){ o_el.options[j].selected = "selected"; } } } } } } // call select_ funtion when details page is loaded window.onload = select_; </script> Second (On this one the 3rd Listbox works but the other two do not): <script type="text/javascript"> var v_state = "[@field:Status]" ; var o_state = document.getElementById("EditRecordStatus") ; 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.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.value){ o_state.options.selected = true ; break ; } } } } } window.onload = f_listbox ; </script> <script type="text/javascript"> var v_state = "[@field:Market_Sector]" ; var o_state = document.getElementById("EditRecordMarket_Sector") ; o_state.multiple = true ; function f_listbox2() { if ( v_state.indexOf(",") > 0 ) { for (var i=0 ; i < o_state.options.length; i++ ) { if(o_state.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.value){ o_state.options.selected = true ; break ; } } } } } window.onload = f_listbox2 ; </script> <script type="text/javascript"> var v_state = "[@field:Divisions]" ; var o_state = document.getElementById("EditRecordDivisions") ; o_state.multiple = true ; function f_listbox3() { if ( v_state.indexOf(",") > 0 ) { for (var i=0 ; i < o_state.options.length; i++ ) { if(o_state.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.value){ o_state.options.selected = true ; break ; } } } } } window.onload = f_listbox3 ; </script> Thank you for your help!
×
×
  • Create New...