GDFS#26662 Date selectie lijkt niet altijd te wissen
svn path=/Website/trunk/; revision=18651
This commit is contained in:
@@ -359,3 +359,55 @@ function updateLocation()
|
||||
}
|
||||
}
|
||||
|
||||
function checkDividePeriod(value)
|
||||
{
|
||||
if (value == "") return true;
|
||||
var valid = true;
|
||||
var arr = /^(\d{4})[-](\d{1,2})$/.exec(value);
|
||||
if (arr)
|
||||
{
|
||||
var dt = new Date( arr[1], arr[2] -1, 1 );
|
||||
if ((arr[2] != dt.getMonth() + 1) ||
|
||||
(arr[1] != dt.getYear() && arr[1] != dt.getFullYear()) ) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
else valid = false;
|
||||
return(valid);
|
||||
}
|
||||
|
||||
function kenmerkDividePeriodKey(evt)
|
||||
{
|
||||
var e = evt || event;
|
||||
var kc = e.which || e.keyCode;
|
||||
if (kc >= 48 && kc <= 57) return;
|
||||
if (String.fromCharCode(kc) == '<%=L("lcl_date_separator")%>' ||
|
||||
String.fromCharCode(kc) == '-') return;
|
||||
e.returnValue = false;
|
||||
}
|
||||
|
||||
function kenmerkDividePeriodChange(evt)
|
||||
{
|
||||
var e = evt || event;
|
||||
if( e.propertyName != 'value' ) return;
|
||||
|
||||
var el = e.srcElement || e.target;
|
||||
var newT = el.value;
|
||||
var nm = el.name;
|
||||
var oldT = dateInputs[nm]; if (oldT == null) oldT = '';
|
||||
var valid = false;
|
||||
|
||||
if (newT == '') valid = true; else
|
||||
if (/^\d{4}$/.test(newT))
|
||||
{
|
||||
el.value += '<%=L("lcl_date_separator")%>';
|
||||
valid = true;
|
||||
}
|
||||
else if (/^\d{1,4}(|[-](|\d{1,2}))$/.test(newT))
|
||||
{
|
||||
valid = true;
|
||||
}
|
||||
if (valid) dateInputs[nm] = el.value; else
|
||||
if (el.value != oldT) el.value = oldT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user