Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2007, 05:45 PM
Registered User
 
Join Date: Dec 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to RatanKumar
Default struts-html: checkbox default checked

Hi,

I want to use struts-html:checkbox to insert/update a field in a table.

I am using dynavalidatoractionform in struts-config and beanutils.copyproperties to populate these fields in a formbean

i need this checkbox to be checked by default when the page comes up. on submit, it should send Y if checked / N if unchecked to the actionclass.

i tried this, by using attribute "initial" in dynavalidatoractionform in struts-config . so by default it gets checked. but when i uncheck it, it still goes as checked to the actionclass

do i have to use hidden/reset method to solve this problem ?
Pls help with some code fragments

 
Old November 5th, 2007, 05:49 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Try assigning the value 'Y' to the form bean member as default value, instead of "initial". Like if you've named the variable in form bean as

Code:
char checkBox;
try as
Code:
char checkBox = 'Y';

- Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox checked all mateenmohd Javascript 1 January 2nd, 2007 06:19 AM
checkbox checked by default by html:checkbox sachin.tathod Struts 3 December 4th, 2006 03:41 PM
Checkbox checked? ninel ASP.NET 2.0 Professional 1 April 12th, 2006 10:50 PM
Datalist with checkbox -- how to default checked? jobber99 ASP.NET 1.0 and 1.1 Basics 1 January 30th, 2006 02:52 PM
allow only one checkbox to be checked! morpheus HTML Code Clinic 5 April 15th, 2004 10:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.