This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

checkbox

 
Anant Rao
Ranch Hand
Posts: 126
  • 0
  • 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: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • 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
  • 0
  • 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: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic