Shubh
Novice

How to Hide all other views on the selection on one Checkbox ??

Jump to solution

Hi Experts,

 

I have a K2 Smart Form on which I have 36 views of response type singleCheckBox and lables. My requirnment is when user checked any one of the checkbox all other checkbox and Lable should be hided, I know we can write the hide/show on the onChange event of any checkbox but it would be very lengthy, is there any other smart way to handle this requirnment ?

 

Thanks

Shubh

0 Kudos
Reply
2 Replies
Themba
Apprentice

Re: How to Hide all other views on the selection on one Checkbox ??

Jump to solution

Good day,


 


I suggest that at a section of the form you put table on which you will add all the views that you want to hide on check box change.


So basically you'll have one rule to hide table on checkbox change this will also hide the views that you have placed on the table.


 


Hope this helps.


 


Kind regards


Themba


 

Reply
RaymondJVR
Nintex Employee
Nintex Employee

Re: How to Hide all other views on the selection on one Checkbox ??

Jump to solution

Hi Shubh


 


My recommendation would be to make use of the table control, an unbound rule and the on change events in the checkboxes.


 


Using these items you could construct one unbound rule that can be called on each of the checkbox buttons, this will eliminate having to create the same conditions on each checkbox over and over again. The table control could help in making the controls less when it comes to hiding them during the rule construction.


 


Let’s say you have 2 views on a single form, the form also has 2 labels and 2 checkboxes - Now we want everything to be hidden if the any of the 2 checkboxes are changed to a true value, however the changed checkbox should not be hidden, if the checkbox is changed to a false value then everything else should be turned back to visible again. To get this behaviour I would recommend constructing the following.


*Please note that the below steps are based on the above mentioned scenario.


 


Steps:


1. If at all possible add all the other control that are on the form into a table control – this would obviously depend on what your design looks like.


6142i041CDFD935200D8F.png


See this link for more information on the table control - https://help.k2.com/onlinehelp/K2smartforms/UserGuide/4.7/default.htm#SF_-_ViewControls_-_Table.html


 


2. Create an unbound rule by not adding any events but instead just change the rules name, then jump straight into constructing your rule to look like the below:


6143iEDE252A9195E5A45.png


       Advanced condition - If Checkbox 1 = True


            Hide View 1


            Hide View 2


            Hide Label 1 - Instead of hiding the labels individually you can hide the table control containing them instead (Hide Table 1)


            Hide Label 2 - Instead of hiding the labels individually you can hide the table control containing them instead (Hide Table 1)


            Hide Checkbox 2


       Else


            Show View 1


            Show View 2


            Show Label 1 - Instead of showing the labels individually you can hide the table control containing them instead (Hide Table 1)


            Show Label 2 - Instead of showing the labels individually you can hide the table control containing them instead (Hide Table 1)


            Show Checkbox 2


       Advanced condition - If Checkbox 2 = True


            Hide View 1


            Hide View 2


            Hide Label 1 - Instead of hiding the labels individually you can hide the table control containing them instead (Hide Table 1)


            Hide Label 2 - Instead of hiding the labels individually you can hide the table control containing them instead (Hide Table 1)


            Hide Checkbox 1


       Else


            Show View 1


            Show View 2


            Show Label 1 - Instead of showing the labels individually you can hide the table control containing them instead (Hide Table 1)


            Show Label 2 - Instead of showing the labels individually you can hide the table control containing them instead (Hide Table 1)


            Show Checkbox 1


 


 3. Call the unbound rule on all the relevant controls, in this case it would be the two checkbox controls. 


       When Checkbox 1 is changed


           Then execute the Visibility rule


 


       When Checkbox 2 is changed


           Then execute the Visibility rule


 


4. Run your form – now when checkbox 1 is checked all other controls and views will be hidden, when it is unchecked all the controls will be turned back to visible. The same will happen if the second checkbox is checked or unchecked as the rule has catered for that.


 


Things to note:



  • Unfortunately this is the most that you would be able to shorten the process to achieve this task.

  • Views cannot be added to a table control, this would have made the rule a lot smaller but unfortunately the control does not accept that.

  • This solution would also work in 4.7 as well as K2 Five

  • You can seperate this and turn it into a few unbound rules to make troubleshooting easier, example: split them up into a unbound rule for the views and one for the controls or something similar.


Additional References:


http://community.k2.com/t5/General/The-benefit-of-using-unbound-rules-with-multiple-states/m-p/99283


 


Should you feel that this post is of use and or an accurate solution to the raised question, I kindly encourage you to mark it as such using the 'Mark as Solution', 'Kudo' andor ‘Me Too’ options.


 


Kind Regards


Raymond

Reply