You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Kamal Bhatt <kb...@tt.com.au> on 2008/05/27 10:41:00 UTC

Determining invisible state in JXTemplates

Hi,
I would like to determine if a particular field is invisible in 
JXTemplates, unfortunately, if I do 
${form.getChild('validity_work').getState() == WidgetState.INVISIBLE}, 
it doesn't work.

I have to setup an invisible field and compare the state against that 
field. Is there a way I can achieve this test without adding a pointless 
field or comparing an arbitary field?

Cheers.

-- 
Kamal Bhatt


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Determining invisible state in JXTemplates

Posted by Kamal Bhatt <kb...@tt.com.au>.
Grzegorz Kossakowski wrote:
> Kamal Bhatt pisze:
>> Robin Wyles wrote:
>>> Hi,
>>>
>>> Maybe try:
>>>
>>> ${form.getChild('validity_work').getState().equals(WidgetState.INVISIBLE)} 
>>>
>> Nope, sorry.
>>
>> I have tried to do this:
>>
>>    <jx:set var="invisible" 
>> value="#{org.apache.cocoon.forms.formmodel.WidgetState.stateForName('invisible')}"/> 
>>
>>    <jx:out value="${invisible}"/>
>>    !!<jx:out value="${form.getChild('invisibleField').getState()}"/>!!
>>    ??<jx:out value="${form.getChild('validity_work').getState()}"/>??
>>
>> What I get is this:
>>
>> WidgetState[invisible=1] !!!! ????
>>
>> Now, validity_work is the field I want to test, invisibleField is the 
>> field that I am using to test invibility. Neither prints a value, 
>> yet, I can test both. This is starting to look like a bug.
>
> That's interesting. Have you tried whether
>
>   <jx:out value="${form.getChild('invisibleField')}"/>
>
> Returns something?
Yes it does. "Field 'promotion.invisibleField'"

Now, something I could have made clearer is that this:

${form.getChild('validity_work').getState() != 
form.getChild('invisibleField').getState()}

works perfectly, and I am using Cocoon 2.1.11. I will investigate 
further, but as I have a work around (even if it is a pretty ugly one), 
I will not be making it a top priority.

Thanks for all the help thus far.
>
> If it does, I guess only debugging may help. You can find some tips here:
> http://cocoon.apache.org/1301_1_1.html
> http://article.gmane.org/gmane.text.xml.cocoon.devel/77857
>


-- 
Kamal Bhatt


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Determining invisible state in JXTemplates

Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
Kamal Bhatt pisze:
> Robin Wyles wrote:
>> Hi,
>>
>> Maybe try:
>>
>> ${form.getChild('validity_work').getState().equals(WidgetState.INVISIBLE)} 
>>
> Nope, sorry.
> 
> I have tried to do this:
> 
>    <jx:set var="invisible" 
> value="#{org.apache.cocoon.forms.formmodel.WidgetState.stateForName('invisible')}"/> 
> 
>    <jx:out value="${invisible}"/>
>    !!<jx:out value="${form.getChild('invisibleField').getState()}"/>!!
>    ??<jx:out value="${form.getChild('validity_work').getState()}"/>??
> 
> What I get is this:
> 
> WidgetState[invisible=1] !!!! ????
> 
> Now, validity_work is the field I want to test, invisibleField is the 
> field that I am using to test invibility. Neither prints a value, yet, I 
> can test both. This is starting to look like a bug.

That's interesting. Have you tried whether

   <jx:out value="${form.getChild('invisibleField')}"/>

Returns something?

If it does, I guess only debugging may help. You can find some tips here:
http://cocoon.apache.org/1301_1_1.html
http://article.gmane.org/gmane.text.xml.cocoon.devel/77857

-- 
Grzegorz Kossakowski (catching the train...)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Determining invisible state in JXTemplates

Posted by Kamal Bhatt <kb...@tt.com.au>.
Robin Wyles wrote:
> Hi,
>
> Maybe try:
>
> ${form.getChild('validity_work').getState().equals(WidgetState.INVISIBLE)} 
>
Nope, sorry.

I have tried to do this:

    <jx:set var="invisible" 
value="#{org.apache.cocoon.forms.formmodel.WidgetState.stateForName('invisible')}"/>
    <jx:out value="${invisible}"/>
    !!<jx:out value="${form.getChild('invisibleField').getState()}"/>!!
    ??<jx:out value="${form.getChild('validity_work').getState()}"/>??

What I get is this:

WidgetState[invisible=1] !!!! ????

Now, validity_work is the field I want to test, invisibleField is the 
field that I am using to test invibility. Neither prints a value, yet, I 
can test both. This is starting to look like a bug.
>
> Also, if you don't have it already you will need to have:
>
> importClass(org.apache.cocoon.forms.formmodel.WidgetState)
Already done.
>
> at the top of the flowscript that calls your JXTemplate.
>
> Robin
>
> On 27 May 2008, at 09:41, Kamal Bhatt wrote:
>
>> Hi,
>> I would like to determine if a particular field is invisible in 
>> JXTemplates, unfortunately, if I do 
>> ${form.getChild('validity_work').getState() == 
>> WidgetState.INVISIBLE}, it doesn't work.
>>
>> I have to setup an invisible field and compare the state against that 
>> field. Is there a way I can achieve this test without adding a 
>> pointless field or comparing an arbitary field?
>>
>> Cheers.
>>
>> -- 
>> Kamal Bhatt
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>


-- 
Kamal Bhatt


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Determining invisible state in JXTemplates

Posted by Robin Wyles <ro...@robinwyles.com>.
Hi,

Maybe try:

${form.getChild('validity_work').getState().equals 
(WidgetState.INVISIBLE)}

Also, if you don't have it already you will need to have:

importClass(org.apache.cocoon.forms.formmodel.WidgetState)

at the top of the flowscript that calls your JXTemplate.

Robin

On 27 May 2008, at 09:41, Kamal Bhatt wrote:

> Hi,
> I would like to determine if a particular field is invisible in  
> JXTemplates, unfortunately, if I do ${form.getChild 
> ('validity_work').getState() == WidgetState.INVISIBLE}, it doesn't  
> work.
>
> I have to setup an invisible field and compare the state against  
> that field. Is there a way I can achieve this test without adding a  
> pointless field or comparing an arbitary field?
>
> Cheers.
>
> -- 
> Kamal Bhatt
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>