Fix problem when user want to edit a line, and see the msg 'The name is invalid'
This commit is contained in:
parent
eb4b40d1d6
commit
b298c61869
@ -16,12 +16,13 @@
|
|||||||
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
|
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function () {
|
||||||
|
|
||||||
$("#poll_form").submit(function( event ) {
|
$(".check-name").click(function (event) {
|
||||||
var name = $("#name").val();
|
var name = $("#name").val();
|
||||||
var regexContent = $("#parameter_name_regex").text().split("/");
|
var regexContent = $("#parameter_name_regex").text().split("/");
|
||||||
var regex = new RegExp(regexContent[1], regexContent[2]);
|
var regex = new RegExp(regexContent[1], regexContent[2]);
|
||||||
|
|
||||||
if (name.length == 0 || !regex.test(name)) {
|
if (name.length == 0 || !regex.test(name)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var newMessage = $("#nameErrorMessage").clone();
|
var newMessage = $("#nameErrorMessage").clone();
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<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>
|
<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>
|
||||||
{else}
|
{else}
|
||||||
|
|
||||||
{* Voted line *}
|
{* Voted line *}
|
||||||
@ -140,7 +140,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<td><button type="submit" class="btn btn-success btn-md" name="save" title="{__('Poll results\\Save the choices')}">{__('Generic\\Save')}</button></td>
|
<td><button type="submit" class="btn btn-success btn-md check-name" name="save" title="{__('Poll results\\Save the choices')}">{__('Generic\\Save')}</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<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>
|
<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>
|
||||||
{else}
|
{else}
|
||||||
|
|
||||||
{* Voted line *}
|
{* Voted line *}
|
||||||
@ -190,7 +190,7 @@
|
|||||||
{$i = $i+1}
|
{$i = $i+1}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<td><button type="submit" class="btn btn-success btn-md" name="save" title="{__('Poll results\\Save the choices')}">{__('Generic\\Save')}</button></td>
|
<td><button type="submit" class="btn btn-success btn-md check-name" name="save" title="{__('Poll results\\Save the choices')}">{__('Generic\\Save')}</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user