summaryrefslogtreecommitdiff
path: root/pdf/pdf_util.js
diff options
context:
space:
mode:
Diffstat (limited to 'pdf/pdf_util.js')
-rw-r--r--pdf/pdf_util.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/pdf/pdf_util.js b/pdf/pdf_util.js
index d709661b..a70cb3ce 100644
--- a/pdf/pdf_util.js
+++ b/pdf/pdf_util.js
@@ -301,6 +301,19 @@ function AFParseDateEx(d, fmt)
return AFParseTime(dt[1], dout);
}
+function AFDate_KeystrokeEx(fmt)
+{
+ if (event.willCommit && !AFParseDateEx(event.value))
+ event.rc = false;
+}
+
+function AFDate_Keystroke(index)
+{
+ var formats = ['m/d','m/d/yy','mm/dd/yy','mm/yy','d-mmm','d-mmm-yy','dd-mm-yy','yy-mm-dd',
+ 'mmm-yy','mmmm-yy','mmm d, yyyy','mmmm d, yyyy','m/d/yy h:MM tt','m/d/yy HH:MM'];
+ AFDate_KeystrokeEx(formats[index]);
+}
+
function AFDate_FormatEx(fmt)
{
var d = AFParseDateEx(event.value, fmt);
@@ -315,6 +328,12 @@ function AFDate_Format(index)
AFDate_FormatEx(formats[index]);
}
+function AFTime_Keystroke(index)
+{
+ if (event.willCommit && !AFParseTime(event.value, null))
+ event.rc = false;
+}
+
function AFTime_FormatEx(fmt)
{
var d = AFParseTime(event.value, null);
@@ -353,6 +372,29 @@ function AFSpecial_Format(index)
event.value = res ? res : '';
}
+function AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend)
+{
+ if (sepStyle & 2)
+ {
+ if (!event.value.match(/^[+-]?\d*[,.]?\d*$/))
+ {
+ event.rc = false;
+ return;
+ }
+ }
+ else
+ {
+ if (!event.value.match(/^[+-]?\d*\.?\d*$/))
+ {
+ event.rc = false;
+ return;
+ }
+ }
+
+ if (event.willCommit && !event.value.match(/\d/))
+ event.rc = false;
+}
+
function AFNumber_Format(nDec,sepStyle,negStyle,currStyle,strCurrency,bCurrencyPrepend)
{
var val = event.value;
@@ -482,3 +524,12 @@ function AFSimple_Calculate(op, list)
event.value = res;
}
+
+function AFRange_Validate(lowerCheck, lowerLimit, upperCheck, upperLimit)
+{
+ if (upperCheck && event.value > upperLimit)
+ event.rc = false;
+
+ if (lowerCheck && event.value < lowerLimit)
+ event.rc = false;
+}