mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
add validation for special characters in statusbit screen
This commit is contained in:
@@ -18,7 +18,8 @@
|
||||
{{ 'admin::status: texte a afficher' | trans }}
|
||||
</label>
|
||||
<div class="controls">
|
||||
<input id="label_off" name="label_off" class="input-xlarge" type="text" value="{{ status['labeloff'] }}">
|
||||
<input id="label_off" onkeyup="inputChanged(this);return(false);" name="label_off"
|
||||
class="input-xlarge invalid" type="text" value="{{ status['labeloff'] }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
@@ -82,7 +83,8 @@
|
||||
{{ 'admin::status: texte a afficher' | trans }}
|
||||
</label>
|
||||
<div class="controls">
|
||||
<input id="label_on" name="label_on" class="input-xlarge" type="text" value="{{ status['labelon'] }}">
|
||||
<input id="label_on" onkeyup="inputChanged(this);return(false);" name="label_on"
|
||||
class="input-xlarge invalid" type="text" value="{{ status['labelon'] }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
@@ -165,7 +167,22 @@
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function inputChanged(elem) {
|
||||
var validText = new RegExp(/[!@#$%^&*()]+/);
|
||||
if ($(elem).val().length > 0) {
|
||||
//check if contains special characters
|
||||
if (validText.test($(elem).val())) {
|
||||
$(elem).css('border-color', '#F00');
|
||||
$(elem).addClass('invalid');
|
||||
} else {
|
||||
$(elem).css('border-color', '');
|
||||
$(elem).removeClass('invalid')
|
||||
}
|
||||
} else {
|
||||
$(elem).css('border-color', '#F00');
|
||||
$(elem).addClass('invalid');
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
var selected_files = [];
|
||||
@@ -213,7 +230,17 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
$("#form_submitter").bind('click', function(){
|
||||
|
||||
if ($("[name=label_off]").val().length === 0) {
|
||||
$("[name=label_off]").css('border-color', '#F00');
|
||||
return;
|
||||
}
|
||||
if ($("[name=label_on]").val().length === 0) {
|
||||
$("[name=label_on]").css('border-color', '#F00');
|
||||
return;
|
||||
}
|
||||
if ($("[name=label_off]").hasClass('invalid') || $("[name=label_on]").hasClass('invalid')) {
|
||||
return;
|
||||
}
|
||||
if( selected_files.length > 0 ) {
|
||||
$.each( selected_files, function(i, data) {
|
||||
data.submit();
|
||||
|
Reference in New Issue
Block a user