From 6d31f180e333aab4b3f41c205372b1cfd70a97a3 Mon Sep 17 00:00:00 2001
From: Antonin <zepcome@gmail.com>
Date: Thu, 2 Apr 2015 17:25:01 +0200
Subject: [PATCH] Javascript protection on invalid name : can now use form
 submission.

---
 js/app/studs.js                 | 8 ++++----
 tpl/part/vote_table_classic.tpl | 4 ++--
 tpl/part/vote_table_date.tpl    | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/js/app/studs.js b/js/app/studs.js
index c19817a0..0266c639 100644
--- a/js/app/studs.js
+++ b/js/app/studs.js
@@ -3,22 +3,22 @@
  * is not distributed with this file, you can obtain one at
  * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
  *
- * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
+ * Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
  * Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft)
  *
  * =============================
  *
- * Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
+ * Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
  * ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
  * http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
  *
- * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
+ * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
  * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
  */
 
 $(document).ready(function () {
 
-    $(".check-name").click(function (event) {
+    $("#poll_form").submit(function (event) {
         var name = $("#name").val();
         var regexContent = $("#parameter_name_regex").text().split("/");
         var regex = new RegExp(regexContent[1], regexContent[2]);
diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl
index f94e1693..786ab3dd 100644
--- a/tpl/part/vote_table_classic.tpl
+++ b/tpl/part/vote_table_classic.tpl
@@ -68,7 +68,7 @@
                                 </ul>
                             </td>
                         {/foreach}
-                        <td style="padding:5px"><button type="submit" class="btn btn-success btn-xs check-name" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td>
+                        <td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td>
                     {else}
                         {* Voted line *}
 
@@ -138,7 +138,7 @@
                             </ul>
                         </td>
                     {/foreach}
-                    <td><button type="submit" class="btn btn-success btn-md check-name" name="save" title="{__('Poll results', 'Save the choices')}">{__('Generic', 'Save')}</button></td>
+                    <td><button type="submit" class="btn btn-success btn-md" name="save" title="{__('Poll results', 'Save the choices')}">{__('Generic', 'Save')}</button></td>
                 </tr>
             {/if}
 
diff --git a/tpl/part/vote_table_date.tpl b/tpl/part/vote_table_date.tpl
index 639513a8..c081576c 100644
--- a/tpl/part/vote_table_date.tpl
+++ b/tpl/part/vote_table_date.tpl
@@ -115,7 +115,7 @@
                                 </ul>
                             </td>
                         {/foreach}
-                        <td style="padding:5px"><button type="submit" class="btn btn-success btn-xs  check-name" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td>
+                        <td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td>
                     {else}
 
                         {* Voted line *}
@@ -190,7 +190,7 @@
                             {$i = $i+1}
                         {/foreach}
                     {/foreach}
-                    <td><button type="submit" class="btn btn-success btn-md check-name" name="save" title="{__('Poll results', 'Save the choices')}">{__('Generic', 'Save')}</button></td>
+                    <td><button type="submit" class="btn btn-success btn-md" name="save" title="{__('Poll results', 'Save the choices')}">{__('Generic', 'Save')}</button></td>
                 </tr>
             {/if}
 
-- 
GitLab