Solved

Switch visibility of controls

  • 8 August 2019
  • 6 replies
  • 80 views

I have a view with a checkbox. If the checkbox is "checked" some other controls should be visible. If the checkbox is "unchecked" these controls should not be visible.

 

At the moment I need two things:

  1. some steps in the "View Initialize" rule (if checked show controls - else hide controls).
  2. and a new rule "if control changed" again with an if-clause (if change and if value is true then show controls else hide controls)

At point 1 I can minimize the effort if I hide the controls by default and only show them if the value is true.

But for point 2 there is no "short version". Maybe this is more a feature request but I couldn't find where to leave them?

It would be nice if there was a new action "Switch visibility of control".

Then the rule for "if control changed" would be much shorter: If control change then switch visibility of control.

 

Or do I miss something and there is allready a compareable action?

 

Regards

Viktor

 

icon

Best answer by skb_ev 16 August 2019, 10:04

View original

6 replies

You can keep the controls in a seperate table and write an unbound rule to show or hide this table with controls and you can call this rule in the changed event of checkbox and view initialize.

 

event be like:

Changed event of checkbox,

if checkbox contains value "t"

show controls

else 

hide controls

Good day  @skb_ev;


 


Addtional to the above mentioned, please see this formal doc which I believe is explains the logic rules proper(http://help.k2.com/onlinehelp/K2Five/UserGuide/5.3/default.htm#Create/K2Designer/Rules/ServerRules.htm),


checkout with this form's properties setup for k2Designer rules(http://help.k2.com/onlinehelp/K2Five/UserGuide/5.3/default.htm#How-Tos/SetFormProperties/HowToUseSetFormPropertiesAction.htm) and http://help.k2.com/onlinehelp/K2Five/UserGuide/5.3/default.htm#Create/K2Designer/Rules/ServerRules.htm#Server_Conditions


 


However should you feel the issue is still not properly addressed, you can submit a feature request here(https://ideas.k2.com/).


 


Kind regards;


Widson.


 

Badge +9

Hi Viktor


 


Step1:


Create an Item View :


=>Click on Contact TextBox and Untick Visibility


=>so when a view start, will only going to see firstName TextBox 



 


Step2: Click On Rules


See Attached Rules



=>(First Configure) then set the properties of Text Box1 control (Configure)


=>Click Configure


Note [If you want to Hide/Show more than one textbox just add the statement:


"then set the properties of Text Box1 control (Configure)" and change Text Box1 name to the correct  textbox ]



=>(Second Configure) then set the properties of Text Box1 control (Configure)


=>Click Confiqure



 


Results (Output)


Before the CheckBox is Ticked



 


After the CheckBox Is ticked



If u untick it 



 


Regards


Elvis


 

Badge +9

Hi Skb_ev


 


This solution hide certain row and close the space in between, Unlike the one i provided before where it hide the textbox but the space remain.


See the following steps to successfully hide and unhide a Row.


Step1: Create an item view.


         =>The Item view must have 1 row and 1 column and drag a table set it to 1 row and 2 column


         =>drag another table to that item view that contains 1 row and 1 column (Repeat 4 times) e.g


 


Hint: All 4 table row and column has been inserted in 1 row for item view, see blow screenshot



 


Step2: Click the table for the view on top and go to rules


          => When the View executed Initialize 


          => then set the properties of Table3 control (Confiqure)



 




Dear Elvis

Dear Widson

 

Thank you for your tipps. I will have a look at the server side rules and do some tests if this could speed up my views an forms a little bit.

 

But what I was asking for was a "switch visibility" action to prevent the "if control has value than show that else hide that". It would be much easier if I could say "if control changed then switch visibility for control x, y, z"

Like the ".toggle()" function in jquery.

 

It's the some

 

Dear Elvis

 

Thank you for your proposal but as I allready "said" to the other 2 guys:

I don't need a "howto" I was asking for a "switch visibility" function. I ALLREADY KNOW! that I could do it with "if this than that (else other that)".

I will create an "idea" at idea.k2.com

 

Thank you all

 

regards

Viktor

Reply