Thread Closed 
Author [CLOSED]TextField widget(Capitalize) Question
crepers12
Member

Find all posts by this user
Default  21 October 2013 01:10
Hello,

I'm implementing a page to use text field widgets.
When the focus lost from it I want to display capitalize characters.
Do you know how can I implement it?
Here are my code.

{@aria:TextField {
    id : "TB_counterNo"+i,
    width : widthColumn,
    bind:{
        value: {
            inside: data.officeIDArray, to: i.toString(),
             transform : function (value) {
                data.officeIDArray[i] = value.toUpperCase();
                return data.officeIDArray[i];
            }            
        }
    }
}/}

Regards
(This post was last modified: 28 November 2013 07:10 by susanta.behera.)
benoit.charbonnier
AT core team member

Find all posts by this user
Default  21 October 2013 08:48
Hello,

did you have a look a this usermanual page: http://ariatemplates.com/usermanual/late...transforms

From what i can see in your example, you don't need to put yourself back the value in the correct place. The widget will do it for you.

So in your tranform function, just and simply

return value.toUppersCase();
(This post was last modified: 21 October 2013 08:49 by benoit.charbonnier.)
Olaf
Administrator

Find all posts by this user
Default  21 October 2013 09:19
Hey there, welcome to the forum.

transform will actually do the following:
- modify the data model when the TextField value has changed, or
- modify the TextField value when the data model has changed.

What you want here is slightly different since you want both to be changed when the TextField value has been modified.

To achieve this, you actually don't need to use transform and should use onchange instead like this:
{@aria:TextField {
    bind:{
        value: {
            inside: data, to: "test"
        }
    },
    onchange: function() {
        this.$json.setValue(data, "test", data.test.toUpperCase());
    }
}/}
crepers12
Member

Find all posts by this user
Default  22 October 2013 09:27
Thank you!!! It's good
Hava a great day~!
Olaf
Administrator

Find all posts by this user
Default  22 October 2013 09:40
you're welcome Smile
Thread Closed