I have a drop down and I want to show/hide a fieldset dependent on its value.
I have set this up as follows:
When I view the form on the frontend I can see that there is "display:none" on that fieldset, which is correct but when I change the value of my dropdown to "New homes" it doesn't show it.
The question and the fieldset are on the same page but I'd still expect it to work.
I found the issue. The Partials\Forms\Form view needs to contain the surrounding <div class="countourPage"> for this to work.
We'd removed it to style the form as we didn't think it'd actually be use for how Forms work as there are plenty of other ways of targeting the form....
only adding a <div class="contourPage"> around the partials didn't fix the problem for me so I investigated a little further. This is my fix (will try to provide this fix asap to UmbracoForms):
I didn't wrap the partials with the contourPage class
in Views\Partials\Forms\Script.cshtml I changed the selector of the form:
var contourFieldValues,
recordValues = JSON.parse($("#values_" + formId).val()),
fsConditions = JSON.parse($("#fsConditions_" + formId).val()),
fieldConditions = JSON.parse($("#fieldConditions_" + formId).val()),
form = $("#umbraco_form_" + formId); // this was #contour_form_
Conditional logic not working v6.0
I have a drop down and I want to show/hide a fieldset dependent on its value.
I have set this up as follows:
When I view the form on the frontend I can see that there is "display:none" on that fieldset, which is correct but when I change the value of my dropdown to "New homes" it doesn't show it.
The question and the fieldset are on the same page but I'd still expect it to work.
Is this a bug?
Thanks
Ben
I've spotted the following hidden field on the form, not sure if this is right or not...:
Issue created here, please vote up
http://issues.umbraco.org/issue/CON-1347
Same problem here. Tried with old and new Views files but no difference. Downgraded to 4.4.2 and it works fine.
I found the issue. The Partials\Forms\Form view needs to contain the surrounding
<div class="countourPage">
for this to work.We'd removed it to style the form as we didn't think it'd actually be use for how Forms work as there are plenty of other ways of targeting the form....
Hi Ben,
only adding a
<div class="contourPage">
around the partials didn't fix the problem for me so I investigated a little further. This is my fix (will try to provide this fix asap to UmbracoForms):in Views\Partials\Forms\Script.cshtml I changed the selector of the form:
also I changed the input selectors a bit:
lastly, I made sure the id of the form was correct, in Views\Partials\Forms\Themes\default\Render.cshtml:
<div id="umbraco_form_****Model.FormClientId">
Hope this is also helpful to others!
Erik
There's an existing issue regarding the use of class names in important Forms scripts. Comment and upvote here: http://issues.umbraco.org/issue/CON-1314
Just as a small addition, you might want to edit the ready function to follow the changes @Ben outlines:
And if you get the dreaded
Uncaught TypeError: umbracoForms.conditions.handle is not a function
error change the CheckRules method to the following:is working on a reply...