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

Loss of format from adobe webform calculated fields in completed agreement (PDF)

Community Beginner ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

Hi community,

 

I am, after much trial and error, approaching the finish line on a webform for my organization. I used the Adobe Sign webform included with Acrobat Pro, so I don't have access to the advanced Adobe Sign enterprise features. In the webform calculcated field, I am returning a summary of earlier time entries as a weekly schedule. I have provided a sample of the syntax below:

"Monday: " + (if(and([Parent or Guardian 2 - Monday Shift Start] != "", [Parent or Guardian 2 - Monday Shift End] != ""), [Parent or Guardian 2 - Monday Shift Start] + " - " + [Parent or Guardian 2 - Monday Shift End], "OFF")) + "\n" +"Tuesday: " ............ "\n" +"Friday: " + (if(and([Parent or Guardian 2 - Friday Shift Start] != "", [Parent or Guardian 2 - Friday Shift End] != ""), [Parent or Guardian 2 - Friday Shift Start] + " - " + [Parent or Guardian 2 - Friday Shift End], "OFF"))

When I embed the webform and run some sample data in the fields above, the calculated field returns:

Monday: 13:00 - 15:18
Tuesday: OFF
Wednesday: 13:00 - 15:00
Thursday: OFF
Friday: 14:00 - 15:00

I'm not in love with the military time but I'm not super stoked to try to sort that mess out. But, this is the desired format and the data have been matched correctly; but, when I receive the completed agreement and open the pdf, the result is formatted like this (different sample):


Monday: -25203.408333333 - - 25203.90833333333

Kind of at a loss as I'm still getting used to the differences in webforms from a traditional fillable pdf. Any help would be much appreciated, thanks!

 

 

 

 

TOPICS
PDF forms

Views

212

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
Adobe Employee ,
Nov 19, 2024 Nov 19, 2024

Copy link to clipboard

Copied

Hi @GRANTLY,

 

Hope you are doing well. Thanks for writing in! 

 

Web forms are a simplified version of what you see on a traditional fillable PDF. Any scripts that work on the fillable PDF will not work on a web form, and the result will always be a text field return text values compared to the script calculation.

 

Next, if you are looking to work with the same script on a fillable form on Acrobat, you can make a few changes to change the time format from a 24-hour to 12-hour.

You can try this:

// convert decimal time to AM/PM format
function formatTimeToAMPM(decimal) {
    // Convert decimal time to hours and minutes
    var hours = Math.floor(decimal);
    var minutes = Math.round((decimal - hours) * 60);
    
    // Convert 24-hour time to 12-hour AM/PM format
    var period = hours >= 12 ? "PM" : "AM";
    var hour12 = hours % 12;
    if (hour12 === 0) hour12 = 12; // Handle midnight (00:00) and noon (12:00)
    
    // Pad minutes with leading zero
    var formattedTime = hour12 + ':' + (minutes < 10 ? '0' : '') + minutes + ' ' + period;
    return formattedTime;
}


var mondayStart = [Parent or Guardian 2 - Monday Shift Start]; // assuming this is in decimal hours
var mondayEnd = [Parent or Guardian 2 - Monday Shift End];

var mondayShift = (mondayStart !== "" && mondayEnd !== "") ? formatTimeToAMPM(mondayStart) + " - " + formatTimeToAMPM(mondayEnd) : "OFF";

var result = "Monday: " + mondayShift + "\n" +
             "Tuesday: " + (TuesdayStart !== "" && TuesdayEnd !== "" ? formatTimeToAMPM(TuesdayStart) + " - " + formatTimeToAMPM(TuesdayEnd) : "OFF") + "\n" +
             "Wednesday: " + (WednesdayStart !== "" && WednesdayEnd !== "" ? formatTimeToAMPM(WednesdayStart) + " - " + formatTimeToAMPM(WednesdayEnd) : "OFF") + "\n" +
             "Thursday: " + (ThursdayStart !== "" && ThursdayEnd !== "" ? formatTimeToAMPM(ThursdayStart) + " - " + formatTimeToAMPM(ThursdayEnd) : "OFF") + "\n" +
             "Friday: " + (FridayStart !== "" && FridayEnd !== "" ? formatTimeToAMPM(FridayStart) + " - " + formatTimeToAMPM(FridayEnd) : "OFF");

console.log(result); // Outputs the formatted result

Hope this clarifies your question.


-Souvik

Community & Social Consultant | Document Cloud | Adobe

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 ,
Nov 20, 2024 Nov 20, 2024

Copy link to clipboard

Copied

Hi Souvik,

 

Thanks for your reply! Yes, I've discovered how different calculated fields in webforms are from those in Acrobat. The fomrulas I provided were already modified to work with webforms and I already have working calculations in the original Acrobat documents.

 

In the webform, the output was set to 'text' and the calculations display correctly when the webform is actively being edited. However, when I view the completed agreement, these fields are no longer even in military time format, but some other time format. 

 

My confusion lies in why the webform displays properly during filling, but the data are not correct in the final document. 

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 20, 2024 Nov 20, 2024

Copy link to clipboard

Copied

Adobe Sign offer a very limited support for scripts.

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 20, 2024 Nov 20, 2024

Copy link to clipboard

Copied

Changing the appearance and content of a document when it is signed is prohibited in many countries, including my own.
I've been reporting this problem to Adobe for over 10 years now, without success.

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 ,
Nov 20, 2024 Nov 20, 2024

Copy link to clipboard

Copied

@JR Boulay I had assumed this was potentially a flattening issue during converstion to an actual PDF. But I'm now thinking that even though the webform field is calculated and set to display as text, that the time values I'm pulling are still being treated as numbers and not strings. As I can't use a text() function, the only workaround I can think of is to use a datePart function and individually call all the numbers, but that will be a monster formula. Again, AI writes most of my functions at this point so I may be overcomplicating it. 

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
Adobe Employee ,
Nov 21, 2024 Nov 21, 2024

Copy link to clipboard

Copied

@JR Boulay Good news!

 

The team has acknowledged this and a ticket is logged. 

This will be worked upon, and a fix to be aligned very soon.

 

-Souvik

Community & Social Consultant | Document Cloud | Adobe

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 22, 2024 Nov 22, 2024

Copy link to clipboard

Copied

LATEST

Better late than never. This is good news.
Thank 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
Community Expert ,
Nov 21, 2024 Nov 21, 2024

Copy link to clipboard

Copied

GRANTLY: (and S. S)

In fact, it would work properly if the PDF was flattened just before it was signed, which would allow it to keep the formats and calculation results intact.
Unfortunately Adobe still hasn't understood 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
Adobe Employee ,
Nov 21, 2024 Nov 21, 2024

Copy link to clipboard

Copied

Thanks @JR Boulay @GRANTLY for this.

 

Let me take this up with the team and circle back to you.

 

-Souvik

Community & Social Consultant | Document Cloud | Adobe

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