• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

checkbox

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Everyone is a villain in someone else's story. Especially this devious tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic