You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by vivek mannur <vi...@persistent.co.in> on 2006/12/18 06:03:03 UTC

[s2] CheckBox issues

Hi,

 

 

I've just started working on struts 2. 

 

I have a table with check boxes in a matrix kind of a view. Here depending
on the database values some checkboxes are initially checked and the
remaining are unchecked.

When I check an unchecked box then I get a 'failed to load remote content
error'. Here is the code:

 

<td align=center>

<s:if test="${value} == 1">

                        <s:checkbox id="permissions" name="permissions"
value="true" fieldValue="${moduleName}.${key}" theme="simple"/>

            </s:if>

            <s:if test="${value} == 0">


                        <s:checkbox id="permissions" name="permissions"
value="false" fieldValue='${moduleName}.${key}' theme="simple"/>

            </s:if>

</td>

 

Here the fieldValue is used later to keep track of all the checked boxes.

 

Any help would be much appreciated.

 

 

Yours truly,

Vivek.


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

RE: [s2] CheckBox issues

Posted by Shardayyy <sh...@gmail.com>.
Why don't you try this....

FORM
=====
Private String permission = "N";    // set the default to N


JSP
===
<html:checkbox property="permission" value="Y"/>


DATABASE
=========
-- You would store a char(1) in the DB



If the check box IS checked and submitted the "Y" values gets submitted to
the backend, if the checkbox is NOT checked and submitted nothing gets
submitted from the front-end and it defaults to "N" as 
<html:checkbox property="permission" value="Y"/>, it it were to be a "Y" the
checkbox would be checked...

I don't think you need any logic to check or uncheck.



On return if a "N" is returned, by the time the checkbox is displayed, it
would not be checked because "N" is not the same as 


-----Original Message-----
From: vivek mannur [mailto:vivek_mannur@persistent.co.in] 
Sent: Monday, December 18, 2006 12:03 AM
To: user@struts.apache.org
Subject: [s2] CheckBox issues

Hi,

 

 

I've just started working on struts 2. 

 

I have a table with check boxes in a matrix kind of a view. Here depending
on the database values some checkboxes are initially checked and the
remaining are unchecked.

When I check an unchecked box then I get a 'failed to load remote content
error'. Here is the code:

 

<td align=center>

<s:if test="${value} == 1">

                        <s:checkbox id="permissions" name="permissions"
value="true" fieldValue="${moduleName}.${key}" theme="simple"/>

            </s:if>

            <s:if test="${value} == 0">


                        <s:checkbox id="permissions" name="permissions"
value="false" fieldValue='${moduleName}.${key}' theme="simple"/>

            </s:if>

</td>

 

Here the fieldValue is used later to keep track of all the checked boxes.

 

Any help would be much appreciated.

 

 

Yours truly,

Vivek.


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the
property of Persistent Systems Pvt. Ltd. It is intended only for the use of
the individual or entity to which it is addressed. If you are not the
intended recipient, you are not authorized to read, retain, copy, print,
distribute or use this message. If you have received this communication in
error, please notify the sender and delete all copies of this message.
Persistent Systems Pvt. Ltd. does not accept any liability for virus
infected mails.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org