3

I have a web page with two placeholders, A and B. In Sitecore I inserted a WFFM form in placeholder B.

Based on a the value of a checkbox in Sitecore, I want the WFFM form to be inserted into either placeholder A or B, at runtime (i.e not permanently).

E.g:

the checkbox is checked --> the form is inserted in placeholder A the checkbox is not checked --> the form is inserted in placeholder B

Does anyone have experience with this?

6

You can do this using conditional rendering rules.

You would need to add the Form to the page twice, but it will only get rendered once.

Take this example. I have 2 promo renderings and I want them to render based on the value of a field (could be a checkbox) on an item:

enter image description here

Now add a new rule:

enter image description here

In the rule, you can use the where the **specific** field **compares to** **value** condition.

This will use a field on the context item to determine true/false.

enter image description here

Now you can either hide the component as default and show when the rule meets the conditions. Then add the form a second time, add the condition, but set the opposite options for hiding/showing. And put the 2 renderings into the different placeholders.

This way you don't have to do any extra coding.

If the field you need is not on the context item, you may need to create a custom condition so that you can specify the item as well as the field.

I have used this method before and it has worked well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.