Re: [Axualize-users] Strange behavior in boolean logic?
Brought to you by:
russwyte
|
From: Russell W. <rus...@ya...> - 2003-03-21 21:09:51
|
Frank,
Here is your problem:
<boolean id="ans">
<object idref="validator" method="validateForm">
<object idref="fields"/>
</object>
</boolean>
The boolean tag has only two forms:
<boolean>true</boolean>
<boolean value="true"/>
Of course you could substitute "true" for "false", but hey I am an optimist. :)
The primitive tags are used to create instances of primitives. Since you
already have an instance you do not need to do this. Your method returns a
boolean so you can just put it in the model like this:
<void idref="validator" method="validateForm" id="ans">
<object idref="fields"/>
</void>
This form would have also worked but is very redundant and I would not
recommend it:
<void class="java.lang.Boolean" id="ans">
<object idref="validator" method="validateForm">
<object idref="fields"/>
</object>
<void/>
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>
> <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.
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Tablet PC.
> Does your code think in ink? You could win a Tablet PC.
> Get a free Tablet PC hat just for playing. What are you waiting for?
> http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
> _______________________________________________
> Axualize-users mailing list
> Axu...@li...
> https://lists.sourceforge.net/lists/listinfo/axualize-users
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
|