You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Clark Kent <kr...@yahoo.com> on 2003/12/04 22:58:12 UTC

checkbox condition check

I have a situation where I have a table with rows of information.
 
----------------------------------------
checkbox1 - unique for row1
checkbox2 - unique for row2
checkbox3 - unique for row3
----------------------------------------
I do know that there are exactly 3 rows of information at all times for this table.  Now I am trying to get these checkboxes to work based on each unique row.  
 
What kind of struts tag do I use to perform the checkbox to have a check against it or not based on whether that particular checkbox info appears in the row because each checkbox has its respective getter which returns boolean.
 
<some tag to check for condition>
  <html:checkbox property="a1">
<end tag>


---------------------------------
Do you Yahoo!?
Free Pop-Up Blocker - Get it now

Re: checkbox condition check

Posted by Hien Q Nguyen <hi...@comcast.net>.
Ops the <c:if>'s tests should be

<c:if test="${myval == 'val1'}">checked</c:if>
<c:if test="${myval == 'val2'}">checked</c:if>
<c:if test="${myval == 'val3'}">checked</c:if>

or Check Box 1,2,and 3 respectively.

-H

On Dec 4, 2003, at 7:28 PM, Hien Q Nguyen wrote:

> Are you saying that you have  a fixed set of options and depends on 
> what value is from your bean, the option that has the same value will 
> be checked?
>
> Maybe something like this?
>
> <form>
>     <input name="checkbox" type="checkbox" value="val1"
> 	<c:if test="${myval == 'val1'}">checked</c:if>
>     > Check Box 1
>     </input>
>     <input type="checkbox" name="checkbox2" value="val2"
> 	<c:if test="${myval == 'val1'}">checked</c:if>
>     > Check Box 2
>     </input>
>     <input type="checkbox" name="checkbox3" value="val3"
> 	<c:if test="${myval == 'val1'}">checked</c:if>
>     >Check Box 3
>     </input>
> </form>
>
> Where myval is your the column's value you want to test for?
>
>
> -H
>
> On Dec 4, 2003, at 4:58 PM, Clark Kent wrote:
>
>> I have a situation where I have a table with rows of information.
>>
>> ----------------------------------------
>> checkbox1 - unique for row1
>> checkbox2 - unique for row2
>> checkbox3 - unique for row3
>> ----------------------------------------
>> I do know that there are exactly 3 rows of information at all times 
>> for this table.  Now I am trying to get these checkboxes to work 
>> based on each unique row.
>>
>> What kind of struts tag do I use to perform the checkbox to have a 
>> check against it or not based on whether that particular checkbox 
>> info appears in the row because each checkbox has its respective 
>> getter which returns boolean.
>>
>> <some tag to check for condition>
>>   <html:checkbox property="a1">
>> <end tag>
>>
>>
>> ---------------------------------
>> Do you Yahoo!?
>> Free Pop-Up Blocker - Get it now
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: checkbox condition check

Posted by Hien Q Nguyen <hi...@comcast.net>.
Are you saying that you have  a fixed set of options and depends on 
what value is from your bean, the option that has the same value will 
be checked?

Maybe something like this?

<form>
     <input name="checkbox" type="checkbox" value="val1"
	<c:if test="${myval == 'val1'}">checked</c:if>
     > Check Box 1
     </input>
     <input type="checkbox" name="checkbox2" value="val2"
	<c:if test="${myval == 'val1'}">checked</c:if>
     > Check Box 2
     </input>
     <input type="checkbox" name="checkbox3" value="val3"
	<c:if test="${myval == 'val1'}">checked</c:if>
     >Check Box 3
     </input>
</form>

Where myval is your the column's value you want to test for?


-H

On Dec 4, 2003, at 4:58 PM, Clark Kent wrote:

> I have a situation where I have a table with rows of information.
>
> ----------------------------------------
> checkbox1 - unique for row1
> checkbox2 - unique for row2
> checkbox3 - unique for row3
> ----------------------------------------
> I do know that there are exactly 3 rows of information at all times 
> for this table.  Now I am trying to get these checkboxes to work based 
> on each unique row.
>
> What kind of struts tag do I use to perform the checkbox to have a 
> check against it or not based on whether that particular checkbox info 
> appears in the row because each checkbox has its respective getter 
> which returns boolean.
>
> <some tag to check for condition>
>   <html:checkbox property="a1">
> <end tag>
>
>
> ---------------------------------
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now


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