Jump to content

Search the Community

Showing results for tags 'mulit-select'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Caspio Bridge
    • 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. I've got 3 fields set as Listboxes on a Submit datapage. I'm using js to select multiple records and enter them comma delimited upon submission. The code works fine when doing it with one Listbox but I can't figure out how to get it to work for all three. Right now I'm just repeating the code for each listbox (with a different variable name for each) but it doesn't work. I imagine there's a more unified way to do this so the code covers all 3 Listboxes. Anyone have any ideas? Here's the code so far (it's obviously wrong to repeat the entire script 3 times, I just don't know how to unify it): <script type="text/javascript"> var v_state = "[@field:Field1]" ; var o_state = document.getElementById("InsertRecordField1") ; 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 ; document.addEventListener('DataPageReady', f_listbox()); </script> <script type="text/javascript"> var v_state2 = "[@field:Field2]" ; var o_state2 = document.getElementById("InsertRecordField2") ; o_state2.multiple = true ; function f_listbox2() { if ( v_state2.indexOf(",") > 0 ) { for (var i2=0 ; i2 < o_state2.options.length; i2++ ) { if(o_state2[i2].value == v_state2) { o_state2.remove(i2); break ; } } var o_st2 = v_state2.split(", ") ; for (var j2=0 ; j2 < o_st2.length; j2++) { for (var i2=0 ; i2 < o_state2.options.length; i2++ ) { if(o_st2[j2]== o_state2.options[i2].value){ o_state2.options[i2].selected = true ; break ; } } } } } //window.onload = f_listbox2 ; document.addEventListener('DataPageReady', f_listbox2()); </script> <script type="text/javascript"> var v_state3 = "[@field:Field3]" ; var o_state3 = document.getElementById("InsertRecordField3") ; o_state3.multiple = true ; function f_listbox3() { if ( v_state3.indexOf(",") > 0 ) { for (var i3=0 ; i3 < o_state3.options.length; i3++ ) { if(o_state3[i3].value == v_state3) { o_state3.remove(i3); break ; } } var o_st3 = v_state3.split(", ") ; for (var j3=0 ; j3 < o_st3.length; j3++) { for (var i3=0 ; i3 < o_state3.options.length; i3++ ) { if(o_st3[j3]== o_state3.options[i3].value){ o_state3.options[i3].selected = true ; break ; } } } } } //window.onload = f_listbox3 ; document.addEventListener('DataPageReady', f_listbox3()); </script>
×
×
  • Create New...