Skip to content

Counting The Number of Characters in Text Entry Field in Articulate Storyline

Rapid authoring tools are challenging and extending their limits on a regular basis.

Among them, Articulate Storyline strives to satisfy most of the client requirements with the help of JavaScript.

Recently our client wanted learners to know how many characters they had entered in the provided text entry field. We meet this requirement with the help of JavaScript.

Follow the steps given below and you too will be able to do it.

Step 1:

Insert a text entry field.

Step 1

When we insert a text entry field, default variable named TextEntry” will be created.

TextEntry

Step 2:

Create a numeric variable CharLength” with 0 as the default value.

Step 2

Step 3:

Insert a button “Submit”.

Step 3

Step 4:

It’s time to execute the JavaScript.

Add the following trigger :

Execute JavaScript when user clicks the “Submit” button.

Step 4

Step 5:

Write the following code in the JavaScript window:

var player = GetPlayer();

var count= player.GetVar(“TextEntry”);

var numChars= count.length;

player.SetVar(“CharLength”,numChars); 

Step 5

Step 6:

We now need to display the number of characters on the screen. So place the numeric variable CharLength” between two “%” symbols.

Step 6

Step 7:

Now publish your file and check the output.

File output before entering any text:

Step 7

File output after entering some text:

Step 7

Use this simple 7 step process and help learners count the number of characters they’ve entered in a text field.

Have anything to say? Please do share!

Authoring Tool Finder - Find the Best Suited Authoring Tool for Your Needs