#13344 jquery control date token

This commit is contained in:
Jonathan 2024-04-11 17:19:15 +02:00
parent 06e7740234
commit 8bea6c8ba1
2 changed files with 23 additions and 5 deletions

View File

@ -122,7 +122,7 @@ $table->data[1][1] = html_print_input_text(
50,
255,
true
);
).html_print_input_hidden('today_date', date('Y-m-d'), true);
$table->data[1][2] = __('Expiration Time');
$table->data[1][3] = html_print_input_text(
@ -134,7 +134,7 @@ $table->data[1][3] = html_print_input_text(
true
);
echo '<form class="max_floating_element_size" method="post" action="'.$url_list.'">';
echo '<form class="max_floating_element_size" id="form_token" method="post" action="'.$url_list.'">';
html_print_table($table);
@ -143,7 +143,7 @@ $actionButtons = [];
if (empty($id_token) === true) {
$actionButtons[] = html_print_submit_button(
__('Create'),
'crt',
'next',
false,
['icon' => 'wand'],
true
@ -152,7 +152,7 @@ if (empty($id_token) === true) {
} else {
$actionButtons[] = html_print_submit_button(
__('Update'),
'upd',
'next',
false,
['icon' => 'update'],
true
@ -201,4 +201,22 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
closeText: '<?php echo __('Close'); ?>'
});
});
$('#button-next').on('click', function() {
event.preventDefault();
var date = $('#text-date-expiration').val();
if (date !== '') {
if (date < $('#hidden-today_date').val()) {
confirmDialog({
title: "<?php echo __('Error'); ?>",
message: "<?php echo __('Date expiration must be bigger than today.'); ?>",
hideCancelButton: true,
});
} else{
$('#form_token').submit();
}
} else {
$('#form_token').submit();
}
})
</script>

View File

@ -214,7 +214,7 @@ try {
echo $e->getMessage();
}
echo '<form method="post" action="'.$edit_url.'">';
echo '<form method="post" id="" yaction="'.$edit_url.'">';
html_print_action_buttons(
html_print_submit_button(
__('Create Token'),