Webforms for marketers form fields conditional vis

2019-03-20 18:49发布

问题:

We are using WFFM for our landing pages creation. It is very easy for our marketing guys to use that. Now, we are looking at customizing them. For instance, we have the following requirement.

On our form, we display country of residence, but when you select some countries, we want to display one more dropdown called state/province with the states. When user selects other countries, we have to hide the state/provice field. I am banging my head, how can I start implementing this.

Can anyone of you guide me, how to proceed?

回答1:

Try the following:

  1. Create a DropList field on your form in Sitecore
  2. Add an Option named something like "NA" (signifying "Not Applicable")
  3. Mark the field as required
  4. Click on the "Edit" button, under "Rules" in the left pane
  5. In the left box, scroll down to the "Fields" category and enter the relevant information into the "where specific field compares to specific value
  6. In the right box, select "hide element", under the "Actions" category


回答2:

I had problems getting this working on Sitecore 7.5 (rev. 141003).

I have not tried the following instructions out yet, but here is what I eventually was able to get from Sitecore support:

It looks like the reported behavior is caused by the previously registered bug with the 67793 reference number. More information about public reference numbers can be found here: https://kb.sitecore.net/articles/853187

Please try applying the following patch to see if it helps:

  1. Put the attached "Sitecore.Support.401148.dll" assembly into the "\bin" folder.

  2. Change the type field values for item information rules(rule content path -> Type field value):

/sitecore/system/Settings/Rules/Definitions/Elements/Item Information/Item ID -> Sitecore.Support.Rules.Conditions.ItemConditions.ItemIdCondition,Sitecore.Support.401148

/sitecore/system/Settings/Rules/Definitions/Elements/Item Information/Item Name -> Sitecore.Support.Rules.Conditions.ItemConditions.ItemNameCondition,Sitecore.Support.401148

/sitecore/system/Settings/Rules/Definitions/Elements/Item Information/Item Template -> Sitecore.Support.Rules.Conditions.ItemConditions.WhenTemplateIs,Sitecore.Support.401148

  1. Change the type field values for "Fields" rules(the rule content path -> the "Type" field value): /sitecore/system/Settings/Rules/Definitions/Elements/Fields/Field -> Sitecore.Support.Rules.Conditions.FieldConditions.WhenField,Sitecore.Support.401148

/sitecore/system/Settings/Rules/Definitions/Elements/Fields/Field is Empty -> Sitecore.Support.Rules.Conditions.FieldConditions.FieldEmpty,Sitecore.Support.401148

/sitecore/system/Settings/Rules/Definitions/Elements/Fields/Has Specific Field Type -> Sitecore.Support.Rules.Conditions.FieldConditions.WhenHasSpecificFieldType,Sitecore.Support.401148