Custom Page Type field conditional visibility

D D asked on June 20, 2016 21:40

I'm relatively new to kentico and am having some issue with creating a page type with conditional fields based off other fields. Basically I have a drop down list that shows one field if one value and another that shows if it's another value. I've been able to set dependency and visibility, but I want to clear out the conditional fields if the user selects one option, fills out that corresponding conditional text, then decides to change it to the other and do the same.

Can this be done?

Recent Answers


Trevor Fayas answered on June 20, 2016 22:00

You can use macros within the Values of a drop down. You can reference other fields just by {% TheFieldName.Value %}

Here's kind of an example that i use, this is in a where condition

{% If(SomeField.Value == "SomeValue" ? "Select * from SomeTable" : "Select * from SomeOtherTable" %}

You can also use macros then instead of a SQL where to build the drop down, to actually do a value thing, like below

{% If(SomeField.Value == "SomethingToTest" ? "Value1;Value 1" : "Value2;Value 2" %}

If this helps, mark as solved for others!

0 votesVote for this answer Mark as a Correct answer

D D answered on June 20, 2016 22:49

I have my drop down as list of options. For example: Text A Text B Text C

Two textbox fields TextA and TextB

Would I switch it to macro expression instead and put the macros in there? ie {% (if dropdownlist.value == "Text A") ? TextA = "" %}

Something like that? Again I apologize for my level of experience.

0 votesVote for this answer Mark as a Correct answer

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