{"action":"created","issue":{"url":"https://api.github.com/repos/nette/sandbox/issues/76","labels_url":"https://api.github.com/repos/nette/sandbox/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/nette/sandbox/issues/76/comments","events_url":"https://api.github.com/repos/nette/sandbox/issues/76/events","html_url":"https://github.com/nette/sandbox/pull/76","id":125390031,"number":76,"title":"Hidden fields are now generated at the end of the form, when rendering via latte file","user":{"login":"foglcz","id":767839,"avatar_url":"https://avatars.githubusercontent.com/u/767839?v=3","gravatar_id":"","url":"https://api.github.com/users/foglcz","html_url":"https://github.com/foglcz","followers_url":"https://api.github.com/users/foglcz/followers","following_url":"https://api.github.com/users/foglcz/following{/other_user}","gists_url":"https://api.github.com/users/foglcz/gists{/gist_id}","starred_url":"https://api.github.com/users/foglcz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foglcz/subscriptions","organizations_url":"https://api.github.com/users/foglcz/orgs","repos_url":"https://api.github.com/users/foglcz/repos","events_url":"https://api.github.com/users/foglcz/events{/privacy}","received_events_url":"https://api.github.com/users/foglcz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-07T13:02:45Z","updated_at":"2016-01-12T18:10:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nette/sandbox/pulls/76","html_url":"https://github.com/nette/sandbox/pull/76","diff_url":"https://github.com/nette/sandbox/pull/76.diff","patch_url":"https://github.com/nette/sandbox/pull/76.patch"},"body":"If you render forms via latte file, the default template creates empty table rows for hidden fields. This PR updates latte file - hidden fields are generated at the end of the form.\r\n\r\nI think that anyone who uses the rendering via latte, modifies the latte file to suit their project-specific needs. That said, it might be nice to show the users how to distinguish individual field types and thus, how to render hidden fields outside of the main form markup.\r\n\r\nIt also brings form.latte more in line with built-in rendering method. The hidden inputs are ***not*** put inside plain `<div>` as it's done in native rendering method, since that would add complexity.\r\n\r\n| |  |\r\n|-------------------|--------------|\r\n| **Type**          | Feature    |\r\n| **Fixes issues**        | n/a        |\r\n| **Documentation** | not needed |\r\n| **BC Break**      | no*        |\r\n\r\n`*Since the latte is IMHO overwritten by anyone using latte-rendering method, I think this is not a BC break... But then https://xkcd.com/1172/`\r\n\r\n**Test code**\r\n```php\r\n\tpublic function createComponentTestForm()\r\n\t{\r\n\t\t$form = new Nette\\Application\\UI\\Form();\r\n\t\t$form->addHidden('hidden1', 'testvalue1');\r\n\t\t$form->addText('text1', 'Test text');\r\n\t\t$form->addHidden('hidden2', 'testvalue2');\r\n\t\t$form->addSubmit('submit', 'Submit test form');\r\n\t\treturn $form;\r\n\t}\r\n```\r\n\r\n**Output from built-in render method**\r\n(ie. using `{control testForm}`\r\n```html\r\n<form action=\"/github/sandbox/www/\" method=\"post\" id=\"frm-testForm\">\r\n    <table>\r\n        <tr>\r\n            <th><label for=\"frm-testForm-text1\">Test text</label></th>\r\n            <td><input type=\"text\" name=\"text1\" id=\"frm-testForm-text1\" class=\"text\"></td>\r\n        </tr>\r\n        <tr>\r\n            <th></th>\r\n            <td><input type=\"submit\" name=\"_submit\" value=\"Submit test form\" class=\"button\"></td>\r\n        </tr>\r\n    </table>\r\n    <div>\r\n        <input type=\"hidden\" name=\"hidden1\" value=\"testvalue1\">\r\n        <input type=\"hidden\" name=\"hidden2\" value=\"testvalue2\">\r\n        <input type=\"hidden\" name=\"do\" value=\"testForm-submit\">\r\n        <!--[if IE]><input type=IEbug disabled style=\"display:none\"><![endif]--></div>\r\n</form>\r\n```\r\n\r\n**Output from original latte file**\r\n```html\r\n<form action=\"/github/sandbox/www/\" method=\"post\" id=\"frm-testForm\">\r\n    <table>\r\n        <tr>\r\n            <th></th>\r\n            <td><input type=\"hidden\" name=\"hidden1\" value=\"testvalue1\"> </td>\r\n        </tr>\r\n        <tr>\r\n            <th><label for=\"frm-testForm-text1\">Test text</label></th>\r\n            <td><input type=\"text\" name=\"text1\" id=\"frm-testForm-text1\"> </td>\r\n        </tr>\r\n        <tr>\r\n            <th></th>\r\n            <td><input type=\"hidden\" name=\"hidden2\" value=\"testvalue2\"> </td>\r\n        </tr>\r\n        <tr>\r\n            <th></th>\r\n            <td><input type=\"submit\" name=\"_submit\" value=\"Submit test form\"> </td>\r\n        </tr>\r\n        <tr>\r\n            <th></th>\r\n            <td><input type=\"hidden\" name=\"do\" value=\"testForm-submit\"> </td>\r\n        </tr>\r\n    </table>\r\n    <!--[if IE]><input type=IEbug disabled style=\"display:none\"><![endif]-->\r\n</form>\r\n```\r\n\r\n**Output from updated latte file**\r\n```html\r\n<form action=\"/github/sandbox/www/\" method=\"post\" id=\"frm-testForm\">\r\n<table>\r\n    <tr>\r\n        <th><label for=\"frm-testForm-text1\">Test text</label></th>\r\n        <td><input type=\"text\" name=\"text1\" id=\"frm-testForm-text1\"> </td>\r\n    </tr>\r\n    <tr>\r\n        <th></th>\r\n        <td><input type=\"submit\" name=\"_submit\" value=\"Submit test form\"> </td>\r\n    </tr>\r\n</table>\r\n\r\n<input type=\"hidden\" name=\"hidden1\" value=\"testvalue1\">\r\n<input type=\"hidden\" name=\"hidden2\" value=\"testvalue2\">\r\n<input type=\"hidden\" name=\"do\" value=\"testForm-submit\">\r\n<!--[if IE]><input type=IEbug disabled style=\"display:none\"><![endif]-->\r\n</form>\r\n```"},"comment":{"url":"https://api.github.com/repos/nette/sandbox/issues/comments/170998450","html_url":"https://github.com/nette/sandbox/pull/76#issuecomment-170998450","issue_url":"https://api.github.com/repos/nette/sandbox/issues/76","id":170998450,"user":{"login":"dg","id":194960,"avatar_url":"https://avatars.githubusercontent.com/u/194960?v=3","gravatar_id":"","url":"https://api.github.com/users/dg","html_url":"https://github.com/dg","followers_url":"https://api.github.com/users/dg/followers","following_url":"https://api.github.com/users/dg/following{/other_user}","gists_url":"https://api.github.com/users/dg/gists{/gist_id}","starred_url":"https://api.github.com/users/dg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dg/subscriptions","organizations_url":"https://api.github.com/users/dg/orgs","repos_url":"https://api.github.com/users/dg/repos","events_url":"https://api.github.com/users/dg/events{/privacy}","received_events_url":"https://api.github.com/users/dg/received_events","type":"User","site_admin":false},"created_at":"2016-01-12T18:10:10Z","updated_at":"2016-01-12T18:10:10Z","body":"Good. Can you squash it to single commit?"}}