Copy link to clipboard
Copied
Hello everyone,
I am fixing a form and because of the amount of these forms in use I am only able to change the fields and not the actually form boxes.
My issue is there is a spot to indicate Expiry Year. Later in the document there is a box for expiry date which is the full version of the Expiry Year date box that just asks for the year only.
Is there a way to set the Expiry Year field to display just the year (yyyy) while displaying the full date (yyyy|mm|dd) in a box later in the form?
Sorry if this isnt clear enough.
-Steve
As calculation script of "Full date" field try this:
var ey = this.getField("expireyear").valueAsString;
var dob = this.getField("dateofbirth").valueAsString;
var md = dob.split("/");
if(ey == "" || dob == "")
event.value = "";
else
event.value = ey+"/"+md[1]+"/"+md[2];
Change field names to your field names for date of birth and year field.
This assume you use yyyy/mm/dd format as date of birth.
If it needs to change something let me know.
Copy link to clipboard
Copied
So you want the user to fill in the Expiry Date field and then have the year part of that copy over to Expiry Year, basically?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I'm not sure that will work... For the first part try setting the Format of the field to Date and the pattern to "yyyy" under Custom. If that works then you just need to copy that value to the other field, but it's not going to be a full date in the first one, I don't think. It will only be a year.
Copy link to clipboard
Copied
Is there a way to use the yyyy from that date field and the dd and mm from another to make one complete date?
Copy link to clipboard
Copied
Why just not set field with full date first?
Here is my suggestion, you can have third field in which you select date, once you select it, year field can just use year and full date get full date from it, also you can set it to hide once yyyy field is set and unhide it if you delete yyyy field and want to select another date.
Copy link to clipboard
Copied
I would love to, but where the full date field is listed is way down in the document. Quite a bit in fact. I am not able to adjust the layout of the form/document at all. Because instead of expiry year I would just make an expiry year box so it easily shows on the rest of the document.
The form's first page has a section to indicate expiry year only and Date of Birth. Later in the form it asks for the expiry date. The combination of the Expiry year field and the month and day field could technically make the expiry date needed as the ddmm info is the same.
Sorry if this is confusing! 😞
Copy link to clipboard
Copied
Because instead of expiry year I would just make an expiry date box so it easily shows on the rest of the document.
***edit***
Copy link to clipboard
Copied
As calculation script of "Full date" field try this:
var ey = this.getField("expireyear").valueAsString;
var dob = this.getField("dateofbirth").valueAsString;
var md = dob.split("/");
if(ey == "" || dob == "")
event.value = "";
else
event.value = ey+"/"+md[1]+"/"+md[2];
Change field names to your field names for date of birth and year field.
This assume you use yyyy/mm/dd format as date of birth.
If it needs to change something let me know.
Copy link to clipboard
Copied
Thank you Nesa!