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,15 +16,16 @@
|
||||
* 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 regexContent = $("#parameter_name_regex").text().split("/");
|
||||
var regex = new RegExp(regexContent[1], regexContent[2]);
|
||||
|
||||
if (name.length == 0 || !regex.test(name)) {
|
||||
event.preventDefault();
|
||||
var newMessage = $("#nameErrorMessage").clone();
|
||||
var newMessage = $("#nameErrorMessage").clone();
|
||||
$("#message-container").empty();
|
||||
$("#message-container").append(newMessage);
|
||||
newMessage.removeClass("hidden");
|
||||
|
@ -69,7 +69,7 @@
|
||||
</ul>
|
||||
</td>
|
||||
{/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}
|
||||
|
||||
{* Voted line *}
|
||||
@ -140,7 +140,7 @@
|
||||
</ul>
|
||||
</td>
|
||||
{/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>
|
||||
{/if}
|
||||
|
||||
|
@ -115,7 +115,7 @@
|
||||
</ul>
|
||||
</td>
|
||||
{/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}
|
||||
|
||||
{* Voted line *}
|
||||
@ -190,7 +190,7 @@
|
||||
{$i = $i+1}
|
||||
{/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>
|
||||
{/if}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user