Copied to clipboard

Flag this post as spam?

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


  • SGB 27 posts 73 karma points
    Nov 05, 2015 @ 10:59
    SGB
    0

    Umbraco Forms - Conditions. Hide field as default doesn't work

    Hey everyone

    I am trying to add conditions to my Umbraco Form and having some troubles. I hope some one can help me :)

    I want to have two fields, lets say A and B (both RadioButtonLists).

    I want to hide B unless the value of A is 1. This doesn't work. B is not hidden when you enter the site. I can hide it by adding "display:none;" to the field in my inspector in Chrome, then it will show when you chose the right value in A (1). But it's not hidden as default. The client needs to be able to add forms himself, so unfortunately it's not really an option to always style some fields to be hidden, when creating a form.

    If I turn the conditions around and hide B when A is 2, then everything works fine btw. This is not really a solution for the client either though.

    Has anyone experienced the same problem and been able to fix it somehow?

    Best regards

    Signe

  • SGB 27 posts 73 karma points
    Nov 16, 2015 @ 10:50
    SGB
    0

    I think this might be a (pretty critical, if you ask me) bug in Forms, as I see the following code in the umbracoforms-conditions.js :

     function handleCondition(element, id, condition) {
            var shouldShow = isVisible(id, condition);
            if (shouldShow) {
                console.log("showing " + id + "\n");
                element.show();
            } else {
                console.log("hiding " + id + "\n");
                element.hide();
            }
        }
    

    So the code for hiding the element IS present, it just doesn't work. On page load, B is NEVER hidden, even though thats the condition set up in backend. Also it seems like the condition calculations for each field is not being updated even though new selections/choises are made in the form in the frontend (by the visitor). So the condition js never really runs properly. This issue seems somewhat related to what we're experiencing: http://issues.umbraco.org/issue/CON-805

    All in all I don't see how Conditions is working correctly at all.

    This is a bug on both fields and fieldsets btw.

Please Sign in or register to post replies

Write your reply to:

Draft