Highlighted

Javascript question for character counts and expanding text box

Community Beginner ,
Oct 12, 2020

Copy link to clipboard

Copied

I posted the following question in the Adobe LiveCycle forum, but it appears to be hidden or something. The link to the post goes to a 404 error if the person is not signed in to the board, apparently. So I'm reposting it here, and apologies, I know this isn't a LiveCycle forum, but I'm getting a bit desperate for help.

_____________________________

 

I have an old form that was created by someone else in 2015 in LiveCycle. I am working on it in Designer but have very little experience with it; I'm mostly learning by doing.

I have two text fields where I need to have a character count, one for characters used and another for characters remaining. Even though I'm working from the original file where this worked, in my new version I keep getting errors, even though I haven't changed anything.

The first field is called shorttitle which has a 40 character max, and the count shows the characters left. The next one is abstract, and that needs to be an expandable text box and the character count shows the characters used. Neither of those work.

 

I'm not sure what the JavaScript should be or where I put it... in the Script Editor, I presume. I've tried all kinds of things, from using the original code to using code examples found by googling, but I'm having no luck. Any help would be greatly appreciated; I've been working with this darn thing on and off for almost a year.

 

For the shorttitle I show the following in the Script Editor:

 

 form1.titlesponsorsf.titlesponsordatasf.projecttitles.shorttitle::change - (JavaScript, client)
charactermaxsf.shorttitle = 40 - Len(xfa.event.newText)

 

The field hierarchy is:
projecttitle (text field)
shorttitle (text field)
charactermax (text)
shorttitlecharleft (numeric field-value Calculated-Read Only; Calculation Script)

 

_______________________

 

The other field is an expanding text box called abstracttext This has a 200 character minimum.

The field hierarchy for this is:

abstracttextsf (subform)
abstracttext (text field with multiple lines and page breaks allowed, plus Expand to fit on Height checked)
abstractcharacterminsf (subform)
abstractcharactermin (text)
abstracttext (numeric field-value Calculated-Read Only; Calculation Script)

 

The code for the abstracttext field is:

 

 form1.abstractsf.abstracttextsf.abstracttext::change - (JavaScript, client)
abstractcharacterminsf.abstracttext = 0 + Len(xfa.event.newText)

 

 

Please, is there anyone who can help?

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

45

Likes

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

Javascript question for character counts and expanding text box

Community Beginner ,
Oct 12, 2020

Copy link to clipboard

Copied

I posted the following question in the Adobe LiveCycle forum, but it appears to be hidden or something. The link to the post goes to a 404 error if the person is not signed in to the board, apparently. So I'm reposting it here, and apologies, I know this isn't a LiveCycle forum, but I'm getting a bit desperate for help.

_____________________________

 

I have an old form that was created by someone else in 2015 in LiveCycle. I am working on it in Designer but have very little experience with it; I'm mostly learning by doing.

I have two text fields where I need to have a character count, one for characters used and another for characters remaining. Even though I'm working from the original file where this worked, in my new version I keep getting errors, even though I haven't changed anything.

The first field is called shorttitle which has a 40 character max, and the count shows the characters left. The next one is abstract, and that needs to be an expandable text box and the character count shows the characters used. Neither of those work.

 

I'm not sure what the JavaScript should be or where I put it... in the Script Editor, I presume. I've tried all kinds of things, from using the original code to using code examples found by googling, but I'm having no luck. Any help would be greatly appreciated; I've been working with this darn thing on and off for almost a year.

 

For the shorttitle I show the following in the Script Editor:

 

 form1.titlesponsorsf.titlesponsordatasf.projecttitles.shorttitle::change - (JavaScript, client)
charactermaxsf.shorttitle = 40 - Len(xfa.event.newText)

 

The field hierarchy is:
projecttitle (text field)
shorttitle (text field)
charactermax (text)
shorttitlecharleft (numeric field-value Calculated-Read Only; Calculation Script)

 

_______________________

 

The other field is an expanding text box called abstracttext This has a 200 character minimum.

The field hierarchy for this is:

abstracttextsf (subform)
abstracttext (text field with multiple lines and page breaks allowed, plus Expand to fit on Height checked)
abstractcharacterminsf (subform)
abstractcharactermin (text)
abstracttext (numeric field-value Calculated-Read Only; Calculation Script)

 

The code for the abstracttext field is:

 

 form1.abstractsf.abstracttextsf.abstracttext::change - (JavaScript, client)
abstractcharacterminsf.abstracttext = 0 + Len(xfa.event.newText)

 

 

Please, is there anyone who can help?

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

46

Likes

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
Oct 12, 2020 0
Most Valuable Participant ,
Oct 12, 2020

Copy link to clipboard

Copied

Is your form an LCD one or not, then?

Likes

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
Reply
Loading...
Oct 12, 2020 0
Community Beginner ,
Oct 14, 2020

Copy link to clipboard

Copied

I was given a completed pdf form that was originally created in LiveCycle.

I was able to download a old trial version of LiveCycle ES4.

The trial ran out before I was able to complete the edits on the form.

I was able to intall a trial of AEM_forms designer ver. 6.4 and am trying to finish the form in that before that trial runs out.

Sorry if this is a mess, it's kind of a mess.

Likes

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
Reply
Loading...
Oct 14, 2020 0
try67 LATEST
Most Valuable Participant ,
Oct 14, 2020

Copy link to clipboard

Copied

Likes

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
Reply
Loading...
Oct 14, 2020 0