Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Javascript question for character counts and expanding text box

Avatar

Avatar
Validate 1
Level 1
fogharty
Level 1

Likes

0 likes

Total Posts

17 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
fogharty
Level 1

Likes

0 likes

Total Posts

17 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
fogharty
Level 1

16-10-2020

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

 

The file has been worked on in LiveCycle ES4 and AEM_forms designer ver. 6.4

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?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Kosta_Prokopiu1
Employee

17-10-2020

your main problem here is that you placed FormCalc in a JavaScript script and the fieldnames used are also not 100% logical 🙂

Here is a sample I made from your description - check if that is what you want to do. You can open the PDF in the Designer.

https://documentcloud.adobe.com/link/review?uri=urn:aaid:scds:US:005dc7d9-2c91-44b4-9ea7-50bb82d9772...

Answers (0)