Hide and Show some section in the view

  • 16 February 2017
  • 3 replies
  • 4 views

I want to be able to show some section in the view depend on the questions Yes or No?

 

Example:

Are you currently married?     Yes      No. (No default answer when the form initialze)

If user selects YES then I want to show the section below

What year did you married? --------------- (enter value)

Where did you married? ---------------------- (enter value)

 

If the user selects NO then I want to show the section below

When will you plan to get married  -------

 

How do I achieve this in K2.

 

Thanks

 


3 replies

Userlevel 3
Badge +8

Dear,

 

Let me try and explain the scenario in good way,

yes,no is a radio button.

other 2 questions are 2 labels and 2 other radio buttons.

 

to accomplish what u want, u need to add following rules.

when a control on the form/view raises an event , u will choose the first radio button control and the event is changed, inside this event u will add advanced condition which is if value is yes, and inside this event u will add action, 4 actions to be specific which are:

show first question label,show second question label, show first question radio button, show second question radio button.

 

or u could wrap the 2 labels and the 2 radio buttons inside of table control, and show/hide this table.

btw, these controls should be hidden since ur default radio button is "no" and only show if its yes.

 

Hope it helps,

Regards.

Thanks AhmadAbdullah.

 

You are corrected

The Question "Are you currently married?"   - Have two radio button ( Yes      No)

when the user select YES radio button , I want to show

Section 1

What year did you married? (this a label)  --------------- (----- This is a date field - User enter calendar)

Where did you married? ---------------------- (this is a text box field )

 

If user selects "NO" radio button I want to hide Section 1 and Show Section 2

Section 2

When will you plan to get married? (this is a label)  -------  (----- This is a date field - User enter calendar)

 

and vice versa.

 

 

So you suggest that I put "Section 1" and Section 2" in two table then hide and show these tables depend on the user selection (Yes or NO)?

Is that correct?

 

Thanks,

TTN

Badge +2

Use Table control inside a view and put your controls in the table making a group. Tables have names and can be accessed in K2 rule designer, so you will be able to eaily hide/show tables with all the controls inside them. So you will need just a single rule instead on N-number of rules to hide/show all the elements one by one.

Reply