Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

checkbox

 
Anant Rao
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below is my code:
<tr>
<td class="widthLabelCol" width="275"><nobr><label>Active:</label></nobr></td>
<logic:equal name="ProjectIssue" property="active" value="Y">
<td width="591"> <html:checkbox property="active" checked="true" ></html:checkbox></td>
</logic:equal>
<logic:equal name="ProjectIssue" property="active" value="N">
<td width="591"> <html:checkbox property="active"></html:checkbox></td>
</logic:equal>

</tr>

when property active="Y" then its should be checked or we can check now when the page is loaded. I unable to check when the active status is "Y'
To get it checked what property should i use.

Regards
Infyniti.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Infyniti,
You can set the value in the form itself in Java. Then Struts will take care of populating the HTML for you.
 
Anant Rao
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for clue...but I think I did not make myself clear...

from form I am getting "y" and as per the logic
1 when the property from from is Y then the checkbox should be checked else unchecked.
2. after displaying the page we can check or uncheck the checkbox so that the active property at the form get populated when we submit the page.

But I am unable display checkbox chekced when the active property is "Y" and if it give checked=true it is throwing an error that it does not support the attribute.

can u please suggest me anyother option.

Infyniti.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Infyniti,
As you've noticed there is no checkbox attribute.

Instead you set the value attribute to "Y" or "N" for each checkbox. (Sorry, I didn't notice that was missing yesterday.) Then Struts matches it against the value in the form and checks the correct box.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic