Character count with JavaScript

Hi all!


I need count the quantity of characters left in Input Text using a JavaScript code. In this case I won't any component like Character Count. Just via JavaScript.

How to count characters left of input text using event onkeyup or another event?


Thanks!!!

Best regards!


Frampton

Hi Frampton,


For the mentioned use-case, you can use the CharacterCount Widget available in OutSystemsUIWeb Module

Set the IsDescending property to True value

Hope this helps you!


Regards,

Benjith Sam

Benjith Sam wrote:

Hi Frampton,


For the mentioned use-case, you can use the CharacterCount Widget available in OutSystemsUIWeb Module

Set the IsDescending property to True value

Hope this helps you!


Regards,

Benjith Sam

 

 Hi, Benjith Sam!


I need that solution don't use any components. Needs to be via code! I need too get the length of Input Text via code...


Thank you!




Mahesh Manchala wrote:

Hi,

Try using the below solution:

http://www.mattmorgante.com/technology/textarea-remaining-characters-javascript

 Hi, Mahesh!


I see that script don't read or get the length (max limit) of Input Text.  I need too get the length of Input Text via code... 

How to implement this in Service Studio?


Thanks!



Hi Frampton,

I have created a sample reactive application and used the below mentioned JS code. 

see this sample app 

JS Code

var inputMaxlengthValue = document.getElementById($parameters.InputElementId).getAttribute('maxlength');
var inputTextLength = document.getElementById($parameters.InputElementId).value.length;


$parameters.RemainingCharacterCount = inputMaxlengthValue - inputTextLength;

Hope this helps you!


Regards,

Benjith Sam

Benjith Sam wrote:

Hi Frampton,

I have created a sample reactive application and used the below mentioned JS code. 

see this sample app 

JS Code

var inputMaxlengthValue = document.getElementById($parameters.InputElementId).getAttribute('maxlength');
var inputTextLength = document.getElementById($parameters.InputElementId).value.length;


$parameters.RemainingCharacterCount = inputMaxlengthValue - inputTextLength;

Hope this helps you!


Regards,

Benjith Sam

 Hi, Benjith!


Let me show to you an error occurried with app...


 

Frampton Fossi wrote:

Benjith Sam wrote:

Hi Frampton,

I have created a sample reactive application and used the below mentioned JS code. 

see this sample app 

JS Code

var inputMaxlengthValue = document.getElementById($parameters.InputElementId).getAttribute('maxlength');
var inputTextLength = document.getElementById($parameters.InputElementId).value.length;


$parameters.RemainingCharacterCount = inputMaxlengthValue - inputTextLength;

Hope this helps you!


Regards,

Benjith Sam

 Hi, Benjith!


Let me show to you an error occurried with app...


 

 Now, see my OML...

 

Frampton Fossi wrote:

Benjith Sam wrote:

Hi Frampton,


For the mentioned use-case, you can use the CharacterCount Widget available in OutSystemsUIWeb Module

Set the IsDescending property to True value

Hope this helps you!


Regards,

Benjith Sam

 

 Hi, Benjith Sam!


I need that solution don't use any components. Needs to be via code! I need too get the length of Input Text via code...


Thank you!




 Why? The component is also just code. With the benefit of it already been tested.

 

Solution

Frampton Fossi wrote:

 Now, see my OML...

Hi Frampton,

I did some code changes in the shared .oml file... Please find the attached .oml solution file


Hope this helps you!


Regards,

Benjith Sam

Solution

Daniël Kuhlmann wrote:

Frampton Fossi wrote:

Benjith Sam wrote:

Hi Frampton,


For the mentioned use-case, you can use the CharacterCount Widget available in OutSystemsUIWeb Module

Set the IsDescending property to True value

Hope this helps you!


Regards,

Benjith Sam

 

 Hi, Benjith Sam!


I need that solution don't use any components. Needs to be via code! I need too get the length of Input Text via code...


Thank you!




 Why? The component is also just code. With the benefit of it already been tested.

 

 Hi, Daniel!


I'm a novice OutSystems MasterClass of Rafael Pereira, and I want understand how works the additional codes at Service Studio. We are challenged by others friend to solve this problem without components... Just this!

 

:-)


Regards,

Benjith Sam wrote:

Frampton Fossi wrote:

 Now, see my OML...

Hi Frampton,

I did some code changes in the shared .oml file... Please find the attached .oml solution file


Hope this helps you!


Regards,

Benjith Sam

 Thank you so much, Benjith! It's works now !

Best regards, friend!

 

Frampton Fossi wrote:

Thank you so much, Benjith! It's works now !

Best regards, friend!

You are most welcome, Frampton :)

Glad I could be of help :)


Regards,

Benjith Sam