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

Form field Month customizations

New Here ,
Jan 10, 2025 Jan 10, 2025

Copy link to clipboard

Copied

I have a rental agreement that I would like to update with some conditional form fields. I allow my tenants to choose either a 3-month or 6-month autorenewing contract, but also like to spell out for them the months which the contract will renew on. To make it super easy for me, and to not make me look/feel like an idiot counting on my fingers when a tenant sits down with me to sign, I would love to have either a dropdown with the month of the initial signing, that pre-populates the next signing months based on their term.

 

For example, if they sign a 3-month renewal lease in January, then the next form will auto populate April, the following July,  the final in September.

 

Or, if they choose a 3-month in March it would be >> June >> September >> December.

 

Does that make sense?

TOPICS
Create PDFs , How to , JavaScript , PDF , PDF forms

Views

75

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 ,
Jan 10, 2025 Jan 10, 2025

Copy link to clipboard

Copied

Do you have a separate field for the duration of the contract, or do you have one drop-down that corresponds with 3 months, and another with 6?

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 ,
Jan 10, 2025 Jan 10, 2025

Copy link to clipboard

Copied

To get the new month names you'll need a mapping object. Then the current month can be identified relative to the following months. 

 

Here's a simple script that is placed in the "Validation" script for the initial signing month dropdown. 

The script assumes the names of the next signing months are "NextSign1", "NextSign2", "NextSign3"

 

 

var aMonthNames =["January","February", "March", "April", "May", "June", "July", "August", "September", "October","November","December"];

var nMnthNum = aMonthNames.indexOf(event.value);

for(i=1;i<=3;i++)
   this.getField("NextSign" + i).value = aMonthNames[(nMnthNum + i*3)%12];

 

 

This script can be modified to include the signing period and number of periods. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
New Here ,
Jan 10, 2025 Jan 10, 2025

Copy link to clipboard

Copied

Oh wow! I didn't expect such a quick response!

Here is a screenshot of how the document is currently set up. Right now I have them just as text boxes.

 

So, I would need one form for the 6-month and another for the 3-month

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 ,
Jan 10, 2025 Jan 10, 2025

Copy link to clipboard

Copied

LATEST

You can have one form  that includes all options. 

However, in order to script the actions you would like, the form fields have to be named. It is the names that the script uses to manipulate the field data. 

You can read more about form scripting here:

https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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