One field visibility condition depend on another two fields

Kaur Navneet asked on September 5, 2024 07:45

Hello Guys,

I have created a kentico13 form with form builder and I have one field i.e. dependent on two fields, In Kentico 11 I have used Visibilty Condition : Option1.Value.Contains("Guided reduction") || Option2.Value.Contains("Full guidedreduction,") But In kentico 13, we have not any Condition that one field depends upon two fields.

Is there any specific setting for this where we can change the behavior of this.

Recent Answers


Juraj Ondrus answered on September 5, 2024 08:20

I would either create custom form component consisting of all the fields you need and do the logic in the code of this component or, you can add a custom visibility condition.

0 votesVote for this answer Mark as a Correct answer

Vishal Bhatt answered on September 5, 2024 09:06

@Juraj the question is we have field A,B and C. If I want to add the visibility condition on field C as per the value of A and B . I mean if Field A value is 10 or B value is 15 then only we have to visible field C. Can we achieve it by custom component please suggest.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 5, 2024 09:07

Yes, you will have custom component which will contain all 3 fields in it and in the code logic you can easily define which one to display based on the rules and conditions you want.

0 votesVote for this answer Mark as a Correct answer

Vishal Bhatt answered on September 5, 2024 09:09

Thanks Juraj will implement and try it.

0 votesVote for this answer Mark as a Correct answer

Vishal Bhatt answered on September 5, 2024 09:44

@Juraj i have created a custom visibility condition component that component allows me to select one field where the current field is dependent, but that field is dependent on two fields. Could you please help on this?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 5, 2024 09:54

How is the visibility condition developed? Are you checking both fields in the custom code logic or not? Or, maybe the custom component way would be better.

0 votesVote for this answer Mark as a Correct answer

Vishal Bhatt answered on September 5, 2024 10:09 (last edited on September 5, 2024 10:11)

I am using this

    public class VisibilityConditions : AnotherFieldVisibilityCondition<string>
{
    [EditingComponent(TextInputComponent.IDENTIFIER, Label = "Field1")]
    public string Field1{ get; set; }
    [EditingComponent(TextInputComponent.IDENTIFIER, Label = "Field2")]
    public string Field2 { get; set; }

    public override bool IsVisible()
    {

    }
}

But I don't know how I will get the values of Field1 and Field2.

0 votesVote for this answer Mark as a Correct answer

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