{"action":"created","issue":{"url":"https://api.github.com/repos/jwaliszko/ExpressiveAnnotations/issues/139","repository_url":"https://api.github.com/repos/jwaliszko/ExpressiveAnnotations","labels_url":"https://api.github.com/repos/jwaliszko/ExpressiveAnnotations/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/jwaliszko/ExpressiveAnnotations/issues/139/comments","events_url":"https://api.github.com/repos/jwaliszko/ExpressiveAnnotations/issues/139/events","html_url":"https://github.com/jwaliszko/ExpressiveAnnotations/issues/139","id":188260967,"number":139,"title":"Enable client-side required indicator","user":{"login":"trenzer","id":6638418,"avatar_url":"https://avatars.githubusercontent.com/u/6638418?v=3","gravatar_id":"","url":"https://api.github.com/users/trenzer","html_url":"https://github.com/trenzer","followers_url":"https://api.github.com/users/trenzer/followers","following_url":"https://api.github.com/users/trenzer/following{/other_user}","gists_url":"https://api.github.com/users/trenzer/gists{/gist_id}","starred_url":"https://api.github.com/users/trenzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trenzer/subscriptions","organizations_url":"https://api.github.com/users/trenzer/orgs","repos_url":"https://api.github.com/users/trenzer/repos","events_url":"https://api.github.com/users/trenzer/events{/privacy}","received_events_url":"https://api.github.com/users/trenzer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-09T14:31:25Z","updated_at":"2016-11-10T11:23:34Z","closed_at":null,"body":"I might've missed something, but don't know how to indicate required fields, client-side. For instance, show an asterisk on a label for a text input that is required. I got it working only for 'static' required fields, which have the attribute data-val-required.\r\nWhen the ExpressiveAnnotations attribute 'data-val-requiredif' has been set, I'd like to show or hide the asterisk on the corresponding label, depending on the condition. \r\n\r\nThis is what I have for fields that are always required:\r\n ```\r\n $('input[type=text], select').each(function () {\r\n                if (undefined != $(this).attr('data-val-required');) {\r\n                    var label = $('label[for=\"' + $(this).attr('id') + '\"]');\r\n                    var text = label.text();\r\n                    var asterisk = '<span class=\"asterisk\">* </span>';\r\n                    if (text.length > 0) {\r\n                        label.prepend(asterisk);\r\n                    }\r\n                }\r\n            });\r\n```"},"comment":{"url":"https://api.github.com/repos/jwaliszko/ExpressiveAnnotations/issues/comments/259666310","html_url":"https://github.com/jwaliszko/ExpressiveAnnotations/issues/139#issuecomment-259666310","issue_url":"https://api.github.com/repos/jwaliszko/ExpressiveAnnotations/issues/139","id":259666310,"user":{"login":"jwaliszko","id":1596462,"avatar_url":"https://avatars.githubusercontent.com/u/1596462?v=3","gravatar_id":"","url":"https://api.github.com/users/jwaliszko","html_url":"https://github.com/jwaliszko","followers_url":"https://api.github.com/users/jwaliszko/followers","following_url":"https://api.github.com/users/jwaliszko/following{/other_user}","gists_url":"https://api.github.com/users/jwaliszko/gists{/gist_id}","starred_url":"https://api.github.com/users/jwaliszko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwaliszko/subscriptions","organizations_url":"https://api.github.com/users/jwaliszko/orgs","repos_url":"https://api.github.com/users/jwaliszko/repos","events_url":"https://api.github.com/users/jwaliszko/events{/privacy}","received_events_url":"https://api.github.com/users/jwaliszko/received_events","type":"User","site_admin":false},"created_at":"2016-11-10T11:23:34Z","updated_at":"2016-11-10T11:23:34Z","body":"I do not understand why you'd like to evaluate the expression by yourself - isn't the information provided to `eavalid` enough?\r\n```\r\n$('form').find('input, select, textarea').on('eavalid', function(e, type, valid, expr) {\r\n    if (type === 'requiredif') {\r\n        if (valid) { /* field e.currentTarget.name is required */ }\r\n        else { /* field e.currentTarget.name is not required */ }\r\n    }\r\n});\r\n```"}}
{"actor":{"display_login":"jwaliszko"}}