You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Raghu Kanchustambham <kr...@gmail.com> on 2005/09/28 21:33:45 UTC
logic tag - to check form elements
I have a hidden html varibale called operation.
<html text="hidden" name="operation" />
Now I want to conditionally display some buttons based on the value of
this hidden field. I am trying something like this...
<logic:equal name="${operation}" value="update">
# display update related buttons
</logic>
This doesnt seem to work. What am I doing wrong? I know that if
'operation' was a variable is request/session then it would work fine. But
what should I do if operation is a html form element (hidden). I do not want
to write scriptlets.
Thanks.
Best Regards,
Raghu
Re: logic tag - to check form elements
Posted by Michael Jouravlev <jm...@gmail.com>.
On 9/28/05, Raghu Kanchustambham <kr...@gmail.com> wrote:
> I have a hidden html varibale called operation.
> <html text="hidden" name="operation" />
This defines a field in an HTML form, server knows nothing about it.
> Now I want to conditionally display some buttons based on the value of
> this hidden field. I am trying something like this...
> <logic:equal name="${operation}" value="update">
> # display update related buttons
> </logic>
This is evaluated on server before HTML page generated, browser knows
nothing about it.
> This doesnt seem to work.
JSTL hides the error, it does not blow up when it cannot find an object.
> What am I doing wrong? I know that if
> 'operation' was a variable is request/session then it would work fine. But
> what should I do if operation is a html form element (hidden). I do not want
> to write scriptlets.
If you want to update HTML page without submitting it to the server,
then use some Javascript. If you submit form each time an operation is
changed, add an "operation" field to your form bean and use
<logic:equal name="${myFormBean.operation}" value="update">
when you re-render the HTML page.
Michael.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: logic tag - to check form elements
Posted by Murray Collingwood <mu...@focus-computing.com.au>.
Hi Raghu
What's the name of the form bean? Let's assume it's "myformbean" for the example:
<html:hidden name="operation"/>
<logic:equal name="myformbean" property="operation" value="update">
...
</logic:equal>
Use the 'name' parameter to reference the form bean name. Use the 'property'
parameter to reference the property. Note, you will be testing the value in the form-
bean, not the value in the hidden html field.
Do you need to change the value of the hidden field? If so you will need to use
Javascript to perform this test and modify the displayed values.
Kind regards
mc
On 29 Sep 2005 at 1:03, Raghu Kanchustambham wrote:
> I have a hidden html varibale called operation.
> <html text="hidden" name="operation" />
> Now I want to conditionally display some buttons based on the value of
> this hidden field. I am trying something like this...
> <logic:equal name="${operation}" value="update">
> # display update related buttons
> </logic>
> This doesnt seem to work. What am I doing wrong? I know that if
> 'operation' was a variable is request/session then it would work fine. But
> what should I do if operation is a html form element (hidden). I do not want
> to write scriptlets.
> Thanks.
> Best Regards,
> Raghu
>
FOCUS Computing
Mob: 0415 24 26 24
murray@focus-computing.com.au
http://www.focus-computing.com.au
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.8/113 - Release Date: 27/09/2005
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org