0

We are trying to hide some form field based on some condition but the existing Rules Action hides the filed from the server side.
We will be storing some value in field and these values will be submitted with form submission and it will come on the report.
Is there any way to hide field on client side with the help of WFFM personalization rules/action?
Any small code or reference will help.

1 Answer 1

0

I got the solution to my problem -
We have added a custom action and registered this action under

/sitecore/system/Settings/Rules/Definitions/Elements/Web Forms for Marketers Actions
enter image description here

   public class HideFormControl<T> : Sitecore.Forms.Core.Rules.ReadValueFromQueryString<T> where T : Sitecore.Forms.Core.Rules.ConditionalRuleContext
{
    public HideFormControl()
    {

    }
    public override void Apply(T ruleContext)
    {

        Assert.ArgumentNotNull(ruleContext, "ruleContext");

        if (ruleContext.Model != null && ruleContext.Model is FieldViewModel)
        {
            FieldViewModel field = ((FieldViewModel)ruleContext.Model);
            field.Visible = false;
        }
    }

}

apply action on field -enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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