- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 06:25 AM
HI Community,
I have created "Provide code" as single line text and adding some input in it and now want to calculated length of "Provide code" variable's input.
I am doing it in widget.
Could you please help me to get length through widget scripting.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 09:36 PM
Hi,
Have you tried using below logic:
var length1 =g_form.getValue('provide_code').length.toString();
or
var length1 =g_form.getValue('provide_code').length;
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 09:52 AM
Give your input type a model value, and access it in your client function.
HTML:
<input type="text" class="form-control" ng-model="provideCode" ng-change="c.getCount()"/>
Client Controller:
api.controller=function($scope) {
/* widget controller */
var c = this;
c.getCount = function()
{
alert($scope.provideCode.length);
};
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 09:36 PM
Hi,
Have you tried using below logic:
var length1 =g_form.getValue('provide_code').length.toString();
or
var length1 =g_form.getValue('provide_code').length;
Thanks,
Anil Lande
Thanks
Anil Lande