Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple display rules follow neither "and" nor "or" logical progression #493

Closed
tractorcow opened this issue Jul 19, 2016 · 8 comments
Closed

Comments

@tractorcow
Copy link
Contributor

tractorcow commented Jul 19, 2016

Multiple display rules are applied in order, meaning that only the last rule will have any effect on the visibility of a field.

This should either be applied as a fixed "and" or "or" logical behaviour, or allow the user to select one or the other.

E.g. for a single field the following rules are applied in order.

$("select[name='EditableTextField_d97b1']").each(function() {

    $(this).data('userformConditions', function() {

        if($(this).val() == "Some Value") {
            $("#EditableTextField_e1416")
                .show()
                .trigger('userform.field.show');
        } else {
            $("#EditableTextField_e1416")
                .hide()
                .trigger('userform.field.hide');
        }
        if($(this).val() == "Some Other value") {
            $("#EditableTextField_e1416")
                .show()
                .trigger('userform.field.show');
        } else {
            $("#EditableTextField_e1416")
                .hide()
                .trigger('userform.field.hide');
        }
        if($(this).val() == "Yet another value") {
            $("#EditableTextField_e1416")
                .show()
                .trigger('userform.field.show');
        } else {
            $("#EditableTextField_e1416")
                .hide()
                .trigger('userform.field.hide');
        }

    });
@jopaul-10
Copy link

I second this suggestion.

Has this been resolved?

@tractorcow
Copy link
Contributor Author

Nope sorry.

@robbieaverill
Copy link
Contributor

robbieaverill commented Apr 13, 2017

@tractorcow we're going to be looking at this as part of a CWP co-funded item.

Our plan is to implement the same kind of dropdown that exists already on "email recipients" display rules, i.e. "show if all rules are met" or "show if any rule is met".

We'll update the way the javascript is processed as well.

Do you have anything we should keep in mind while doing this?

cc @fspringveldt

@tractorcow
Copy link
Contributor Author

We should keep in mind that users may want some kind of grouping. E.g. (list of conditions separated by or) and (list of conditions separated by or), or vice versa.

@tractorcow
Copy link
Contributor Author

Given the scope of the internally funded request, we will only implement the "or" / "and" toggle at this point. The ability to implement nested groups can be a future iteration.

fspringveldt pushed a commit to fspringveldt/silverstripe-userforms that referenced this issue Apr 24, 2017
fspringveldt pushed a commit to fspringveldt/silverstripe-userforms that referenced this issue Apr 25, 2017
fspringveldt pushed a commit to fspringveldt/silverstripe-userforms that referenced this issue Apr 26, 2017
@jopaul-10
Copy link

Hey all, what about ensuring unique ids on the forms and their elements so that we can have more than one form per page?

@robbieaverill
Copy link
Contributor

Hey @jopaul-10 - you'll find that issue logged separately as #543. It should be fixed/available in the next userforms release.

@tractorcow
Copy link
Contributor Author

Fixed with #575

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants