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

populating textfield based on the drop list selection.

New Here ,
Nov 10, 2020 Nov 10, 2020

Copy link to clipboard

Copied

Hello my Friends,

 

I need your help for this problem and I need the code for this issue.

 

Here the details for this form.

 

In the the Status Dropbox there 3 categories ( Pending, Invoice and Release)

 

When I select the “Pending  Status in  dropbox, then select the Reservation date and select the Deposit Dropbox (yes or No) then result in Over due text box

if “yes” selection from deposit dropbox  = display in overdue textbox is “14 days"

If  no” selection from deposit dropbox = display in overdue textbox is “ 3 days”  

Screen Shot 2020-11-10 at 3.47.11 PM.JPG

If the status select, invoice and release not showing the overdue. Mean blank only. Only the Pending showing the output in over due textbox.

 

Please refer the sample in excel in attached. So that you have idea what I mean.   The main point there is if you change the date automatic the over due is change the no. of days.

 

Also, the pdf file sample but without code in over due because I don’t know how to do it.

 

Thanks you advance for you help.

TOPICS
Acrobat SDK and JavaScript

Views

1.1K

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 2 Correct answers

Community Expert , Nov 10, 2020 Nov 10, 2020

Put the code in "OD1" field as "Custom Calculation Script"

if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "Yes"){
event.value = "14 Days";}
else if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "No"){
event.value = "3 Days";}
else event.value = "";

Votes

Translate

Translate
Community Expert , Nov 11, 2020 Nov 11, 2020

See if this works for you example 

This is code I put in "OD1" field as custom calculation script:

var today = util.printd("mmmm/d/yyyy", new Date());
var overdue = this.getField("Date1A_af_date").value;
if (today.length && overdue.length) {
var datetoday = util.scand("mmmm d, yyyy", today);
var dateoverdue = util.scand("mmmm d, yyyy", overdue);
var diff = (dateoverdue.valueOf() - datetoday.valueOf())/1000;
var days = (((diff / 60) / 60) / 24);
var res = days+14;
var res2 = days+3;}
if(this.getField("Statu

...

Votes

Translate

Translate
Community Expert ,
Nov 10, 2020 Nov 10, 2020

Copy link to clipboard

Copied

You can find scripts for this in the forum.

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 ,
Nov 10, 2020 Nov 10, 2020

Copy link to clipboard

Copied

Hi Bernd, please can you find me. because i try to find this same question but unfortunely I did see the script what I'm looking for. 

 

 

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 ,
Nov 10, 2020 Nov 10, 2020

Copy link to clipboard

Copied

Look also at "Related conversations".

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
Enthusiast ,
Nov 10, 2020 Nov 10, 2020

Copy link to clipboard

Copied

How exactly do you want second part of your question if date is changed to work?

If it's todays date it shows "14 days" and lets say its November 14 2020 what does it need to show then?

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 ,
Nov 10, 2020 Nov 10, 2020

Copy link to clipboard

Copied

Hi Asim,

 

Anyway forget the second question.  Sorry for that.

 

I need only the code for that 1st part. Please can you help me this.

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 ,
Nov 10, 2020 Nov 10, 2020

Copy link to clipboard

Copied

Put the code in "OD1" field as "Custom Calculation Script"

if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "Yes"){
event.value = "14 Days";}
else if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "No"){
event.value = "3 Days";}
else event.value = "";

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 ,
Nov 10, 2020 Nov 10, 2020

Copy link to clipboard

Copied

finally. thanks 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
New Here ,
Nov 10, 2020 Nov 10, 2020

Copy link to clipboard

Copied

Hi Nesa,

 

One more your help please. The code you give is work is good for me.

 

But my  boss he said some wrong in the formula and additional info to give to me.

 

Please can you open the excel (sample) in attached in my post. if you notice if you change the date the no. of days in overdue is changes also not only 14 days or 3 days. you can see also the formula from excel. 

 

Please can you do also this the code.  Sorry for  I disturb you. 

 

 

 

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 ,
Nov 10, 2020 Nov 10, 2020

Copy link to clipboard

Copied

also, if  I want to change the date example below.

 

10/10/2020  - the result in over due is  -8 days

12/20/2020 - the result in over due is 53 days.

 

you can see there the sample in excel.

 

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 ,
Nov 11, 2020 Nov 11, 2020

Copy link to clipboard

Copied

See if this works for you example 

This is code I put in "OD1" field as custom calculation script:

var today = util.printd("mmmm/d/yyyy", new Date());
var overdue = this.getField("Date1A_af_date").value;
if (today.length && overdue.length) {
var datetoday = util.scand("mmmm d, yyyy", today);
var dateoverdue = util.scand("mmmm d, yyyy", overdue);
var diff = (dateoverdue.valueOf() - datetoday.valueOf())/1000;
var days = (((diff / 60) / 60) / 24);
var res = days+14;
var res2 = days+3;}
if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "Yes"){
event.value = res.toFixed();}
else if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "No"){
event.value = res2.toFixed();}
else event.value = "";

 

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 ,
Nov 11, 2020 Nov 11, 2020

Copy link to clipboard

Copied

LATEST

you're amazing. thank you for your support. 

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
Enthusiast ,
Nov 11, 2020 Nov 11, 2020

Copy link to clipboard

Copied

I asked you about that and you said forget that, you just need first part and now when  you got first part you asking for second part.

What you ask is way more complicated to do, especially since you obviously asking someone to do your job for free. Good luck.

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 ,
Nov 11, 2020 Nov 11, 2020

Copy link to clipboard

Copied

sorry for that Asim.

Because my boss he want to follow the formula from excel.  But I don't know how to do in PDF file. 

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