BUG 9238 "The Date field format changes when you want to edit" SOLVED
- Date fields do not respect the mask defined in the XML when editing the field manually - Now when you edit a date field in a dynaForm respected his mask
This commit is contained in:
@@ -1157,9 +1157,11 @@ function G_Text( form, element, name)
|
||||
if (me.element.readOnly) {
|
||||
return true;
|
||||
}
|
||||
if (( me.mType != 'currency' && me.mType != 'percentage') && (me.element.value.length > me.element.maxLength - 1)) {
|
||||
|
||||
if ((me.mType != 'currency' && me.mType != 'percentage' && me.mType != 'date') && (me.element.value.length > me.element.maxLength - 1)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (me.validate == 'Any' && me.mask == '') return true;
|
||||
//THIS FUNCTION HANDLE ALL KEYS EXCEPT BACKSPACE AND DELETE
|
||||
//keyCode = event.keyCode;
|
||||
@@ -3234,5 +3236,39 @@ function hideRowsById(aFields){
|
||||
}
|
||||
}
|
||||
|
||||
function dateSetMask(mask) {
|
||||
if (mask != '') {
|
||||
mask = stringReplace("%y", "yy", mask);
|
||||
mask = stringReplace("%Y", "yyyy", mask);
|
||||
|
||||
mask = stringReplace("%m", "mm", mask);
|
||||
mask = stringReplace("%o", "mm", mask);
|
||||
|
||||
mask = stringReplace("%d", "dd", mask);
|
||||
mask = stringReplace("%e", "dd", mask);
|
||||
|
||||
//In the function getCleanMask valid characters for an mask that does not
|
||||
//is currency/percentage are: '0 ',' # ',' d ',' m ',' y ',' Y '.
|
||||
//For hours, minutes and seconds replace this mask with '#'
|
||||
mask = stringReplace("%H", "##", mask);
|
||||
mask = stringReplace("%I", "##", mask);
|
||||
mask = stringReplace("%k", "##", mask);
|
||||
mask = stringReplace("%l", "##", mask);
|
||||
|
||||
mask = stringReplace("%M", "##", mask);
|
||||
mask = stringReplace("%S", "##", mask);
|
||||
|
||||
mask = stringReplace("%j", "###", mask);
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
function stringReplace(strSearch, strReplace, str) {
|
||||
var expression = eval("/" + strSearch + "/g");
|
||||
|
||||
return str.replace(expression, strReplace);
|
||||
}
|
||||
|
||||
/* end file */
|
||||
|
||||
|
||||
@@ -133,7 +133,9 @@
|
||||
{elseif ($field->type==='date')}
|
||||
myForm.aElements[i] = new G_Date(myForm, myForm.element.elements['form[{$name}]'],'{$name}');
|
||||
myForm.aElements[i].setAttributes({$field->getAttributes()});
|
||||
myForm.aElements[i].mask = 'yyyy-mm-dd';
|
||||
if (myForm.aElements[i].mask) {literal}{{/literal}
|
||||
myForm.aElements[i].mask = dateSetMask(myForm.aElements[i].mask);
|
||||
{literal}}{/literal}
|
||||
{$field->attachEvents("myForm.aElements[i].element")}
|
||||
{elseif ($field->type==='hidden')}
|
||||
myForm.aElements[i] = new G_Text(myForm, myForm.element.elements['form[{$name}]'],'{$name}');
|
||||
|
||||
Reference in New Issue
Block a user