mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Validate custom text
This commit is contained in:
parent
a3069fdf76
commit
38695482c0
@ -577,7 +577,7 @@ function html_print_select_groups(
|
||||
);
|
||||
|
||||
if ($required !== false) {
|
||||
$require_message = __('Please select an item from this list.');
|
||||
$require_message = __('Please select an item from this list. Madafaka');
|
||||
}
|
||||
|
||||
if (empty($size) === true) {
|
||||
@ -599,13 +599,6 @@ function html_print_select_groups(
|
||||
$(document).ready(function() {
|
||||
$('select[name="<?php echo $name; ?>"]').each(
|
||||
function() {
|
||||
<?php
|
||||
if ($required !== false) {
|
||||
?>
|
||||
this.setCustomValidity('<?php echo $require_message; ?>');
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
$(this).select2({
|
||||
multiple: <?php echo ($multiple) ? 'true' : 'false'; ?>,
|
||||
placeholder: "<?php echo __('Please select...'); ?>",
|
||||
@ -640,6 +633,25 @@ function html_print_select_groups(
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<?php
|
||||
if ($required !== false) {
|
||||
?>
|
||||
$(this).on('change', function(e) {
|
||||
e.currentTarget.setCustomValidity('');
|
||||
})
|
||||
|
||||
$(this).on('invalid', function(e) {
|
||||
if ($(e.currentTarget).val() == null) {
|
||||
e.currentTarget.setCustomValidity(
|
||||
'<?php echo $require_message; ?>'
|
||||
);
|
||||
}
|
||||
})
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user