107
Views
12
Comments
Solved
Character count with JavaScript
Question

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

2021-03-18 21-03-15
Benjith Sam
 
MVP
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

CharactersLeft.oml
2026-04-01 11-40-30
Mahesh Manchala
2020-07-23 20-51-50
Frampton Fossi

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!



2021-03-18 21-03-15
Benjith Sam
 
MVP

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

2020-07-23 20-51-50
Frampton Fossi

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!




2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

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.

 

2020-07-23 20-51-50
Frampton Fossi

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,

2021-03-18 21-03-15
Benjith Sam
 
MVP

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

2020-07-23 20-51-50
Frampton Fossi

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...


 

CANNOTREAD.png
2020-07-23 20-51-50
Frampton Fossi

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...

 

CharactersLeft.oml
2021-03-18 21-03-15
Benjith Sam
 
MVP
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

CharactersLeft.oml
2020-07-23 20-51-50
Frampton Fossi

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!

 

2021-03-18 21-03-15
Benjith Sam
 
MVP

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

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.