[Axualize-users] Re: Strange behavior in boolean logic?
Brought to you by:
russwyte
|
From: Russell W. <rus...@ya...> - 2003-03-21 13:03:32
|
Hi Frank,
Ahhh, once again your logic makes sense, the syntax is just not cutrrently
supported.
Here is the offending piece:
<boolean id="ans">
<object idref="validator" method="validateForm">
<object idref="fields"/>
</object>
</boolean>
The primitive (<boolean><int><short><byte><char><long><float><double><string>)
tags can only be used two ways:
1) With the value of the primitive expressed as the text of the element like
this:
<boolean id="ans">true</boolean>
2) With the value of the primitive expressed as the value of the "val"
attribute like this:
<boolean id="ans" val="true"/>
In any case this does not limit you from doing what you want to do. The
Symantics are just slightly differemt:
<void idref="validator" method="validateForm" id="ans">
<object idref="fields"/>
</void>
Now the boolean result of the method call is correctly stored in the model as
"ans".
Thanks for pointing out another thing to clarify in the docs.
Also, I may see about implementing a third form for primitives which would take
the primitive wrapper as an argument now that I see that it may be more
intuitive for some people.
My worry is that "wrapper constructor" form requires a primitive object which
already exists. If it already exists we are not really creating a primitive,
but simply wanted to get at it to store it. In which case I don't see it as
truly useful, it is simply longer syntax, and more work for Axualize. Still, I
am open minded about it. The only real use I could see would be in creating
"copies" of primitive wrapper objects, but that can already be done more
easily.
WR
Russ
--- Frank Burough <fwb...@ch...> wrote:
> Hi--
>
> When I just <echo> the result to a method call, I see the expected output.
> But
> when I attempt to assign the result of the method call to a boolean for
> comparison ton contro logic, the method is not getting called, and the
> boolean is set to 'false' (which may be the default?)
>
> I assume I am doing something wrong here, any help would be greatly
> appreciated.
>
>
> Here is a piece of my XML file:
>
> <echo>
> <object idref="validator" method="validateForm">
> <object idref="fields"/>
> </object>
> </echo>
> <boolean id="ans">
> <object idref="validator" method="validateForm">
> <object idref="fields"/>
> </object>
> </boolean>
> <if expr="ans == true">
> <echo>
> <string>Validation Succeeded...</string>
> </echo>
> <else>
> <echo>
> <string>Validation Failed...</string>
> </echo>
> </else>
> </if>
>
> That is, I call a method 'validateForm' with an ArrayList of data to
> validate.
>
> Here is what I see:
>
> validateForm:We have 1 fields to validate
> validateForm:Inside validateForm...
> validateForm:String value: 'Title'
> validateForm:Required: 'true'
> validateForm:Integer type value is '0'
> validateForm:The form return status is 'true'
> true <-- this line is echoed from my XML file
> Validation Failed... <-- echoed from my XML file as well
>
> And here is how I interpret what I see:
> Thus, the validateForm method is called, and all my hastily-added debugging
> prints out, then the resulting boolean is printed as 'true' as it should be.
> However, in the lines that follow, where the result of the method call is to
> be assigned to a boolean no debug lines from validateForm are printed,
> indicating that it was not called.
>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
|