{"action":"created","issue":{"url":"https://api.github.com/repos/Rhyzz/repeatable-fields/issues/19","repository_url":"https://api.github.com/repos/Rhyzz/repeatable-fields","labels_url":"https://api.github.com/repos/Rhyzz/repeatable-fields/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/Rhyzz/repeatable-fields/issues/19/comments","events_url":"https://api.github.com/repos/Rhyzz/repeatable-fields/issues/19/events","html_url":"https://github.com/Rhyzz/repeatable-fields/issues/19","id":145441867,"number":19,"title":"Pre populated row using counter","user":{"login":"brad-klosterman","id":18238330,"avatar_url":"https://avatars.githubusercontent.com/u/18238330?v=3","gravatar_id":"","url":"https://api.github.com/users/brad-klosterman","html_url":"https://github.com/brad-klosterman","followers_url":"https://api.github.com/users/brad-klosterman/followers","following_url":"https://api.github.com/users/brad-klosterman/following{/other_user}","gists_url":"https://api.github.com/users/brad-klosterman/gists{/gist_id}","starred_url":"https://api.github.com/users/brad-klosterman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brad-klosterman/subscriptions","organizations_url":"https://api.github.com/users/brad-klosterman/orgs","repos_url":"https://api.github.com/users/brad-klosterman/repos","events_url":"https://api.github.com/users/brad-klosterman/events{/privacy}","received_events_url":"https://api.github.com/users/brad-klosterman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-04-03T01:34:22Z","updated_at":"2016-04-05T11:31:30Z","closed_at":"2016-04-04T06:00:07Z","body":"Hi, thank you for this. \r\n\r\nI am storing user meta and then populating it in the row on page load. When the meta in the row is pre-populated on the page and then saved only one value is saved. When I add rows they save correctly. When those rows are pre-populated again on the page load and then saved again it only saves the last field. \r\n\r\n`<form id=\"pfile\" action=\"\" method=\"POST\">\t\r\n                            <div class=\"repeat\">\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t<table class=\"wrapper\" width=\"100%\">\r\n                            \t<thead>\r\n        \t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td width=\"10%\" colspan=\"4\"><span class=\"add btn-c green-btn\">Add</span></td>\r\n    \t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t</thead>\r\n                                <tbody class=\"container ui-sortable \">\r\n                                <?php\r\n\t\t\t\t\t\t\t\tif ( $group1 ) :\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tforeach ( $group1 as $field ) {\r\n\t\t\t\t\t\t\t\t?>\r\n                                \r\n\t\t\t\t\t\t\t\t\t<tr class=\"row\">\r\n                                    \t<td class=\"pointer\" width=\"20%\">\r\n                                        \t<span class=\"move blue-btn btn-c\">Move</span>\r\n                                        </td>\r\n\t\t\t\t\t\t\r\n                                        <td width=\"70%\">\r\n                                        <label for=\"digital_cv_option1\">Option1</label>\r\n                                        \t<dl>\r\n        \t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dt>option1</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[$ic][0]\" id=\"\" type=\"text\" class=\"form-control\" value=\"<?php if($field[0] != '') echo esc_attr( $field[0] ); ?>\" /></dd>\r\n                                                <dt>option2</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[$ic][1]\" id=\"\" type=\"text\" class=\"form-control\" value=\"<?php if($field[1] != '') echo esc_attr( $field[1] ); ?>\" /> </dd>\r\n                                                \r\n        \t\t\t\t\t\t\t\t\t</dl>\r\n            \t\t\t\t\t\t\t</td>\r\n                                        <td class=\"pointer\" width=\"10%\">\r\n                                        \t<span class=\"remove red-btn btn-c\">Remove</span>\r\n                                        </td> \r\n\t\t\t\t\t\t\t\t\t</tr>\r\n                                    \r\n                            <?php\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse :\r\n\t\t\t\t\t\t\t\t// show a blank one\r\n\t\t\t\t\t\t\t?>\r\n                                    <tr class=\"row\">\r\n                                    \t<td class=\"pointer\" width=\"20%\">\r\n                                        \t<span class=\"move blue-btn btn-c\">Move<label for=\"digital_cv_option1\">Option1</label></span>\r\n                                        </td>\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n                                        <td width=\"70%\">\r\n                                        \t<dl>\r\n        \t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t<<dt>option1</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[$ic][0]\" id=\"\" type=\"text\" class=\"form-control\" value=\"\" /></dd>\r\n                                                <dt>option2</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[$ic][1]\" id=\"\" type=\"text\" class=\"form-control\" value=\"\" /></dd>\r\n        \t\t\t\t\t\t\t\t\t</dl>\r\n            \t\t\t\t\t\t\t</td>\r\n                                        <td class=\"pointer\" width=\"10%\">\r\n                                        \t<span class=\"remove red-btn btn-c\">Remove</span>\r\n                                        </td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n                            <?php endif; ?>\t\r\n                            \t\t<tr class=\"template row\" style=\"display: none;\">\r\n                                    \t<td class=\"pointer\" width=\"20%\">\r\n                                        \t<span class=\"move blue-btn btn-c\">Move<label for=\"digital_cv_option1\">Option1</label></span>\r\n                                        </td>\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n                                        <td width=\"70%\">\r\n                                        \t<dl>\r\n        \t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dt>option1</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[$ic][0]\"  type=\"text\" class=\"form-control\" disabled/></dd>\r\n                                                <dt>option2</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[$ic][1]\"  type=\"text\" class=\"form-control\" disabled/></dd>\r\n        \t\t\t\t\t\t\t\t\t</dl>\r\n            \t\t\t\t\t\t\t</td>\r\n                                        <td class=\"pointer\" width=\"10%\">\r\n                                        \t<span class=\"remove red-btn btn-c\">Remove</span>\r\n                                        </td>\r\n\t\t\t\t\t\t\t\t\t</tr>\t\r\n                            \t</tbody>\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</table>\r\n\r\n\t\t\t\t\t\t\t<p>\r\n\t\t\t\t\t\t\t\t<input type=\"submit\" class=\"save-btn btn-c\" value=\"Submit\" />\r\n\t\t\t\t\t\t\t</p>\r\n\r\n\t\t\t\t\t\t\t</div>\r\n                            </form>`\r\n\r\n\r\nAny suggestions on what I'm doing wrong?"},"comment":{"url":"https://api.github.com/repos/Rhyzz/repeatable-fields/issues/comments/205763740","html_url":"https://github.com/Rhyzz/repeatable-fields/issues/19#issuecomment-205763740","issue_url":"https://api.github.com/repos/Rhyzz/repeatable-fields/issues/19","id":205763740,"user":{"login":"brad-klosterman","id":18238330,"avatar_url":"https://avatars.githubusercontent.com/u/18238330?v=3","gravatar_id":"","url":"https://api.github.com/users/brad-klosterman","html_url":"https://github.com/brad-klosterman","followers_url":"https://api.github.com/users/brad-klosterman/followers","following_url":"https://api.github.com/users/brad-klosterman/following{/other_user}","gists_url":"https://api.github.com/users/brad-klosterman/gists{/gist_id}","starred_url":"https://api.github.com/users/brad-klosterman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brad-klosterman/subscriptions","organizations_url":"https://api.github.com/users/brad-klosterman/orgs","repos_url":"https://api.github.com/users/brad-klosterman/repos","events_url":"https://api.github.com/users/brad-klosterman/events{/privacy}","received_events_url":"https://api.github.com/users/brad-klosterman/received_events","type":"User","site_admin":false},"created_at":"2016-04-05T11:31:30Z","updated_at":"2016-04-05T11:31:30Z","body":"The template counter is working although when I generate the row the input field name is group1[0][1]\r\n\r\nI used $ic in the Jquery \r\n\r\nHow do I get the counter to work for the generated rows. \r\n\r\n`\r\n<script type=\"text/javascript\">\r\n\tjQuery(function() {\r\n\t\tjQuery('.repeat').each(function() {\r\n    \t\tjQuery(this).repeatable_fields();\r\n    \t});\r\n    });\r\n</script>\r\n\r\n<script>\r\n\tjQuery(document).ready(function($){ \r\n \t\t$('#hide-show').click(function() {   $(this).next().slideToggle(1000); });\r\n \t});\r\n</script>\r\n\r\n\r\n\r\n\r\n\r\n<script src=\"https://code.jquery.com/jquery-1.10.2.js\"></script>\r\n\r\n\r\n\r\n\r\n<body>\r\n<?php\r\nif(!empty($_POST)) {\r\n    var_dump($_POST);\r\n}\r\n?>\r\n\r\n\r\n    \r\n<div class=\"userwrap\">\r\n\t\r\n\t<h1>Work Experience</h1>\r\n\t\r\n\t\t\t\t\t\t\t<form id=\"pfile\" action=\"\" method=\"POST\">\t\r\n                            <div class=\"repeat\">\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t<table class=\"wrapper\" width=\"100%\">\r\n                            \t<thead>\r\n        \t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td width=\"10%\" colspan=\"4\"><span class=\"add btn-c green-btn\">Add</span></td>\r\n    \t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t</thead>\r\n                                <tbody class=\"container ui-sortable \">\r\n                                \r\n                                \t<tr class=\"template row\">\r\n                                        <td  class=\"td-item\" width=\"70%\">\r\n                                        \r\n                                        \t\t<span class=\"move blue-btn btn-c\">Move</span>\r\n                                      \t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"profile-page-title\">\r\n                                                <input name=\"group1[$ic][0]\" type=\"text\" class=\"form-control\"</span>\r\n                                                <span id=\"hide-show\" class=\"blue-btn btn-c\">edit</span>\r\n                                        \t\t<dl id=\"obj-2\" class=\"hidden\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dt>option1</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[$ic][1]\" type=\"text\" class=\"form-control\"/></dd>\r\n                                                <dt>option2</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[$ic][2]\" type=\"text\" class=\"form-control\"/> </dd>\r\n                                                \r\n        \t\t\t\t\t\t\t\t\t\t</dl>\r\n            \t\t\t\t\t\t\t</td>\r\n                                        <td class=\"td-item\" width=\"10%\">\r\n                                        \t<span class=\"remove red-btn btn-c\">Remove</span>\r\n                                        </td> \r\n\t\t\t\t\t\t\t\t\t</tr>\r\n                                \r\n\t\t\t\t\t\t\t\t<?php\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif ( $group1 ) :\r\n\t\t\t\t\t\t\t\t$ic = 0;\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tforeach ( $group1 as $field ) {\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\r\n\t\t\t\t\t\t\t\t?>\r\n                                \r\n                                 \r\n                                \r\n\t\t\t\t\t\t\t\t\t<tr class=\"row\">\r\n                                        <td  class=\"td-item\" width=\"70%\">\r\n                                        \r\n                                        \t\t<span class=\"move blue-btn btn-c\">Move</span>\r\n                                      \t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"profile-page-title\">\r\n                                                <input name=\"group1[<?php echo $ic; ?>][0]\" type=\"text\" class=\"form-control\" value=\"<?php if($field[0] != '') echo esc_attr( $field[0] ); ?>\" /></span>\r\n                                                <span id=\"hide-show\" class=\"blue-btn btn-c\">edit</span>\r\n                                        \t\t<dl id=\"obj-2\" class=\"hidden\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dt>option1</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[<?php echo $ic; ?>][1]\" type=\"text\" class=\"form-control\" value=\"<?php if($field[1] != '') echo esc_attr( $field[1] ); ?>\" /></dd>\r\n                                                <dt>option2</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[<?php echo $ic; ?>][2]\" type=\"text\" class=\"form-control\" value=\"<?php if($field[2] != '') echo esc_attr( $field[2] ); ?>\" /> </dd>\r\n                                                \r\n        \t\t\t\t\t\t\t\t\t\t</dl>\r\n            \t\t\t\t\t\t\t</td>\r\n                                        <td class=\"td-item\" width=\"10%\">\r\n                                        \t<span class=\"remove red-btn btn-c\">Remove</span>\r\n                                        </td> \r\n\t\t\t\t\t\t\t\t\t</tr>\r\n                                    \r\n                            <?php\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse :\r\n\t\t\t\t\t\t\t\t// show a blank one\r\n\t\t\t\t\t\t\t?>\r\n                                    <tr class=\"row\">\r\n                                        <td  class=\"td-item\" width=\"70%\">\r\n                                        \r\n                                        \t\t<span class=\"move blue-btn btn-c\">Move</span>\r\n                                      \t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"profile-page-title\">\r\n                                                <input name=\"group1[<?php echo $ic; ?>][0]\" type=\"text\" class=\"form-control\" /></span>\r\n                                                <span id=\"hide-show\" class=\"blue-btn btn-c\">edit</span>\r\n                                        \t\t<dl id=\"obj-2\" class=\"hidden\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dt>option1</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[<?php echo $ic; ?>][1]\" type=\"text\" class=\"form-control\" /></dd>\r\n                                                <dt>option2</dt>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<dd><input name=\"group1[<?php echo $ic; ?>][2]\" type=\"text\" class=\"form-control\" /> </dd>\r\n                                                \r\n        \t\t\t\t\t\t\t\t\t\t</dl>\r\n            \t\t\t\t\t\t\t</td>\r\n                                        <td class=\"td-item\" width=\"10%\">\r\n                                        \t<span class=\"remove red-btn btn-c\">Remove</span>\r\n                                        </td> \r\n\t\t\t\t\t\t\t\t\t</tr>\r\n                            <?php endif; ?>\t\r\n                            \t\t\t\r\n                            \t</tbody>\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</table>\r\n\r\n\t\t\t\t\t\t\t<p>\r\n\t\t\t\t\t\t\t\t<input type=\"submit\" class=\"save-btn btn-c\" value=\"Submit\" />\r\n\t\t\t\t\t\t\t</p>\r\n\r\n\t\t\t\t\t\t\t</div>\r\n                            </form>\r\n\t\r\n\t\r\n</div> <!-- .wrap -->\r\n\r\n</body>`"}}