Depends on another field

Nadia Tahir asked on June 5, 2018 16:50

hello kentico dev i create a page type of jobs and i want show company field Depend on location name i try this macro in page type feild of company {% if(Location.Value == "LGH" || Location.Value == "CAMPUS"){ %} {%Company.Value =="LGH" %} {% } #%} but its not work thanks

Correct Answer

Rui Wang answered on June 5, 2018 20:45

  1. Make sure the Location field has "has depending field" checked.
  2. For Company field, check "depending on another field" and set the visible condition to be Location.Value == "LGH" || Location.Value == "CAMPUS"
0 votesVote for this answer Unmark Correct answer

Recent Answers


Nadia Tahir answered on June 6, 2018 11:48 (last edited on June 6, 2018 11:58)

hi Rui Wang thanks for answer but i want put this macro in default value of field depend on another field

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on June 6, 2018 14:24

for company field, if it's a Text Box form control you can use {% Location.Value %} in the default value field. But it only populates when you create a new page for the first time because it's server side call and it doesn't update as you change the location drop down, because there is no event to update the text box.

You will need to create a custom Text box form control to get the update using JS. Or you can use another drop down list from control for the Company field, and set the Data Source to {% Location.Value %}

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.