{"action":"created","issue":{"url":"https://api.github.com/repos/wtforms/wtforms/issues/242","labels_url":"https://api.github.com/repos/wtforms/wtforms/issues/242/labels{/name}","comments_url":"https://api.github.com/repos/wtforms/wtforms/issues/242/comments","events_url":"https://api.github.com/repos/wtforms/wtforms/issues/242/events","html_url":"https://github.com/wtforms/wtforms/issues/242","id":124927917,"number":242,"title":"Ignoring obj= value if global formdata is provided?","user":{"login":"cnicodeme","id":317142,"avatar_url":"https://avatars.githubusercontent.com/u/317142?v=3","gravatar_id":"","url":"https://api.github.com/users/cnicodeme","html_url":"https://github.com/cnicodeme","followers_url":"https://api.github.com/users/cnicodeme/followers","following_url":"https://api.github.com/users/cnicodeme/following{/other_user}","gists_url":"https://api.github.com/users/cnicodeme/gists{/gist_id}","starred_url":"https://api.github.com/users/cnicodeme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnicodeme/subscriptions","organizations_url":"https://api.github.com/users/cnicodeme/orgs","repos_url":"https://api.github.com/users/cnicodeme/repos","events_url":"https://api.github.com/users/cnicodeme/events{/privacy}","received_events_url":"https://api.github.com/users/cnicodeme/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-05T09:34:41Z","updated_at":"2016-01-05T09:55:04Z","closed_at":null,"body":"Hi,\r\n\r\nI'm trying to understand why my original field object is not used when the corresponding formdata field is not provided, and I don't understand.\r\n\r\nLet's say I have a form (AccountForm) with two field : `display` and `email`.\r\nI submit a POST request with only `display` (to update the name of the account user)\r\n\r\n```\r\nform = AccountForm(request.form, obj=original_account)\r\n```\r\n\r\n(original_account being the object from the database retrieved via SQLAlchemy).\r\n\r\nNow, in my logical understanding world, I'd say that form will be : \r\n\r\n```\r\nprint form.display.data # = the value from form.request\r\nprint form.email.data # = The value from original_account, since form.request does NOT contains the key \"email\"\r\n```\r\n\r\nBut it's not the case, `form.email.data` is empty!\r\n\r\nThe problem is coming from the file here https://github.com/wtforms/wtforms/blob/master/wtforms/fields/core.py#L286 \r\n\r\nIn order for my \"logical understanding\" to work, L285 - 286 should be removed, letting the formdata value by default, and reverting back to the `obj` parameter else, and increment L287 of one tab, to be placed under the `if` condition.\r\n\r\nBut before submitting a pull request, I'm pretty sure the issue is not coming from WTForms but from something on my end (something wrongly understood ?) ... but what am I missing?\r\n\r\nThank you for your indications."},"comment":{"url":"https://api.github.com/repos/wtforms/wtforms/issues/comments/168954767","html_url":"https://github.com/wtforms/wtforms/issues/242#issuecomment-168954767","issue_url":"https://api.github.com/repos/wtforms/wtforms/issues/242","id":168954767,"user":{"login":"cnicodeme","id":317142,"avatar_url":"https://avatars.githubusercontent.com/u/317142?v=3","gravatar_id":"","url":"https://api.github.com/users/cnicodeme","html_url":"https://github.com/cnicodeme","followers_url":"https://api.github.com/users/cnicodeme/followers","following_url":"https://api.github.com/users/cnicodeme/following{/other_user}","gists_url":"https://api.github.com/users/cnicodeme/gists{/gist_id}","starred_url":"https://api.github.com/users/cnicodeme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnicodeme/subscriptions","organizations_url":"https://api.github.com/users/cnicodeme/orgs","repos_url":"https://api.github.com/users/cnicodeme/repos","events_url":"https://api.github.com/users/cnicodeme/events{/privacy}","received_events_url":"https://api.github.com/users/cnicodeme/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T09:55:04Z","updated_at":"2016-01-05T09:55:04Z","body":"Ok I'm continuing to find the issue, and for a Field object, the `process_formdata` should work as expected (correctly), but for a `StringField`, the `process_formdata` transforms empty value (or absents) to an empty string (https://github.com/wtforms/wtforms/blob/master/wtforms/fields/core.py#L530)\r\n\r\nWhich override the default value of the `obj` when nothing is passed from the POST request, making the obj useless here, if I don't rewrite `StringField.process_formdata`.\r\n\r\nIf you have any advice here ... on my end, I'll continue to try to understand."}}