Forum Discussion

ArshadKhwaja's avatar
ArshadKhwaja
Qrew Commander
8 years ago

Compulsory Selection in Multi Select

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?   
  • 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. 
  • 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.
  • 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.
  • 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.  
    • ArshadKhwaja's avatar
      ArshadKhwaja
      Qrew Commander
      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.   
    • ArshadKhwaja's avatar
      ArshadKhwaja
      Qrew Commander
      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.