{"action":"created","comment":{"url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/comments/112854871","pull_request_review_id":34199872,"id":112854871,"diff_hunk":"@@ -440,180 +440,27 @@ public function generateConditionalJavascript()\n         $rules = \"\";\n \n         $watch = array();\n-        $watchLoad = array();\n \n         if ($this->Fields()) {\n-            foreach ($this->Fields() as $field) {\n-                $holderSelector = $field->getSelectorHolder();\n-\n-                // Is this Field Show by Default\n-                if (!$field->ShowOnLoad) {\n-                    $default .= \"{$holderSelector}.hide().trigger('userform.field.hide');\\n\";\n-                }\n-\n-                // Check for field dependencies / default\n-                foreach ($field->EffectiveDisplayRules() as $rule) {\n-\n-                    // Get the field which is effected\n-                    $formFieldWatch = EditableFormField::get()->byId($rule->ConditionFieldID);\n-\n-                    // Skip deleted fields\n-                    if (!$formFieldWatch) {\n-                        continue;\n-                    }\n-\n-                    $fieldToWatch = $formFieldWatch->getSelectorField($rule);\n-                    $fieldToWatchOnLoad = $formFieldWatch->getSelectorField($rule, true);\n-\n-                    // show or hide?\n-                    $view = ($rule->Display == 'Hide') ? 'hide' : 'show';\n-                    $opposite = ($view == \"show\") ? \"hide\" : \"show\";\n-\n-                    // what action do we need to keep track of. Something nicer here maybe?\n-                    // @todo encapulsation\n-                    $action = \"change\";\n-\n-                    if ($formFieldWatch instanceof EditableTextField) {\n-                        $action = \"keyup\";\n-                    }\n-\n-                    // is this field a special option field\n-                    $checkboxField = false;\n-                    $radioField = false;\n-\n-                    if (in_array($formFieldWatch->ClassName, array('EditableCheckboxGroupField', 'EditableCheckbox'))) {\n-                        $action = \"click\";\n-                        $checkboxField = true;\n-                    } elseif ($formFieldWatch->ClassName == \"EditableRadioField\") {\n-                        $radioField = true;\n-                    }\n-\n-                    // and what should we evaluate\n-                    switch ($rule->ConditionOption) {\n-                        case 'IsNotBlank':\n-                            $expression = ($checkboxField || $radioField) ? '$(this).is(\":checked\")' :'$(this).val() != \"\"';\n-\n-                            break;\n-                        case 'IsBlank':\n-                            $expression = ($checkboxField || $radioField) ? '!($(this).is(\":checked\"))' : '$(this).val() == \"\"';\n-\n-                            break;\n-                        case 'HasValue':\n-                            if ($checkboxField) {\n-                                $expression = '$(this).prop(\"checked\")';\n-                            } elseif ($radioField) {\n-                                // We cannot simply get the value of the radio group, we need to find the checked option first.\n-                                $expression = '$(this).closest(\".field, .control-group\").find(\"input:checked\").val()==\"'. $rule->FieldValue .'\"';\n-                            } else {\n-                                $expression = '$(this).val() == \"'. $rule->FieldValue .'\"';\n-                            }\n-\n-                            break;\n-                        case 'ValueLessThan':\n-                            $expression = '$(this).val() < parseFloat(\"'. $rule->FieldValue .'\")';\n-\n-                            break;\n-                        case 'ValueLessThanEqual':\n-                            $expression = '$(this).val() <= parseFloat(\"'. $rule->FieldValue .'\")';\n-\n-                            break;\n-                        case 'ValueGreaterThan':\n-                            $expression = '$(this).val() > parseFloat(\"'. $rule->FieldValue .'\")';\n-\n-                            break;\n-                        case 'ValueGreaterThanEqual':\n-                            $expression = '$(this).val() >= parseFloat(\"'. $rule->FieldValue .'\")';\n-\n-                            break;\n-                        default: // ==HasNotValue\n-                            if ($checkboxField) {\n-                                $expression = '!$(this).prop(\"checked\")';\n-                            } elseif ($radioField) {\n-                                // We cannot simply get the value of the radio group, we need to find the checked option first.\n-                                $expression = '$(this).parents(\".field, .control-group\").find(\"input:checked\").val()!=\"'. $rule->FieldValue .'\"';\n-                            } else {\n-                                $expression = '$(this).val() != \"'. $rule->FieldValue .'\"';\n-                            }\n-\n-                            break;\n-                    }\n-\n-                    if (!isset($watch[$fieldToWatch])) {\n-                        $watch[$fieldToWatch] = array();\n-                    }\n-\n-                    $watch[$fieldToWatch][] = array(\n-                        'expression' => $expression,\n-                        'holder_selector' => $holderSelector,\n-                        'view' => $view,\n-                        'opposite' => $opposite,\n-                        'action' => $action\n-                    );\n-\n-                    $watchLoad[$fieldToWatchOnLoad] = true;\n-                }\n+        \t/** @var EditableFormField $field */\n+            foreach ($this->Fields() as $field)\n+\t\t\t{","path":"code/model/UserDefinedForm.php","position":127,"original_position":127,"commit_id":"7dfef4335c55ea0dd3f9d4d72931d8d185d5a7d3","original_commit_id":"7dfef4335c55ea0dd3f9d4d72931d8d185d5a7d3","user":{"login":"robbieaverill","id":5170590,"avatar_url":"https://avatars2.githubusercontent.com/u/5170590?v=3","gravatar_id":"","url":"https://api.github.com/users/robbieaverill","html_url":"https://github.com/robbieaverill","followers_url":"https://api.github.com/users/robbieaverill/followers","following_url":"https://api.github.com/users/robbieaverill/following{/other_user}","gists_url":"https://api.github.com/users/robbieaverill/gists{/gist_id}","starred_url":"https://api.github.com/users/robbieaverill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robbieaverill/subscriptions","organizations_url":"https://api.github.com/users/robbieaverill/orgs","repos_url":"https://api.github.com/users/robbieaverill/repos","events_url":"https://api.github.com/users/robbieaverill/events{/privacy}","received_events_url":"https://api.github.com/users/robbieaverill/received_events","type":"User","site_admin":false},"body":"Brace on same line as control structure","created_at":"2017-04-24T02:05:42Z","updated_at":"2017-04-24T02:13:55Z","html_url":"https://github.com/silverstripe/silverstripe-userforms/pull/575#discussion_r112854871","pull_request_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/575","_links":{"self":{"href":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/comments/112854871"},"html":{"href":"https://github.com/silverstripe/silverstripe-userforms/pull/575#discussion_r112854871"},"pull_request":{"href":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/575"}}},"pull_request":{"url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/575","id":117141440,"html_url":"https://github.com/silverstripe/silverstripe-userforms/pull/575","diff_url":"https://github.com/silverstripe/silverstripe-userforms/pull/575.diff","patch_url":"https://github.com/silverstripe/silverstripe-userforms/pull/575.patch","issue_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/issues/575","number":575,"state":"open","locked":false,"title":"Enhancement: Implemented and/or display rules for UserForms","user":{"login":"fspringveldt","id":10938392,"avatar_url":"https://avatars3.githubusercontent.com/u/10938392?v=3","gravatar_id":"","url":"https://api.github.com/users/fspringveldt","html_url":"https://github.com/fspringveldt","followers_url":"https://api.github.com/users/fspringveldt/followers","following_url":"https://api.github.com/users/fspringveldt/following{/other_user}","gists_url":"https://api.github.com/users/fspringveldt/gists{/gist_id}","starred_url":"https://api.github.com/users/fspringveldt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fspringveldt/subscriptions","organizations_url":"https://api.github.com/users/fspringveldt/orgs","repos_url":"https://api.github.com/users/fspringveldt/repos","events_url":"https://api.github.com/users/fspringveldt/events{/privacy}","received_events_url":"https://api.github.com/users/fspringveldt/received_events","type":"User","site_admin":false},"body":"Issue fixes #493.","created_at":"2017-04-23T08:44:52Z","updated_at":"2017-04-24T02:13:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8fcb6bb9c4f9ea101ccacc26202501ffe634396d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/575/commits","review_comments_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/575/comments","review_comment_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/issues/575/comments","statuses_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/statuses/7dfef4335c55ea0dd3f9d4d72931d8d185d5a7d3","head":{"label":"fspringveldt:4.2","ref":"4.2","sha":"7dfef4335c55ea0dd3f9d4d72931d8d185d5a7d3","user":{"login":"fspringveldt","id":10938392,"avatar_url":"https://avatars3.githubusercontent.com/u/10938392?v=3","gravatar_id":"","url":"https://api.github.com/users/fspringveldt","html_url":"https://github.com/fspringveldt","followers_url":"https://api.github.com/users/fspringveldt/followers","following_url":"https://api.github.com/users/fspringveldt/following{/other_user}","gists_url":"https://api.github.com/users/fspringveldt/gists{/gist_id}","starred_url":"https://api.github.com/users/fspringveldt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fspringveldt/subscriptions","organizations_url":"https://api.github.com/users/fspringveldt/orgs","repos_url":"https://api.github.com/users/fspringveldt/repos","events_url":"https://api.github.com/users/fspringveldt/events{/privacy}","received_events_url":"https://api.github.com/users/fspringveldt/received_events","type":"User","site_admin":false},"repo":{"id":88451847,"name":"silverstripe-userforms","full_name":"fspringveldt/silverstripe-userforms","owner":{"login":"fspringveldt","id":10938392,"avatar_url":"https://avatars3.githubusercontent.com/u/10938392?v=3","gravatar_id":"","url":"https://api.github.com/users/fspringveldt","html_url":"https://github.com/fspringveldt","followers_url":"https://api.github.com/users/fspringveldt/followers","following_url":"https://api.github.com/users/fspringveldt/following{/other_user}","gists_url":"https://api.github.com/users/fspringveldt/gists{/gist_id}","starred_url":"https://api.github.com/users/fspringveldt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fspringveldt/subscriptions","organizations_url":"https://api.github.com/users/fspringveldt/orgs","repos_url":"https://api.github.com/users/fspringveldt/repos","events_url":"https://api.github.com/users/fspringveldt/events{/privacy}","received_events_url":"https://api.github.com/users/fspringveldt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fspringveldt/silverstripe-userforms","description":"UserForms module provides a visual form builder for the SilverStripe CMS. No coding required to build forms such as contact pages.","fork":true,"url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms","forks_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/forks","keys_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/teams","hooks_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/hooks","issue_events_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/issues/events{/number}","events_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/events","assignees_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/assignees{/user}","branches_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/branches{/branch}","tags_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/tags","blobs_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/git/refs{/sha}","trees_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/statuses/{sha}","languages_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/languages","stargazers_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/stargazers","contributors_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/contributors","subscribers_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/subscribers","subscription_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/subscription","commits_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/commits{/sha}","git_commits_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/git/commits{/sha}","comments_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/comments{/number}","issue_comment_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/issues/comments{/number}","contents_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/contents/{+path}","compare_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/merges","archive_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/downloads","issues_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/issues{/number}","pulls_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/pulls{/number}","milestones_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/milestones{/number}","notifications_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/labels{/name}","releases_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/releases{/id}","deployments_url":"https://api.github.com/repos/fspringveldt/silverstripe-userforms/deployments","created_at":"2017-04-17T00:31:41Z","updated_at":"2017-04-17T00:31:43Z","pushed_at":"2017-04-24T01:57:28Z","git_url":"git://github.com/fspringveldt/silverstripe-userforms.git","ssh_url":"git@github.com:fspringveldt/silverstripe-userforms.git","clone_url":"https://github.com/fspringveldt/silverstripe-userforms.git","svn_url":"https://github.com/fspringveldt/silverstripe-userforms","homepage":"","size":7824,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"silverstripe:4.2","ref":"4.2","sha":"5b6c16dbd6b5ebe8266a49b7b0e2b63785a11b17","user":{"login":"silverstripe","id":379348,"avatar_url":"https://avatars3.githubusercontent.com/u/379348?v=3","gravatar_id":"","url":"https://api.github.com/users/silverstripe","html_url":"https://github.com/silverstripe","followers_url":"https://api.github.com/users/silverstripe/followers","following_url":"https://api.github.com/users/silverstripe/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe/subscriptions","organizations_url":"https://api.github.com/users/silverstripe/orgs","repos_url":"https://api.github.com/users/silverstripe/repos","events_url":"https://api.github.com/users/silverstripe/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe/received_events","type":"Organization","site_admin":false},"repo":{"id":1247754,"name":"silverstripe-userforms","full_name":"silverstripe/silverstripe-userforms","owner":{"login":"silverstripe","id":379348,"avatar_url":"https://avatars3.githubusercontent.com/u/379348?v=3","gravatar_id":"","url":"https://api.github.com/users/silverstripe","html_url":"https://github.com/silverstripe","followers_url":"https://api.github.com/users/silverstripe/followers","following_url":"https://api.github.com/users/silverstripe/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe/subscriptions","organizations_url":"https://api.github.com/users/silverstripe/orgs","repos_url":"https://api.github.com/users/silverstripe/repos","events_url":"https://api.github.com/users/silverstripe/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/silverstripe/silverstripe-userforms","description":"UserForms module provides a visual form builder for the SilverStripe CMS. No coding required to build forms such as contact pages.","fork":false,"url":"https://api.github.com/repos/silverstripe/silverstripe-userforms","forks_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/forks","keys_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/teams","hooks_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/hooks","issue_events_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/issues/events{/number}","events_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/events","assignees_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/assignees{/user}","branches_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/branches{/branch}","tags_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/tags","blobs_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/git/refs{/sha}","trees_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/statuses/{sha}","languages_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/languages","stargazers_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/stargazers","contributors_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/contributors","subscribers_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/subscribers","subscription_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/subscription","commits_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/commits{/sha}","git_commits_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/git/commits{/sha}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/comments{/number}","issue_comment_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/issues/comments{/number}","contents_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/contents/{+path}","compare_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/merges","archive_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/downloads","issues_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/issues{/number}","pulls_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls{/number}","milestones_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/milestones{/number}","notifications_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/labels{/name}","releases_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/releases{/id}","deployments_url":"https://api.github.com/repos/silverstripe/silverstripe-userforms/deployments","created_at":"2011-01-12T20:46:46Z","updated_at":"2017-04-12T06:30:22Z","pushed_at":"2017-04-24T01:57:29Z","git_url":"git://github.com/silverstripe/silverstripe-userforms.git","ssh_url":"git@github.com:silverstripe/silverstripe-userforms.git","clone_url":"https://github.com/silverstripe/silverstripe-userforms.git","svn_url":"https://github.com/silverstripe/silverstripe-userforms","homepage":"","size":7823,"stargazers_count":124,"watchers_count":124,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":173,"mirror_url":null,"open_issues_count":85,"forks":173,"open_issues":85,"watchers":124,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/575"},"html":{"href":"https://github.com/silverstripe/silverstripe-userforms/pull/575"},"issue":{"href":"https://api.github.com/repos/silverstripe/silverstripe-userforms/issues/575"},"comments":{"href":"https://api.github.com/repos/silverstripe/silverstripe-userforms/issues/575/comments"},"review_comments":{"href":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/575/comments"},"review_comment":{"href":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/silverstripe/silverstripe-userforms/pulls/575/commits"},"statuses":{"href":"https://api.github.com/repos/silverstripe/silverstripe-userforms/statuses/7dfef4335c55ea0dd3f9d4d72931d8d185d5a7d3"}}}}
{"actor":{"display_login":"robbieaverill"}}