I'm using ruby on rails 2.3.2, and I've got a list with checkboxes. So I created a remote_form_for to handle multiple submit buttons. Those operations work great, and so the pagination. The problem raises when I both submit the form and then try to paginate. I get the following error instead of displaying next page, as expected.
try {
Element.update("announcement_list", " \n <form action=\"/announcement/my_announcements_submit_buttons\" method=\"post\" onsubmit=\"new Ajax.Request('/announcement/my_announcements_submit_buttons', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\"><div style=\"margin:0;padding:0\"><input name=\"_method\" type=\"hidden\" value=\"put\" /><input name=\"authenticity_token\" type=\"hidden\" value=\"32Ipo3DyS/NoTMa1ICGnYJPVT81eZYkJvKH4gpN+VpU=\" /></div>\n\n <input type=\"hidden\" name=\"m_submit\" value=\"\" />\n\n <input id=\"btnPublish\" name=\"btnPublish\" onclick=\"if (!confirm('\u00bfEst\u00e1 seguro?')) return false; this.form.m_submit.value = this.id;\" type=\"submit\" value=\"Publicar\" />\n\n <input id=\"btnDeactivate\" name=\"btnDeactivate\" onclick=\"if (!confirm('\u00bfEst\u00e1 seguro?')) return false; this.form.m_submit.value = this.id;\" type=\"submit\" value=\"Dejar de publicar\" />\n\n <input id=\"btnDelete\" name=\"btnDelete\" onclick=\"if (!confirm('\u00bfEst\u00e1 seguro?')) return false; this.form.m_submit.value = this.id;\" type=\"submit\" value=\"Eliminar\" />\n\n <table border=\"1\">\n <tr>\n <td></td>\n <td>Estado</td>\n <td>Titulo</td>\n <td>Fecha de creaci\u00f3n</td>\n <td>Fecha de publicaci\u00f3n</td>\n <td># Anuncio</td>\n <td>Categor\u00eda</td>\n <td>Anotados</td>\n </tr>\n\n \n <tr>\n <td><input id=\"announcement_ids_\" name=\"announcement_ids[]\" type=\"checkbox\" value=\"19\" /></td>\n <td>published</td>\n <td><a href=\"/announcements/19\">Anuncio 5</a></td>\n <td>2009-12-29 03:00:00 UTC</td>\n <td></td>\n <td>19</td>\n <td>Profesiones</td>\n <td>0</td>\n </tr>\n \n <tr>\n <td><input id=\"announcement_ids_\" name=\"announcement_ids[]\" type=\"checkbox\" value=\"20\" /></td>\n <td>published</td>\n <td><a href=\"/announcements/20\">nuevo anuncio</a></td>\n <td>2009-12-29 03:00:00 UTC</td>\n <td></td>\n <td>20</td>\n <td>Industrial</td>\n <td>0</td>\n </tr>\n \n <tr>\n <td><input id=\"announcement_ids_\" name=\"announcement_ids[]\" type=\"checkbox\" value=\"21\" /></td>\n <td>published</td>\n <td><a href=\"/announcements/21\">muchos tags</a></td>\n <td>2009-12-29 03:00:00 UTC</td>\n <td></td>\n <td>21</td>\n <td>Cultura, Industrial, Trabajo y Seguridad laboral, Profesiones</td>\n <td>0</td>\n </tr>\n \n <tr>\n <td><input id=\"announcement_ids_\" name=\"announcement_ids[]\" type=\"checkbox\" value=\"22\" /></td>\n <td>published</td>\n <td><a href=\"/announcements/22\">Curso de Administraci\u00f3n</a></td>\n <td>2010-01-04 03:00:00 UTC</td>\n <td></td>\n <td>22</td>\n <td>Empresa</td>\n <td>0</td>\n </tr>\n \n <tr>\n <td><input id=\"announcement_ids_\" name=\"announcement_ids[]\" type=\"checkbox\" value=\"23\" /></td>\n <td>published</td>\n <td><a href=\"/announcements/23\">Apoyo en CBC!</a></td>\n <td>2010-01-30 03:00:00 UTC</td>\n <td></td>\n <td>23</td>\n <td>Educaci\u00f3n</td>\n <td>1</td>\n </tr>\n \n <tr>\n <td><input id=\"announcement_ids_\" name=\"announcement_ids[]\" type=\"checkbox\" value=\"24\" /></td>\n <td>published</td>\n <td><a href=\"/announcements/24\">Anuncio tags con plugin</a></td>\n <td>2010-01-31 03:00:00 UTC</td>\n <td></td>\n <td>24</td>\n <td>Empresa, Educaci\u00f3n</td>\n <td>1</td>\n </tr>\n \n <tr>\n <td><input id=\"announcement_ids_\" name=\"announcement_ids[]\" type=\"checkbox\" value=\"25\" /></td>\n <td>published</td>\n <td><a href=\"/announcements/25\">Dos tags con tokens</a></td>\n <td>2010-01-06 03:00:00 UTC</td>\n <td></td>\n <td>25</td>\n <td>Empresa, Administraci\u00f3n y Secretariado</td>\n <td>1</td>\n </tr>\n \n <tr>\n <td><input id=\"announcement_ids_\" name=\"announcement_ids[]\" type=\"checkbox\" value=\"28\" /></td>\n <td>published</td>\n <td><a href=\"/announcements/28\">Finanzas - Prueba combo categorias</a></td>\n <td>2010-01-12 03:00:00 UTC</td>\n <td></td>\n <td>28</td>\n <td>Empresa, Contabilidad y Finanzas</td>\n <td>0</td>\n </tr>\n \n <tr>\n <td><input id=\"announcement_ids_\" name=\"announcement_ids[]\" type=\"checkbox\" value=\"29\" /></td>\n <td>published</td>\n <td><a href=\"/announcements/29\">Prueba delta 1</a></td>\n <td>2010-01-30 03:00:00 UTC</td>\n <td></td>\n <td>29</td>\n <td>Animales y Naturaleza, Medio Ambiente</td>\n <td>0</td>\n </tr>\n \n <tr>\n <td><input id=\"announcement_ids_\" name=\"announcement_ids[]\" type=\"checkbox\" value=\"34\" /></td>\n <td>published</td>\n <td><a href=\"/announcements/34\">delta 2</a></td>\n <td>2010-01-15 03:00:00 UTC</td>\n <td></td>\n <td>34</td>\n <td>Belleza y Moda, Belleza</td>\n <td>0</td>\n </tr>\n \n </table>\n </form>\n\n \n <div class=\"pagination\"><a href=\"/announcement/my_announcements_submit_buttons?_method=put&announcement_ids%5B%5D=9&authenticity_token=32Ipo3DyS%2FNoTMa1ICGnYJPVT81eZYkJvKH4gpN%2BVpU%3D&btnPublish=Publicar&m_submit=btnPublish\">« Previous</a> <a href=\"/announcement/my_announcements_submit_buttons?_method=put&announcement_ids%5B%5D=9&authenticity_token=32Ipo3DyS%2FNoTMa1ICGnYJPVT81eZYkJvKH4gpN%2BVpU%3D&btnPublish=Publicar&m_submit=btnPublish\">1</a> <span class=\"current\">2</span> <a href=\"/announcement/my_announcements_submit_buttons?_method=put&announcement_ids%5B%5D=9&authenticity_token=32Ipo3DyS%2FNoTMa1ICGnYJPVT81eZYkJvKH4gpN%2BVpU%3D&btnPublish=Publicar&m_submit=btnPublish&page=3\">3</a> <a href=\"/announcement/my_announcements_submit_buttons?_method=put&announcement_ids%5B%5D=9&authenticity_token=32Ipo3DyS%2FNoTMa1ICGnYJPVT81eZYkJvKH4gpN%2BVpU%3D&btnPublish=Publicar&m_submit=btnPublish&page=3\">Next »</a></div>\n\n");
} catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.update(\"announcement_list\", \"
The relevant part of my form looks like this:
remote_form_for :announcement, :url => {:controller => 'announcements', :action => 'my_announcements_submit_buttons'}, :html => { :method => :put} do |f|
<input type="hidden" name="m_submit" value="" />
submit_tag('Publish', {:confirm => '¿Are you sure?', :id => "btnPublish",
:name => 'btnPublish',
:onclick => "this.form.m_submit.value = this.id;"})
submit_tag('Deactivate', {:confirm => '¿Are you sure?', :id => "btnDeactivate",
:name => 'btnDeactivate', :onclick => "this.form.m_submit.value = this.id;"})
submit_tag('Delete',{:confirm => '¿Are you sure?', :id => "btnDelete",
:name => 'btnDelete', :onclick => "this.form.m_submit.value = this.id;"})
Does anybody know what's going on?