Count textbox characters.

Count textbox characters.

  
hi everyone. i  wnated to count the number of characters beside the textbox. can anybady help me how to do it.


Regards,
sattibabu vatti.
sattibabu vatti wrote:
hi everyone. i  wnated to count the number of characters beside the textbox. can anybady help me how to do it.


Regards,
sattibabu vatti.
 
 Hi,

You can use the Length() function with the variable associated with the textbox.

Cheers,
Hermínio Mira
hi
can u explain with example.


Regards,
sattibabu vatti.
I've actually created a widget that does that but using an Ajax refresh it's terribly slow.
It's best to create your own widget in combination with a simple Javascript that does the job.
Below my solotion; it might help you out:



The key function actually is the onkeypress event which calls a refresh function of the "Nog 1000 karakters over" (Dutch for : "1000 characters left)
Combined with the expression calculation of the resulting count this gives you the 'counter'
 
This worked terrible because of the refresh in a popup that made the whole screen blink.
Outsystems fixed that in a later 6.0.x.x version.

Hope it helps!

Cheers,

Eric
hi,

can u expalin calcualteCharacterLeft Screen Action?

Regards,
sattinbabu vatti.
That's actually nothing but a 'Ajax refresh' of the ShowCharLeft expression.
hi,

 can u tell me what is the initial value datatype?

Regards,
sattibabu vatti.

It's a text type; the "initial" content of your Input textbox.
Check out this neat little (jQuery) solution
http://stackoverflow.com/questions/5371089/jquery-count-characters-in-textarea


<script>
        function countChar(val){
                                var len = val.value.length;
                                if (len >= 500) {
                                    val.value = val.value.substring(0, 500);
                                }else {
                                    osjs('#charNum').text(500 - len);
                                }
        };
    </script>
 
<textarea id="field" onkeyup="countChar(this)"></textarea>
<div id="charNum"></div>
hi,


 i created screen action. but iam not able to get those screen action in to the input  prpperties  value1 in extended prpperties .can u tell me how to get it.


regards,
sattibabu vatti.
Ok, check this link to download the widget.

You'll need to have at least Service Studio 6.0.0.9 to open the OML.
@sattibabu did that help you?
hi,

yes. it is helping me. i  added  that in create a new form. i did it. but after enter tha data i  want to save it. how to save it.


Regards,
sattibabu vatti.
In the Save (Opslaan) screenaction the widget has a NotifyWidget action.
This passes the data you've entered in the input field to the calling Webscreen.

In the calling Webscreen you should point the On Notify Destination to a (new) screen action.


In this screen action you can retrieve the data that is passed by the widget using the NotifyWidgetGetMessage() Function / Action.


This method is a generic way for widgets to pass data to the calling Webscreen or to notify the calling Webscreen.
HINT: Try some existing Outsystems apps; to learn on the interaction with widgets.
sattibabu vatti wrote:
hi everyone. i  wnated to count the number of characters beside the textbox. can anybady help me how to do it.


Regards,
sattibabu vatti.
 
 Hello,

If you feel confortable and interesed on jQuery, i would recomend you the following jQuery sample code that you need to adapt to your textarea:
http://learnagile.blogspot.pt/2012/05/jquery-textarea-character-count.html

If you need a webblock with the code i can provide it later.