Expand my Community achievements bar.

Display Character count

Avatar

Former Community Member

Hi,

I am using Livecycle 8 to create a form that will calculate a cost based on the number of characters the user want engraved on a item.

I have a text field called "Engraved_Name".

I have a numeric field called "char_count" (which is set to Calculate - read only). I will use the number in this field to calculate the cost.

What is the script to count the number of characters in the "Engraved_name" field and display it the "char_count" field ?

I found other examples and have tried this and its not working:

----- topmostSubform.Page1.Sect.char_count::calculate: - (JavaScript, client) ---

this.getField(Engraved_Name).valueAsString.count

I know I am missing something as the Report warnings is telling me  "Error: field does not have a method 'getField'"...

Any help is appreciated.

  

2 Replies

Avatar

Former Community Member

I woudl put the command in the exit event of the engraved name field. The command woudl be :

Count Field name.rawValue = this.rawValue.length

Paul

Avatar

Former Community Member

Thank you, that works.

So my final script is:

----- topmostSubform.Page1.Sect.EngravedName::exit: - (JavaScript, client) -------------------------

char_count.rawValue= this.rawValue.length