{"action":"created","issue":{"url":"https://api.github.com/repos/vazco/uniforms/issues/58","repository_url":"https://api.github.com/repos/vazco/uniforms","labels_url":"https://api.github.com/repos/vazco/uniforms/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/vazco/uniforms/issues/58/comments","events_url":"https://api.github.com/repos/vazco/uniforms/issues/58/events","html_url":"https://github.com/vazco/uniforms/issues/58","id":163200121,"number":58,"title":"Number fields are defaulted to either min or max values from schema, even when optional","user":{"login":"todda00","id":8363924,"avatar_url":"https://avatars.githubusercontent.com/u/8363924?v=3","gravatar_id":"","url":"https://api.github.com/users/todda00","html_url":"https://github.com/todda00","followers_url":"https://api.github.com/users/todda00/followers","following_url":"https://api.github.com/users/todda00/following{/other_user}","gists_url":"https://api.github.com/users/todda00/gists{/gist_id}","starred_url":"https://api.github.com/users/todda00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/todda00/subscriptions","organizations_url":"https://api.github.com/users/todda00/orgs","repos_url":"https://api.github.com/users/todda00/repos","events_url":"https://api.github.com/users/todda00/events{/privacy}","received_events_url":"https://api.github.com/users/todda00/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vazco/uniforms/labels/bug","name":"bug","color":"ee0701"}],"state":"closed","locked":false,"assignee":{"login":"radekmie","id":1379064,"avatar_url":"https://avatars.githubusercontent.com/u/1379064?v=3","gravatar_id":"","url":"https://api.github.com/users/radekmie","html_url":"https://github.com/radekmie","followers_url":"https://api.github.com/users/radekmie/followers","following_url":"https://api.github.com/users/radekmie/following{/other_user}","gists_url":"https://api.github.com/users/radekmie/gists{/gist_id}","starred_url":"https://api.github.com/users/radekmie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radekmie/subscriptions","organizations_url":"https://api.github.com/users/radekmie/orgs","repos_url":"https://api.github.com/users/radekmie/repos","events_url":"https://api.github.com/users/radekmie/events{/privacy}","received_events_url":"https://api.github.com/users/radekmie/received_events","type":"User","site_admin":false},"assignees":[{"login":"radekmie","id":1379064,"avatar_url":"https://avatars.githubusercontent.com/u/1379064?v=3","gravatar_id":"","url":"https://api.github.com/users/radekmie","html_url":"https://github.com/radekmie","followers_url":"https://api.github.com/users/radekmie/followers","following_url":"https://api.github.com/users/radekmie/following{/other_user}","gists_url":"https://api.github.com/users/radekmie/gists{/gist_id}","starred_url":"https://api.github.com/users/radekmie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radekmie/subscriptions","organizations_url":"https://api.github.com/users/radekmie/orgs","repos_url":"https://api.github.com/users/radekmie/repos","events_url":"https://api.github.com/users/radekmie/events{/privacy}","received_events_url":"https://api.github.com/users/radekmie/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-06-30T15:50:46Z","updated_at":"2016-06-30T16:40:51Z","closed_at":"2016-06-30T16:39:28Z","body":"When using a schema definition with either min, max, or both, the field is defaulted to either the min (if min is present), max (if only max is present). This is true for schema definitions where optional : true as well. This situation occurs for both TextField and NumField.\r\n\r\nI would expect to see a blank field instead of defaulting to either min or max, especially for an optional field.\r\n\r\nExample code and output:\r\n\r\n```\r\n...\r\n  'height.feet':{\r\n    type: Number,\r\n    optional: true,\r\n    min: 4,\r\n    max: 8\r\n  },\r\n  'height.inches':{\r\n    type: Number,\r\n    optional: true,\r\n    max: 11\r\n  },\r\n...\r\n```\r\n\r\n```\r\n            <div className='col-xs-12 col-md-4'>\r\n              <TextField name='height.feet' placeholder='Feet' label='Height - Feet' />\r\n            </div>\r\n            <div className='col-xs-12 col-md-4'>\r\n              <TextField name='height.inches' placeholder='Inches' label=\"Height - Inches\" />\r\n            </div>\r\n```\r\n\r\nResult:\r\n![localhost_3005_register_player_athletics](https://cloud.githubusercontent.com/assets/8363924/16494797/b0a94c20-3eb8-11e6-98df-75e535aa8671.png)\r\n"},"comment":{"url":"https://api.github.com/repos/vazco/uniforms/issues/comments/229716016","html_url":"https://github.com/vazco/uniforms/issues/58#issuecomment-229716016","issue_url":"https://api.github.com/repos/vazco/uniforms/issues/58","id":229716016,"user":{"login":"todda00","id":8363924,"avatar_url":"https://avatars.githubusercontent.com/u/8363924?v=3","gravatar_id":"","url":"https://api.github.com/users/todda00","html_url":"https://github.com/todda00","followers_url":"https://api.github.com/users/todda00/followers","following_url":"https://api.github.com/users/todda00/following{/other_user}","gists_url":"https://api.github.com/users/todda00/gists{/gist_id}","starred_url":"https://api.github.com/users/todda00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/todda00/subscriptions","organizations_url":"https://api.github.com/users/todda00/orgs","repos_url":"https://api.github.com/users/todda00/repos","events_url":"https://api.github.com/users/todda00/events{/privacy}","received_events_url":"https://api.github.com/users/todda00/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T16:40:51Z","updated_at":"2016-06-30T16:40:51Z","body":"Behavior definitely needs to be changed for optional fields, but I also think its strange to set an initial value even when required. In my opinion you want to force the user to input a value, not default to either the max or min. \r\n\r\nIf someone wants a default, they can set the model."}}
{"actor":{"display_login":"todda00"}}