Bug: Executing only one conditional action for one element #64

Closed
kevinscholz opened this Issue Oct 14, 2012 · 3 comments

Projects

None yet

3 participants

When you define conditional actions in SS there will only be one executed with javascript.

To solve this problem I modified the code as following:

File: userforms/code/model/UserDefinedForm.php
Lines: 638-647

// Register conditional behaviour with an element, so it can be triggered from many places.
                            $rules .= $fieldToWatch.".each(function() {
                                // If a rule is already defined for this element
                                if($(this).data('userformConditions') != null) {
                                        var alreadyDefinedFunction = $(this).data('userformConditions');
                                    }
                                $(this).data('userformConditions', function() {
                                    if(alreadyDefinedFunction != null) {
                                        alreadyDefinedFunction.call(this);
                                    }
                                    if(". $expression ." ) {
                                        $(\"#". $fieldId ."\").".$view."();
                                    }
                                    else {
                                        $(\"#". $fieldId ."\").".$opposite."();
                                    }
                                });
                            });";
Owner
wilr commented Oct 18, 2012

Does this only allow us to execute 2 conditionals then?

Same issue for me - this code did fix the problem as stated.

Owner
wilr commented Mar 4, 2013

Fixed in a slightly different way in 527b637.

Thanks.

@wilr wilr closed this Mar 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment