FIX date saving when using html dates (like with blind-user mode).

This commit is contained in:
Laurent Destailleur
2025-12-31 14:54:54 +01:00
parent 64e5b9569b
commit dfd745f77e
2 changed files with 5 additions and 3 deletions

View File

@@ -7777,7 +7777,7 @@ class Form
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="'.($usecalendar == 'html' ? "date" : "text").'" class="maxwidthdate center" maxlength="11" value="'.$formatted_date.'"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($usecalendar == 'html' ? 'yyyy-mm-dd' : $langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= ' autocomplete="off">';
// Icon calendar

View File

@@ -243,15 +243,17 @@ function getObjectFromID(id){
// Called after the selection or typing of a date to save details into detailed fields
function dpChangeDay(dateFieldID, format)
{
console.log("Call dpChangeDay, we save date into detailed fields from format = "+format);
console.log("Call dpChangeDay, we save date from field "+dateFieldID+" into detailed fields from format = "+format);
var thefield = getObjectFromID(dateFieldID);
var thefieldday = getObjectFromID(dateFieldID+"day");
var thefieldmonth = getObjectFromID(dateFieldID+"month");
var thefieldyear = getObjectFromID(dateFieldID+"year");
console.log("string date value is " + thefield.value);
var date = getDateFromFormat(thefield.value, format);
//console.log(date);
if (date)
{
thefieldday.value = date.getDate();