Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Claire Hewitt 32 posts 59 karma points
    Mar 26, 2013 @ 12:20
    Claire Hewitt
    0

    Issues with conditions on checkboxes

    I posted an issue on here, which seems to have disappeared from the forum - apologies if this ends up being a duplication. The original post was here http://our.umbraco.org/forum/umbraco-pro/contour/39490-Issues-with-conditions-on-checkboxes-form-field-population?p=0#comment144272.

    We are running umbraco v 4.11.4 (Assembly version: 1.0.4780.19111), with Contour 3.0.7

    We have experienced a number of issues with enabling conditions on our forms (which admittedly are rather complex). Most notably, checkboxes are an issue.

    We cannot get conditions to work against a checkbox being ticked at all.  We have tried True, Checked, Yes etc in the related condition, but it doesn't seem to work. Any ideas?

    We have therefore had to use a Checkbox list with only one value on it. This seems to work. however, we have found that it doesn't work if you don't get the Condition on the related form field right first time. If you go in and edit it to the correct value, say, it still fails. We have had to delete the conditions and re-enter them from scratch. In some cases we had to delete the entire form field and start again, and then it would work. 

    we would still like to be able to use the checkbox to enable conditions against, if possible.

     

    Thanks

    Claire

     

  • Clair 36 posts 86 karma points
    Aug 21, 2013 @ 15:07
    Clair
    0

    Have you found a solution for this issue? I'm having exactly the same problem.

  • Comment author was deleted

    Aug 21, 2013 @ 15:20
  • Jonas 123 posts 206 karma points
    Sep 09, 2014 @ 09:39
    Jonas
    0

    And how is it supposed to be used?

    True, Yes, 1 ?

  • Matthew Kirschner 323 posts 611 karma points
    Mar 02, 2016 @ 21:55
    Matthew Kirschner
    0

    I'm having this issue now with Umbraco Forms 4.1.4 .

    I have a checkbox labelled 'Other' that, when checked, should show a textbox. This does not work at all, even with a simple checkbox list.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 02, 2016 @ 22:11
    Dennis Aaen
    0

    Hi Matthew,

    Have you tried the suggestion that Maurice suggests on this issue http://issues.umbraco.org/issue/CON-712

    Hope this works for you.

    /Dennis

  • Matthew Kirschner 323 posts 611 karma points
    Mar 02, 2016 @ 22:27
    Matthew Kirschner
    0

    Thanks for the reply, Dennis.

    Unfortunately, his "fix" was to use radio buttons instead. That's just not gonna work. I'm not sure about his other comment of using 'false' as the condition value.

  • keilo 568 posts 1023 karma points
    Aug 18, 2016 @ 10:47
    keilo
    0

    did you find a solution to this?

    Im having the same issue with showing textbox conditionally based on selection of radio-button value on other field.

    would appreciate if you can shed some light

  • Craig100 1136 posts 2523 karma points c-trib
    Mar 22, 2017 @ 18:05
    Craig100
    0

    Linked to this one too: https://our.umbraco.org/forum/umbraco-forms/80761-problem-with-conditional-fields-not-working. There are quite a few unresolved issues in the issue tracker about conditionals not working.

  • Matthew Kirschner 323 posts 611 karma points
    Mar 22, 2017 @ 18:14
    Matthew Kirschner
    0

    It seems to be a problem that comes and goes with Forms updates.

    I wish this were prioritized, as HQ can't very well advertise conditions when they don't actually work on the controls you're most likely to use them on.

    I'm still looking for a workaround. Guessing that the answer lies somewhere in the UmbracoForms/Assets/umbracoforms-conditions.js file, though there is also some condition logic in UmbracoForms/js/umbraco.forms.js .

  • Craig100 1136 posts 2523 karma points c-trib
    Mar 22, 2017 @ 18:16
    Craig100
    0

    Not to mention it's a "paid for" licence. Or at least it will be when I see it working properly ;)

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 22, 2017 @ 18:28
    Dennis Aaen
    0

    Hi Craig

    Please add your findings to the issue tracker

    Thank you

    /Dennis

  • Matthew Kirschner 323 posts 611 karma points
    Mar 22, 2017 @ 18:37
    Matthew Kirschner
    0

    They've been there since 2014... with some recent duplicates.

  • Craig100 1136 posts 2523 karma points c-trib
    Mar 22, 2017 @ 18:40
  • Matthew Kirschner 323 posts 611 karma points
    Mar 22, 2017 @ 20:04
    Matthew Kirschner
    1

    Okay, I got this to work for me. It was a problem on my end since I'm using a custom view for front-end rendering. Turns out that it's important to maintain certain classes on the front-end form since they're being used to fetch specific elements in the DOM. Those classes are:

    • contourPage
    • contourField

    I think these class dependencies should really be listed on the doc page, which mentions that Form.cshtml is customizable. Some thought should also be given to decoupling the default styles from these classes.

    @Craig100, your issue is different since I can see that your front-end view very closely resembles the original one and includes the classes I listed above. The problem is that you're missing several scripts that should be included with the package. I think something is amiss with your form picker datatype or macro.

    This page might give you some clues.

  • Craig100 1136 posts 2523 karma points c-trib
    Mar 22, 2017 @ 20:12
    Craig100
    0

    Hi Matthew,

    'fraid not. Already have that covered. The only thing I've changed in forms.cshtml is to use ResponsiveBP instead of Bootstrap. Also added a conditional statement to put out the "*indicates madatory field" message (http://issues.umbraco.org/issue/CON-1305). Oh and I'm using more up to date versions of JQuery and the validate scripts, which aren't causing any console errors.

    The problem with the conditional action not working has been there out of the box, before I made any other changes and when I was using the script versions declared in the docs (from asp.net CDN).

    So you're saying you have conditionals working? Do you have a live example? I'm just about to put some js together to see if I can force it to work.

  • Matthew Kirschner 323 posts 611 karma points
    Mar 22, 2017 @ 20:22
    Matthew Kirschner
    1

    Unfortunately, I don't have a live version available just yet as we're still in pre-release.

    Those jQuery scripts are actually only half of the dependencies. The others are being included by /Views/Partials/Forms/Script.cshtml . They are:

    • umbracoforms-dependencies.js
    • umbracoforms.js
    • umbracoforms-conditions.js

    I didn't see those anywhere when I viewed source on your site's form.

    It could very well be that those aren't working out of the box, though it's worth noting that Umbraco Forms doesn't actually work out of the box to begin with. Developers are still required to setup a datatype that makes proper use of the form picker. I found documentation to be rather weak in this area, especially when it comes to using the form picker in the grid editor.

    I actually found it necessary to include the following snippet in my layout in order to properly load those scripts where I needed them:

    @if (TempData["UmbracoForms"] != null)
    {
        foreach (var form in (List<Guid>)TempData["UmbracoForms"])
        {
            Html.RenderAction("Render", "UmbracoForms", new { formId = form, mode = "script" });
        }
    }
    

    Also be sure to add the mode = "form" attribute in your FormPicker view:

    Html.RenderAction("Render", "UmbracoForms", new { formId = g, recordId = recordGuid, mode = "form" });
    

    Hope this helps.

  • Craig100 1136 posts 2523 karma points c-trib
    Mar 22, 2017 @ 20:36
    Craig100
    0

    Hi Matthew,

    I had the mode="form" thing done, because it was clearly in the docs. The other thing, however, was not. Adding your bit of razor got conditionals working for me, so thank you very much.

    A slight complication I faced was the form macro being inserted in an RTE rather than in code in the template. Next I'm going to do a PR on the documentation so it's CLEAR! :)

    Then after that I'm going to eat humble pie and comment on a few previous posts ;)

  • Matthew Kirschner 323 posts 611 karma points
    Mar 22, 2017 @ 20:42
    Matthew Kirschner
    0

    Good idea, I may be doing the same thing tomorrow.

    Glad you got everything working!

Please Sign in or register to post replies

Write your reply to:

Draft