• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using the same date field to create another date in another format.

Community Beginner ,
Apr 14, 2021 Apr 14, 2021

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

TOPICS
PDF forms

Views

998

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 15, 2021 Apr 15, 2021

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.

Votes

Translate

Translate
Community Expert ,
Apr 14, 2021 Apr 14, 2021

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

I want a drop down that has you choose a date but only shows yyyy. This then translates to another field on the form with the full date.



Get Outlook for iOS

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 14, 2021 Apr 14, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 15, 2021 Apr 15, 2021

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? 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 15, 2021 Apr 15, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 15, 2021 Apr 15, 2021

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.

 

defaultm8szb2i7u1k8_0-1618511187147.png

Sorry if this is confusing! 😞

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 15, 2021 Apr 15, 2021

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***

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 15, 2021 Apr 15, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 15, 2021 Apr 15, 2021

Copy link to clipboard

Copied

LATEST

Thank you Nesa!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines