Discussions

 View Only
  • 1.  Compulsory Selection in Multi Select

    Posted 06-21-2017 02:57
    I have a multi select field (holding State names) which is a required field when creating a new required.  However, due to organisational requirements, we have to ensure that in some cases, users select two states. Largely this is because our entire business is configured so that one large and small state is looked after by a team.

    Is there any way that I could ensure that users always select correct second state?   


  • 2.  RE: Compulsory Selection in Multi Select

    Posted 06-21-2017 04:01
    How do you define what is the second state?


  • 3.  RE: Compulsory Selection in Multi Select

    Posted 06-21-2017 04:55
    Thanks.  We have 5 states.  So we have a combination such as:

    WA
    QLD
    NSW/ACT
    SA/NT
    VIC/TAS
      
    Bottom three should always be in the combination shown. 


  • 4.  RE: Compulsory Selection in Multi Select

    Posted 06-21-2017 05:24
    Use IOL with this code:

    $("#_fid_6").bind("multiselectclose", function(event, ui){
      var selections = $("#_fid_6").multiselect("getChecked");
      if (selections.length < 2) {
        $("#_fid_6").multiselect("open");
      }
    });
    If _fid_6 is a multi-select field then the popup selection menu will reopen if less than two selections are made. This should be enough of annoyance that your users will conform. As to picking one large and one small state you would have to code that logic to suit your own needs.


  • 5.  RE: Compulsory Selection in Multi Select

    Posted 06-21-2017 11:31
    Arshad,

    If you always want certain states selected together, why not just make the choices so that the choice only includes the double state, and not allow a drop down choice of them individually.


  • 6.  RE: Compulsory Selection in Multi Select

    Posted 06-21-2017 20:52
    Thanks Dan. Is there a very simple step by step instructions on setting up IOL? 

    Mark I will take this up with you off line.  


  • 7.  RE: Compulsory Selection in Multi Select

    Posted 06-22-2017 14:57
    The instructions for setting up IOL are in the Notes field of every record in this application. I added the code in my prior answer here:

    Pastie Database
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=585


  • 8.  RE: Compulsory Selection in Multi Select

    Posted 06-22-2017 21:57
    Thank you so much. Good instructions.  One clarification though. Do I need to add the formula field only once in the table and this could work with different modules.  I seem to have two similar fields with different names but addressing different issues.   


  • 9.  RE: Compulsory Selection in Multi Select

    Posted 07-05-2017 05:08
    Having some issue. I created the .JS file. I already have the required variables.  I also created a text field with the following code: 

    [iol] & "MultiSelect.js" & [/iol]

    But when I am saving a new record, it does not fire the error. 


  • 10.  RE: Compulsory Selection in Multi Select

    Posted 07-05-2017 12:54
    Debug with console.log() statements in your code.


  • 11.  RE: Compulsory Selection in Multi Select

    Posted 07-05-2017 21:32
    Thanks. Where do you place it? 

    $("#_fid_110").bind("multiselectclose", function(event, ui){  var selections = $("#_fid_110").multiselect("getChecked");
      if (selections.length < 2) {
        $("#_fid_110").multiselect("open");
      }
    });