emaender
02-17-2004, 07:26 AM
Hello!
We are working on an application that will interface with a back end data system. The database for this system has limits on the writable fields we will access, therefore it is necessary for us to somehow limit the length of user input in the input text field.
I tried the following code just to see if I could dynamically access the length of the inputtext at runtime:
<canvas>
<class name="mytext" width="150" height="20" bgcolor="gray">
<attribute name="text" type="text"/>
<inputtext resizable="false" text="${parent.text}" bgcolor="white"
x="1" y="1"
width="$once{parent.width-2}" height="$once{parent.height-2}">
<method event="ontext">
debug.write("Text width: " + this.getTextWidth() );
</method>
</inputtext>
</class>
<mytext>This text is editable.</mytext>
</canvas>
However, in the debug window I am getting "Text width: 1" everytime I type in the inputtext field, so I know that the "this.getTextWidth" is not working for me.
Can you help me with this? Any alternate approach would be fine as well. Thanks in advance for your help here!
We are working on an application that will interface with a back end data system. The database for this system has limits on the writable fields we will access, therefore it is necessary for us to somehow limit the length of user input in the input text field.
I tried the following code just to see if I could dynamically access the length of the inputtext at runtime:
<canvas>
<class name="mytext" width="150" height="20" bgcolor="gray">
<attribute name="text" type="text"/>
<inputtext resizable="false" text="${parent.text}" bgcolor="white"
x="1" y="1"
width="$once{parent.width-2}" height="$once{parent.height-2}">
<method event="ontext">
debug.write("Text width: " + this.getTextWidth() );
</method>
</inputtext>
</class>
<mytext>This text is editable.</mytext>
</canvas>
However, in the debug window I am getting "Text width: 1" everytime I type in the inputtext field, so I know that the "this.getTextWidth" is not working for me.
Can you help me with this? Any alternate approach would be fine as well. Thanks in advance for your help here!