Aria Templates Forums
[CLOSED]TextField widget(Capitalize) Question - Printable Version

+- Aria Templates Forums (http://ariatemplates.com/forum)
+-- Forum: Public forums (/forumdisplay.php?fid=3)
+--- Forum: Support (/forumdisplay.php?fid=8)
+--- Thread: [CLOSED]TextField widget(Capitalize) Question (/showthread.php?tid=98)



[CLOSED]TextField widget(Capitalize) Question - crepers12 - 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


RE: TextField widget(Capitalize) Question - benoit.charbonnier - 21 October 2013 08:48

Hello,

did you have a look a this usermanual page: http://ariatemplates.com/usermanual/latest/widget_bindings#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();



RE: TextField widget(Capitalize) Question - Olaf - 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());
    }
}/}



RE: TextField widget(Capitalize) Question - crepers12 - 22 October 2013 09:27

Thank you!!! It's good
Hava a great day~!


RE: TextField widget(Capitalize) Question - Olaf - 22 October 2013 09:40

you're welcome Smile