2015-03-27 12:55:32 +01:00
|
|
|
/**
|
|
|
|
* This software is governed by the CeCILL-B license. If a copy of this license
|
|
|
|
* is not distributed with this file, you can obtain one at
|
|
|
|
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
|
|
|
|
*
|
2015-04-02 17:25:01 +02:00
|
|
|
* Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
|
2015-03-27 12:55:32 +01:00
|
|
|
* Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft)
|
|
|
|
*
|
|
|
|
* =============================
|
|
|
|
*
|
2015-04-02 17:25:01 +02:00
|
|
|
* Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
|
2015-03-27 12:55:32 +01:00
|
|
|
* ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
|
|
|
|
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
|
|
|
|
*
|
2015-04-02 17:25:01 +02:00
|
|
|
* Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
|
2015-03-27 12:55:32 +01:00
|
|
|
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
|
|
|
|
*/
|
|
|
|
|
2015-03-29 16:02:48 +02:00
|
|
|
$(document).ready(function () {
|
2015-03-26 16:33:11 +01:00
|
|
|
|
2015-04-02 17:25:01 +02:00
|
|
|
$("#poll_form").submit(function (event) {
|
2015-03-26 16:33:11 +01:00
|
|
|
var name = $("#name").val();
|
|
|
|
var regexContent = $("#parameter_name_regex").text().split("/");
|
|
|
|
var regex = new RegExp(regexContent[1], regexContent[2]);
|
2015-03-29 16:02:48 +02:00
|
|
|
|
2015-03-26 16:33:11 +01:00
|
|
|
if (name.length == 0 || !regex.test(name)) {
|
|
|
|
event.preventDefault();
|
2015-03-29 16:02:48 +02:00
|
|
|
var newMessage = $("#nameErrorMessage").clone();
|
2015-03-26 16:33:11 +01:00
|
|
|
$("#message-container").empty();
|
2015-03-26 17:09:52 +01:00
|
|
|
$("#message-container").append(newMessage);
|
|
|
|
newMessage.removeClass("hidden");
|
2015-03-26 16:33:11 +01:00
|
|
|
$('html, body').animate({
|
|
|
|
scrollTop: $("#message-container").offset().top
|
|
|
|
}, 750);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|