Solved

How to show/hide/validate a view based on content of a control from another view?

  • 2 November 2017
  • 2 replies
  • 129 views

Badge +2

HI,

 

I am sorry for this question as I am new to K2.

I am building a form which has two views i.e. Students, Courses

 

In Students View, I have a Radio Button List control called "Register course?" with Yes and No options (Default selection is No)

In Courses View, I can build a list of courses with details in each row. I also have toolbar buttons Add, Edit, Delete in this view.

 

Solution 1: Couses view is hidden by default. If user clicks Yes to "Register course" Radio Button List, then I would like to display a blank Courses view, otherwise keep it hidden.

Solution 2: Courses view is blank and disabled (readonly) by default. If user clicks Yes to "Register course" Radio Button List, then I would like to enable the Courses view and allow to add list items.

 

Solution 1 above is preferable. but if solution 1 is not possible then Solution 2 is ok.

 

Thank you in advance

 

Kind regards

icon

Best answer by K2CaveMen 2 November 2017, 15:55

View original

2 replies

Badge +2

Solved!

 

The Rule goes like this

 

On Student, when Register course is Changed

If on Student, Register course contains false

then set the properties of Courses View (configure)

else

then set the properties of Courses View (configure)

 

 

Badge +10

Very Easy   [ Outbound Rules ]

 

First ... put an Advanced condition... [Radio Buttons ] are kind of buggy on the Yes/No True/False 1/0 so use the advanced condition to see if the Checkbox is True or the specific value you are looking to do. If return True, then call the Outbound Rule.

 

Once you have everything working the way you expect in the view if the click yes or not. and clear values put the courses.. blah blah blah.

 

you will have a button to submit... here is the magic. ... like I said Very Easy [ Outbound Rules ] . First Execution is Outbound Rule Validation.. Talking with Bryan we came up with a Best Practices approach where all your created Outbound Rules named with the Prefix [ Sub Rule - .....] This way you will always know is something you build.

 

So basically if the Radio Button is Yes... then call the specific Sub Rule Validation Courses or whatever...  on the Sub Rule Validation Courses if the condition not work, make sure you add the Stop Rule Execution to prevent the submit of the form, also put a popup mesg to let people know what is required.

 

If the Radio Button is No. you will call nother Sub Rule Validation Students and call some other validations with popup mesg and stop rule execution.

 

The idea is when button submit -> Call Sub Rule Validation if pass the continue so you can submit, start workflow, send email and continue with your process.

 

Hope this helps, happy K2 Hacking =)

 

 

 

Reply