{"action":"created","comment":{"url":"https://api.github.com/repos/STEPIndia/get-red/pulls/comments/28159019","id":28159019,"diff_hunk":"@@ -44,15 +44,44 @@ getBlood.controller('GetBloodCtrl', [\n     }\n \n     function validate(data) {\n-      var result = true;\n+      var result = {\n+          \"valid\": true,\n+          \"message\":\" \"};\n+        \n+        var regular_expression = /\\S+@\\S+\\.\\S+/;\n+        \n+        console.log(\"Evaluating mobile length:\" + $scope.user.phone);\n+        console.log(\"Name: \" + $scope.user.name);\n \n-      // FIXME: Perform better validation\n       if (_.isEmpty(data.name) && _.isEmpty(data.phone) &&\n           _.isEmpty(data.address) && _.isEmpty(data.group) &&\n           _.isEmpty(data.quantity) && _.isEmpty(data.date)) {\n-        result = false;\n+          result.valid = false;\n+          result.message = \"All the fields are empty\";\n+          return result;\n+      } \n+        \n+         if($scope.user.name.length < 3 ){\n+         result.valid = false;\n+         result.message = \"Name field contains string either too short!\"\n+         return result;\n       }\n-\n+        \n+        if(\n+           validateName($scope.user.name)\n+        ) {\n+            result.valid = false;\n+            result.message = \"Name field contains illegal characters\";\n+            return result;\n+        }\n+        \n+            \n+        if($scope.user.phone.length != 10) {","path":"app/js/getblood.js","position":40,"original_position":40,"commit_id":"de99cd2193736fb3c8b2041494fcc509db08e317","original_commit_id":"de99cd2193736fb3c8b2041494fcc509db08e317","user":{"login":"darkowlzz","id":614105,"avatar_url":"https://avatars.githubusercontent.com/u/614105?v=3","gravatar_id":"","url":"https://api.github.com/users/darkowlzz","html_url":"https://github.com/darkowlzz","followers_url":"https://api.github.com/users/darkowlzz/followers","following_url":"https://api.github.com/users/darkowlzz/following{/other_user}","gists_url":"https://api.github.com/users/darkowlzz/gists{/gist_id}","starred_url":"https://api.github.com/users/darkowlzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darkowlzz/subscriptions","organizations_url":"https://api.github.com/users/darkowlzz/orgs","repos_url":"https://api.github.com/users/darkowlzz/repos","events_url":"https://api.github.com/users/darkowlzz/events{/privacy}","received_events_url":"https://api.github.com/users/darkowlzz/received_events","type":"User","site_admin":false},"body":"Use `data.phone`","created_at":"2015-04-10T16:25:31Z","updated_at":"2015-04-10T16:25:31Z","html_url":"https://github.com/STEPIndia/get-red/pull/12#discussion_r28159019","pull_request_url":"https://api.github.com/repos/STEPIndia/get-red/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/STEPIndia/get-red/pulls/comments/28159019"},"html":{"href":"https://github.com/STEPIndia/get-red/pull/12#discussion_r28159019"},"pull_request":{"href":"https://api.github.com/repos/STEPIndia/get-red/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/STEPIndia/get-red/pulls/12","id":32969646,"html_url":"https://github.com/STEPIndia/get-red/pull/12","diff_url":"https://github.com/STEPIndia/get-red/pull/12.diff","patch_url":"https://github.com/STEPIndia/get-red/pull/12.patch","issue_url":"https://api.github.com/repos/STEPIndia/get-red/issues/12","number":12,"state":"open","locked":false,"title":"Basic form validation","user":{"login":"Bharathvijay","id":7747324,"avatar_url":"https://avatars.githubusercontent.com/u/7747324?v=3","gravatar_id":"","url":"https://api.github.com/users/Bharathvijay","html_url":"https://github.com/Bharathvijay","followers_url":"https://api.github.com/users/Bharathvijay/followers","following_url":"https://api.github.com/users/Bharathvijay/following{/other_user}","gists_url":"https://api.github.com/users/Bharathvijay/gists{/gist_id}","starred_url":"https://api.github.com/users/Bharathvijay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bharathvijay/subscriptions","organizations_url":"https://api.github.com/users/Bharathvijay/orgs","repos_url":"https://api.github.com/users/Bharathvijay/repos","events_url":"https://api.github.com/users/Bharathvijay/events{/privacy}","received_events_url":"https://api.github.com/users/Bharathvijay/received_events","type":"User","site_admin":false},"body":"Done with the basic form validation . Please do check it and review !","created_at":"2015-04-09T15:58:57Z","updated_at":"2015-04-10T16:25:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"363548a360ebd931f55794674a47b613bf28475a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/STEPIndia/get-red/pulls/12/commits","review_comments_url":"https://api.github.com/repos/STEPIndia/get-red/pulls/12/comments","review_comment_url":"https://api.github.com/repos/STEPIndia/get-red/pulls/comments{/number}","comments_url":"https://api.github.com/repos/STEPIndia/get-red/issues/12/comments","statuses_url":"https://api.github.com/repos/STEPIndia/get-red/statuses/de99cd2193736fb3c8b2041494fcc509db08e317","head":{"label":"Bharathvijay:master","ref":"master","sha":"de99cd2193736fb3c8b2041494fcc509db08e317","user":{"login":"Bharathvijay","id":7747324,"avatar_url":"https://avatars.githubusercontent.com/u/7747324?v=3","gravatar_id":"","url":"https://api.github.com/users/Bharathvijay","html_url":"https://github.com/Bharathvijay","followers_url":"https://api.github.com/users/Bharathvijay/followers","following_url":"https://api.github.com/users/Bharathvijay/following{/other_user}","gists_url":"https://api.github.com/users/Bharathvijay/gists{/gist_id}","starred_url":"https://api.github.com/users/Bharathvijay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bharathvijay/subscriptions","organizations_url":"https://api.github.com/users/Bharathvijay/orgs","repos_url":"https://api.github.com/users/Bharathvijay/repos","events_url":"https://api.github.com/users/Bharathvijay/events{/privacy}","received_events_url":"https://api.github.com/users/Bharathvijay/received_events","type":"User","site_admin":false},"repo":{"id":33677029,"name":"get-red","full_name":"Bharathvijay/get-red","owner":{"login":"Bharathvijay","id":7747324,"avatar_url":"https://avatars.githubusercontent.com/u/7747324?v=3","gravatar_id":"","url":"https://api.github.com/users/Bharathvijay","html_url":"https://github.com/Bharathvijay","followers_url":"https://api.github.com/users/Bharathvijay/followers","following_url":"https://api.github.com/users/Bharathvijay/following{/other_user}","gists_url":"https://api.github.com/users/Bharathvijay/gists{/gist_id}","starred_url":"https://api.github.com/users/Bharathvijay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bharathvijay/subscriptions","organizations_url":"https://api.github.com/users/Bharathvijay/orgs","repos_url":"https://api.github.com/users/Bharathvijay/repos","events_url":"https://api.github.com/users/Bharathvijay/events{/privacy}","received_events_url":"https://api.github.com/users/Bharathvijay/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Bharathvijay/get-red","description":"","fork":true,"url":"https://api.github.com/repos/Bharathvijay/get-red","forks_url":"https://api.github.com/repos/Bharathvijay/get-red/forks","keys_url":"https://api.github.com/repos/Bharathvijay/get-red/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Bharathvijay/get-red/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Bharathvijay/get-red/teams","hooks_url":"https://api.github.com/repos/Bharathvijay/get-red/hooks","issue_events_url":"https://api.github.com/repos/Bharathvijay/get-red/issues/events{/number}","events_url":"https://api.github.com/repos/Bharathvijay/get-red/events","assignees_url":"https://api.github.com/repos/Bharathvijay/get-red/assignees{/user}","branches_url":"https://api.github.com/repos/Bharathvijay/get-red/branches{/branch}","tags_url":"https://api.github.com/repos/Bharathvijay/get-red/tags","blobs_url":"https://api.github.com/repos/Bharathvijay/get-red/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Bharathvijay/get-red/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Bharathvijay/get-red/git/refs{/sha}","trees_url":"https://api.github.com/repos/Bharathvijay/get-red/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Bharathvijay/get-red/statuses/{sha}","languages_url":"https://api.github.com/repos/Bharathvijay/get-red/languages","stargazers_url":"https://api.github.com/repos/Bharathvijay/get-red/stargazers","contributors_url":"https://api.github.com/repos/Bharathvijay/get-red/contributors","subscribers_url":"https://api.github.com/repos/Bharathvijay/get-red/subscribers","subscription_url":"https://api.github.com/repos/Bharathvijay/get-red/subscription","commits_url":"https://api.github.com/repos/Bharathvijay/get-red/commits{/sha}","git_commits_url":"https://api.github.com/repos/Bharathvijay/get-red/git/commits{/sha}","comments_url":"https://api.github.com/repos/Bharathvijay/get-red/comments{/number}","issue_comment_url":"https://api.github.com/repos/Bharathvijay/get-red/issues/comments{/number}","contents_url":"https://api.github.com/repos/Bharathvijay/get-red/contents/{+path}","compare_url":"https://api.github.com/repos/Bharathvijay/get-red/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Bharathvijay/get-red/merges","archive_url":"https://api.github.com/repos/Bharathvijay/get-red/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Bharathvijay/get-red/downloads","issues_url":"https://api.github.com/repos/Bharathvijay/get-red/issues{/number}","pulls_url":"https://api.github.com/repos/Bharathvijay/get-red/pulls{/number}","milestones_url":"https://api.github.com/repos/Bharathvijay/get-red/milestones{/number}","notifications_url":"https://api.github.com/repos/Bharathvijay/get-red/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Bharathvijay/get-red/labels{/name}","releases_url":"https://api.github.com/repos/Bharathvijay/get-red/releases{/id}","created_at":"2015-04-09T15:31:07Z","updated_at":"2015-04-09T15:56:38Z","pushed_at":"2015-04-09T15:56:38Z","git_url":"git://github.com/Bharathvijay/get-red.git","ssh_url":"git@github.com:Bharathvijay/get-red.git","clone_url":"https://github.com/Bharathvijay/get-red.git","svn_url":"https://github.com/Bharathvijay/get-red","homepage":null,"size":278,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"STEPIndia:master","ref":"master","sha":"10ff0183b5d5fd0bd5ffde03a90ab33e83726cef","user":{"login":"STEPIndia","id":11378316,"avatar_url":"https://avatars.githubusercontent.com/u/11378316?v=3","gravatar_id":"","url":"https://api.github.com/users/STEPIndia","html_url":"https://github.com/STEPIndia","followers_url":"https://api.github.com/users/STEPIndia/followers","following_url":"https://api.github.com/users/STEPIndia/following{/other_user}","gists_url":"https://api.github.com/users/STEPIndia/gists{/gist_id}","starred_url":"https://api.github.com/users/STEPIndia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/STEPIndia/subscriptions","organizations_url":"https://api.github.com/users/STEPIndia/orgs","repos_url":"https://api.github.com/users/STEPIndia/repos","events_url":"https://api.github.com/users/STEPIndia/events{/privacy}","received_events_url":"https://api.github.com/users/STEPIndia/received_events","type":"Organization","site_admin":false},"repo":{"id":32081376,"name":"get-red","full_name":"STEPIndia/get-red","owner":{"login":"STEPIndia","id":11378316,"avatar_url":"https://avatars.githubusercontent.com/u/11378316?v=3","gravatar_id":"","url":"https://api.github.com/users/STEPIndia","html_url":"https://github.com/STEPIndia","followers_url":"https://api.github.com/users/STEPIndia/followers","following_url":"https://api.github.com/users/STEPIndia/following{/other_user}","gists_url":"https://api.github.com/users/STEPIndia/gists{/gist_id}","starred_url":"https://api.github.com/users/STEPIndia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/STEPIndia/subscriptions","organizations_url":"https://api.github.com/users/STEPIndia/orgs","repos_url":"https://api.github.com/users/STEPIndia/repos","events_url":"https://api.github.com/users/STEPIndia/events{/privacy}","received_events_url":"https://api.github.com/users/STEPIndia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/STEPIndia/get-red","description":"","fork":false,"url":"https://api.github.com/repos/STEPIndia/get-red","forks_url":"https://api.github.com/repos/STEPIndia/get-red/forks","keys_url":"https://api.github.com/repos/STEPIndia/get-red/keys{/key_id}","collaborators_url":"https://api.github.com/repos/STEPIndia/get-red/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/STEPIndia/get-red/teams","hooks_url":"https://api.github.com/repos/STEPIndia/get-red/hooks","issue_events_url":"https://api.github.com/repos/STEPIndia/get-red/issues/events{/number}","events_url":"https://api.github.com/repos/STEPIndia/get-red/events","assignees_url":"https://api.github.com/repos/STEPIndia/get-red/assignees{/user}","branches_url":"https://api.github.com/repos/STEPIndia/get-red/branches{/branch}","tags_url":"https://api.github.com/repos/STEPIndia/get-red/tags","blobs_url":"https://api.github.com/repos/STEPIndia/get-red/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/STEPIndia/get-red/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/STEPIndia/get-red/git/refs{/sha}","trees_url":"https://api.github.com/repos/STEPIndia/get-red/git/trees{/sha}","statuses_url":"https://api.github.com/repos/STEPIndia/get-red/statuses/{sha}","languages_url":"https://api.github.com/repos/STEPIndia/get-red/languages","stargazers_url":"https://api.github.com/repos/STEPIndia/get-red/stargazers","contributors_url":"https://api.github.com/repos/STEPIndia/get-red/contributors","subscribers_url":"https://api.github.com/repos/STEPIndia/get-red/subscribers","subscription_url":"https://api.github.com/repos/STEPIndia/get-red/subscription","commits_url":"https://api.github.com/repos/STEPIndia/get-red/commits{/sha}","git_commits_url":"https://api.github.com/repos/STEPIndia/get-red/git/commits{/sha}","comments_url":"https://api.github.com/repos/STEPIndia/get-red/comments{/number}","issue_comment_url":"https://api.github.com/repos/STEPIndia/get-red/issues/comments{/number}","contents_url":"https://api.github.com/repos/STEPIndia/get-red/contents/{+path}","compare_url":"https://api.github.com/repos/STEPIndia/get-red/compare/{base}...{head}","merges_url":"https://api.github.com/repos/STEPIndia/get-red/merges","archive_url":"https://api.github.com/repos/STEPIndia/get-red/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/STEPIndia/get-red/downloads","issues_url":"https://api.github.com/repos/STEPIndia/get-red/issues{/number}","pulls_url":"https://api.github.com/repos/STEPIndia/get-red/pulls{/number}","milestones_url":"https://api.github.com/repos/STEPIndia/get-red/milestones{/number}","notifications_url":"https://api.github.com/repos/STEPIndia/get-red/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/STEPIndia/get-red/labels{/name}","releases_url":"https://api.github.com/repos/STEPIndia/get-red/releases{/id}","created_at":"2015-03-12T14:29:08Z","updated_at":"2015-04-07T14:54:14Z","pushed_at":"2015-04-09T15:58:57Z","git_url":"git://github.com/STEPIndia/get-red.git","ssh_url":"git@github.com:STEPIndia/get-red.git","clone_url":"https://github.com/STEPIndia/get-red.git","svn_url":"https://github.com/STEPIndia/get-red","homepage":null,"size":463,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/STEPIndia/get-red/pulls/12"},"html":{"href":"https://github.com/STEPIndia/get-red/pull/12"},"issue":{"href":"https://api.github.com/repos/STEPIndia/get-red/issues/12"},"comments":{"href":"https://api.github.com/repos/STEPIndia/get-red/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/STEPIndia/get-red/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/STEPIndia/get-red/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/STEPIndia/get-red/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/STEPIndia/get-red/statuses/de99cd2193736fb3c8b2041494fcc509db08e317"}}}}