Skip to main content

I have a field called Region (SW, NE, SE, NW). I have a check box with multi-selection enable. I need to put 2 validations for NE and SE regions.

If NE is selected then only show 2 choices for check and only allow 1 selection.

NE will show this "Sales" & "Service" and user should only select 1.

If SE is selected then only show 3 choices for check and only allow 1 selection.

SE will show this "Fax",  "Email" & "Online" and user should only select 1.

Nintex Forms 2010

Version: 1.11.3.0

you can not show/hide single options of a control/field with rules. you can only show/hide whole control.

in order you would be able to show/hide each check box, you would need each option to be a separate control (or at least "Sales" + "Service" being one control and "Fax" +  "Email" + "Online" being second control.


I added multiple controls and both connected to same field. I have put in filter in both controls. However, data is not saved. 


you cannot connect multiple form controls to the same list field, since only value of one control (usually the most bottom one) will be written to the list.

you should create dedicated list field for each control.

or crate a calculated value control on the form the will make up single value out of all the controls a connect it to list field


i decided to create JavaScript to validate this. (not jQuery coz i couldn't get jQuery to work or loop through the collections). the javascript doesn't work as well. only the first alert test is working. the length/count isn't working meaning getelementbyid not working.

function validateRegion()

{ alert('test');
  var i, chks = document.getElementById('cID_Region'), valid = true;
  alert(chks.length);
    for (i = 0; i < chks.length; i++) {
        if (chks.checked) {
   //alert(chks.value);
         alert('found it');
            valid = false;
        }
    }
    if(valid) {
        // ...
        // do the request stuff here
        // ...
    } else {
        alert('No item selected');
        return false;
    } 
 alert('test 2');

 

I couldn't get the following jQuery to work either ( )

function showMe() {
var c = ];
NWF$('#' + cID_Region + ' :checkbox:checked').each(function(i) {
c = NWF$(this).val();
console.log(c);

alert(c);
});
}


Can you post a picture to aide in describing the problem that you're trying to solve? 

I can't really discern what you'd like to do based on your text alone. Any more info would be incredibly helpful. 



I'd recommend not to over complicate things with showing/hidding 2 checkboxes out of 5 possible nor with a javascript(s) and use simple validation rules.

validation rule with formula like following should work for 'NE' region

RegionNamedControl == "NE" &&
( inArray(OtherNamedControl,'Fax')    ||
  inArray(OtherNamedControl,'Email')  ||
  inArray(OtherNamedControl,'Online') ||
  length(OtherNamedControl) != 1)‍‍‍‍‍

similarly for the other region(s)

even users will be able to click out combination like  NE region and Fax service but they will not be able to submit the form.


Reply