On the form below, when I click the green + button (far right), a new table row is created with today's date. the user can then enter more text to the right of the date. Problem is when the form is saved and reopened, the text the user enters is deleted and new today's date added because it is in the intialize event. How do I script to check and make sure each dated row is empty before adding today's date?
https://acrobat.com/#d=qTINfyoXA-U6cDxOGgcSEw
Thanks,
~Don
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Don,
One option would be to use the caption area of the textfield for the date and leave the value portion free for the user to input their data:
if (xfa.resolveNode("this.caption.value.#text").value === "") {
this.caption.value.text = util.printd("[mm/dd/yy] ", new Date() );
}
See here: https://acrobat.com/#d=VjJ-YsXLKmV6QU84JrAAIw.
Hope that helps,
Niall
Views
Replies
Total Likes
Hi Don,
One option would be to use the caption area of the textfield for the date and leave the value portion free for the user to input their data:
if (xfa.resolveNode("this.caption.value.#text").value === "") {
this.caption.value.text = util.printd("[mm/dd/yy] ", new Date() );
}
See here: https://acrobat.com/#d=VjJ-YsXLKmV6QU84JrAAIw.
Hope that helps,
Niall
Views
Replies
Total Likes
Niall,
Your solution works great!
Is it also possible to use a text field to the left of this text field (in subform) so I can have the option of allowing the user to be able to change the date?
Thanks again!
~Don
Views
Replies
Total Likes
Hi Don,
Yes it would. You would just need to reference the textfield. Maybe get the script to populate the textfield on the button's click event rather than the textfield's initalize event. That way it will not get overridden when the form is reopened.
Niall
Views
Replies
Total Likes
Thanks for your help with this Niall.
~Don
Views
Replies
Total Likes