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

Fromatting date

Explorer ,
Oct 02, 2024 Oct 02, 2024

Hello

I need creat java script :

When I take copy of date
Such as formate : 20241028

And past at feild will be shown
28-10-2024 start from

Add Word (start from)
And add symbol (-) to date

TOPICS
Create PDFs , Edit and convert PDFs , How to , JavaScript , PDF , PDF forms
1.2K
Translate
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
3 ACCEPTED SOLUTIONS
Community Expert ,
Oct 02, 2024 Oct 02, 2024

Enter the following custom format script:

 

if(event.value)
{
var date=util.scand("yyyymmdd", event.value);
event.value="start from "+ util.printd("dd-mm-yyyy", date)+ " -";
}

View solution in original post

Translate
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 ,
Oct 03, 2024 Oct 03, 2024

My mistake.  Did Print.  That runs after you print.  Will print runs when you trigger print but before it actually prints.  So if you want the field values to show up on the print, it's Did Print.  Then they will reset after you print.

View solution in original post

Translate
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 ,
Oct 04, 2024 Oct 04, 2024

Yes.  You have to set it with a script if by "empty" you mean no value.  You use a space.  It will look empty (the space).

View solution in original post

Translate
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 ,
Oct 02, 2024 Oct 02, 2024

Enter the following custom format script:

 

if(event.value)
{
var date=util.scand("yyyymmdd", event.value);
event.value="start from "+ util.printd("dd-mm-yyyy", date)+ " -";
}

Translate
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
Explorer ,
Oct 02, 2024 Oct 02, 2024

It is Working dear 

On more thing 

Can create script when i print pdf 

Feild be reset from any data 

Translate
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 ,
Oct 02, 2024 Oct 02, 2024

Before print or after?

Translate
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
Explorer ,
Oct 02, 2024 Oct 02, 2024

After prrint  dear 

Translate
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 ,
Oct 03, 2024 Oct 03, 2024

With the new Acrobat disabled, search "Document" in the tools tab, then select "Document Actions" under "JavaScript", then "Did Print":

PDFAutomationStation_0-1727954916976.pngPDFAutomationStation_1-1727954956070.png

Enter the following script:

this.resetForm();

 

Translate
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
Explorer ,
Oct 03, 2024 Oct 03, 2024

Dear

I think should choose 

Document will print 

Or

Document did print

What is different between them

Regards.

Translate
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 ,
Oct 03, 2024 Oct 03, 2024

My mistake.  Did Print.  That runs after you print.  Will print runs when you trigger print but before it actually prints.  So if you want the field values to show up on the print, it's Did Print.  Then they will reset after you print.

Translate
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
Explorer ,
Oct 03, 2024 Oct 03, 2024

Many thanks dear 

Have ance day 

Translate
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
Explorer ,
Oct 04, 2024 Oct 04, 2024

Dear 

I use this script to reset specific field from data when (did print)

I is working okay at all fields except field (dropdown)

Can check where is mistake at below script:

//array of the field names to clearvar aFields = new Array("text1","text2","text3","Dropdown1");
//clear the field in the array of namesthis.resetForm(aFields);

Translate
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 ,
Oct 04, 2024 Oct 04, 2024

What is the default value of the Dropdown1, and is Dropdown1 spelled correctly, including spacing and case sensitivity?

Translate
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
Explorer ,
Oct 04, 2024 Oct 04, 2024

Yes dear Dropdown1 spelled correctly

But default value I don't have.

I have only three choices from drop down list

Screenshot_20241004_214119.jpg

 

Can I have empty default value at drop  down list? 

Translate
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 ,
Oct 04, 2024 Oct 04, 2024

Yes.  You have to set it with a script if by "empty" you mean no value.  You use a space.  It will look empty (the space).

Translate
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
Explorer ,
Oct 05, 2024 Oct 05, 2024

It is Working 

Many thanks

Translate
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 05, 2024 Nov 05, 2024
LATEST

This will not work in a PDF form.

Translate
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