[Laszlo-user] boolean attribute question/problem
Benjamin Shine
ben at laszlosystems.com
Wed Dec 19 15:47:45 PST 2007
The "password" attribute must be specified when the edittext is being
constructed; it can't be changed at runtime. The way you have it set
up, it seems to be determining after construction that
parent.parent.ispassword evalutes to true. At that point, it's too late.
Look at this:
<edittext width="200" height="24" text="bbbb" password="true" />
<edittext width="200" height="24" text="bbbb" password="${true}" />
The first one ends up with ***, and the second one ends up saying
bbbb, even though
${true} evaluates to true. The trouble is *when* it evaluates to true
-- too late!
This is sort of revealed in the documentation -- on
http://labs.openlaszlo.org/trunk-nightly/docs/reference/lz.edittext.html
notice that the password attribute is listed as "initialize-only".
I think this means you need two classes, form_text and form_password.
-ben
On Dec 19, 2007, at 3:28 PM, Dave Miller wrote:
> In the following code, why doesn't the password field show *'d out
> letters?
>
> If you run it, you can see that ispassword is "true" for the
> correct field. Is it a data type problem? Is the string "true" not
> evaluating as true?
>
> Thanks,
>
> Dave
>
>
>
> <canvas>
>
> <class name="form_text">
>
> <attribute name="label" value="not set" type="string"/>
>
> <attribute name="ispassword" value="false" type="boolean"/>
>
> <hbox spacing="2">
>
> <view width="120" valign="middle">
> <text align="right" text="${parent.parent.parent.label}"/>
> </view>
>
> <edittext width="200" height="24"
> password="${parent.parent.ispassword}"/>
>
> <text text="${parent.parent.ispassword}"/>
>
> </hbox>
>
> </class>
>
> <simplelayout/>
>
> <form_text label="Username"/>
>
> <form_text label="Password" ispassword="true"/>
>
> <button x="120" text="Submit"/>
>
> </canvas>
>
>
>
More information about the Laszlo-user
mailing list