Hello
I have put a DATE object on my form by dragging standard tab of pallette, so that i am getting a CALENDER once the user is dropped down, fine.
But, at the same time form/date object is allowing user to enter date manually by typing on the field, but we do not want to give this ability/flexibilty to user, bcz of below reasons,
1 - My form is global, where in US and Europe user will use this form, where in the date FORMATS are different
2 - I need to put many validations under PATTERN (Edit, Display, Validation) as suggested below and a i guess a piece of Script as well, since i was newbie to Adobe, its kind of pain
http://thelivecycle.blogspot.com/2011/10/date-patterns.html
Hence pls. let me know that How can disable this flexibilty / ability, user must to use the calender if user want to enter the date. Its obviuos that i can grey it out, i guess, do i need to write some JavaScript / FormCalc script under ENTER / MOUSE ENTER event that user should not even/try put cursor on the value entry space of the field
Any good suggestion pls.? also provide me Script (Either JS or FormCalc any thing is fine, which is simpler) ?
Thank you
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
A bit of a clunky workaround, but see if it suits: https://acrobat.com/#d=eLNoCRrmE9t*kfnh4ikqNA.
Hope that helps,
Niall
Views
Replies
Total Likes
Any help pls.?
Thank you
Views
Replies
Total Likes
Hi,
The following script in the change event of the date field will alert the user and prevent keyboard inputs:
if (xfa.event.newText.length == 1) {
xfa.host.beep("3");
xfa.event.change = "";
}
Hope that helps,
Niall
Won't this cause problems on platforms besides Windows? I thought the date picker didn't work on OSX?
Views
Replies
Total Likes
Hi Jono,
The Dynamic XML Form and Static PDF (both XFA) will open perfectly in Acrobat and Reader (for Mac). The script and the date picker work without any difficulty.
The problem may be if the user has a third-party PDF viewer (less likely to be a problem) OR in Apple Mac they use Apple Preview (a huge problem).
Preview does not open a Dynamic XML Form at all - so no problem with the data picker
Preview will open a Static PDF Form, AND the date picker does NOT work. However the script does NOT work either - so no cahnge really
Niall
Thank you Niall, We are Windows 7, its working perfectly, but small problem.
If user is want to fool the system, the user will pick the date from the calender, then manually changes the date by typing data into it.
If you get a chance, pls. let me know(JS code pls.) how can i fix it, i mean, the user should not change the data once picked from calender or in other words user should not input/enter any invalid date.
Thank you
Views
Replies
Total Likes
I'll try when I get a chance,
Niall
Views
Replies
Total Likes
Sure, Thank you
Views
Replies
Total Likes
Hello Niall,
Did you get a chance to look into my item?
Thank you,
-Srinivas
Views
Replies
Total Likes
Hi,
A bit of a clunky workaround, but see if it suits: https://acrobat.com/#d=eLNoCRrmE9t*kfnh4ikqNA.
Hope that helps,
Niall
Views
Replies
Total Likes
Awesome, simple and perfect.
Okay, i will copy & paste your code into the date field's ENTER and CHANGE events, fine.
Just a quick question, to create a Script Object, just i need to right click on the top of form's hierachy (form level), and shuld name it as Utils, thats ALL right.... am all set right? or do i need to do some thing else additionalyy with this newely created Script object - Utils?
I am following the below link for creating our Script object - Utils
http://www.peachpit.com/articles/article.aspx?p=1021020&seqNum=7
Thank you
Views
Replies
Total Likes
Hi,
That article is from JP Terry's book on LiveCycle Designer, which I would recommend.
Basically you right-click on the root node (typicaly form1) and select "Insert Script Object" from the menu. This will insert an unnamed script object under Variables. You can then name this script object (in this case Utils) and copy the script into the script object.
Hope that helps,
Niall
Thank you.
I did not understood the last part of your statement that as below ,
Which script (from where) i need to copy and put it into Script object?
I am thinking that i need to do just below,
1) Creating a Script object as mentioned, giving some name to it, say Utilas
2) Copy & paste your script (as provided in your link's pdf) in the date field's ENTER and CHANGE events.
thats all right? Pls. let me know
Thank you
Views
Replies
Total Likes
Hi,
No, the script in the enter and change events must be copied across to the respective events in your date object.
The script in the Utils script object contains a single line of script:
var sOriginalValue = "";
This is used to store the initial/original value of the date field. This can then be compared in the change event
Hope that helps,
Niall
Views
Replies
Total Likes
Hi Niall,
The user can still delete only a part of the selected date (something like just the last digit in the date to leave an incomplete data) from the field. How do we avoid that?
Thanks
Views
Replies
Total Likes
Hi,
Change the test condition from:
if (xfa.event.change.length == 1) {
to
if (xfa.event.change.length <= 1) {
That will also test delete operations.
Undated example here: https://acrobat.com/#d=eLNoCRrmE9t*kfnh4ikqNA.
Niall
Awesome! Thank you for your detaioed answer with a picture.
Views
Replies
Total Likes
Hi!
I am in search of a similar solution for my client, and this one seems to fit the bill. But unfortunatly, the links in the answers are broken. Could you please provide valid links or perhaps paste the solution in the thread?
Thanks in advance!
Att.,
Flavio Rasseli
Views
Replies
Total Likes
Im having a similar requirement . Need to restrict user entering dates directly . User should only pick from calendar . Can you please help me with sample code ?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies