RE: Checkboxes with session-scoped DynaActionForms
If your fields are currently Strings, just put field = new String[0]; in your reset() method. You don't need to change it to a [Bb]oolean. This advice should work for any type. B -Original Message- From: Sgarlata Matt [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 12:48 PM To: Struts Users Mailing List Subject: Checkboxes with session-scoped DynaActionForms Does anyone know a good reference on how to use checkboxes with session-scoped DynaActionForms? The problem I am running into is that when the form bean is session scoped, the checkbox sticks to always being checked even if the user unchecks the checkbox. This makes some sense to me, because I know that if the checkbox is unchecked then a value for the checkbox is not passed along in the request, so the old value is kept. I think with ActionForms this is solved by making the underlying property of the checkbox of type boolean and by setting the value of the checkbox to false in the reset() method of the ActionForm. So, what is the correct setup with DynaActionForms? Should I make my underlying form property of type java.lang.Boolean? Also, It looks like I am going to have to subclass DynaActionForm or DynaValidatorForm so that I can reset the checkboxes in the reset() method of the form bean. That seems like quite a pain (kind of defeats the purpose of Dyna forms, doesn't it?). Is that correct? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkboxes with session-scoped DynaActionForms
From: Sgarlata Matt [mailto:[EMAIL PROTECTED] Also, It looks like I am going to have to subclass DynaActionForm or DynaValidatorForm so that I can reset the checkboxes in the reset() method of the form bean. That seems like quite a pain (kind of defeats the purpose of Dyna forms, doesn't it?). Dyna forms merely free you of the need to write all those get/set methods. Defining the properties in struts-config.xml does not mean you can't or shouldn't override the 'reset' and/or 'validate' methods. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Checkboxes with session-scoped DynaActionForms
Wendy Barrett - Thanks for your help! Both of your answers helped me fix the problem I was having with checkboxes and session-scoped DynaActionForms. Wendy - I feel like the reset method of the DynaActionForm should be able to automatically take care of checkboxes, perhaps with a little extra help like specifying clearOnReset=true or isCheckbox=true in the set-property element for the property, but oh well... I'm not going to push it on the dev list. Matt - Original Message - From: Wendy Smoak [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 3:03 PM Subject: RE: Checkboxes with session-scoped DynaActionForms From: Sgarlata Matt [mailto:[EMAIL PROTECTED] Also, It looks like I am going to have to subclass DynaActionForm or DynaValidatorForm so that I can reset the checkboxes in the reset() method of the form bean. That seems like quite a pain (kind of defeats the purpose of Dyna forms, doesn't it?). Dyna forms merely free you of the need to write all those get/set methods. Defining the properties in struts-config.xml does not mean you can't or shouldn't override the 'reset' and/or 'validate' methods. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkboxes with session-scoped DynaActionForms
I think there is a common misconception that if you use DynaActionForms you don't need to write an ActionForm AT ALL. While this is true, you may also subclass the DynaForm and provide a similar level of functionality as a normal form. Kmart Tech News news://uskihsvtfinsys The essence of knowledge is, having it, to apply it; not having it, to confess your ignorance. -Original Message- From: Sgarlata Matt [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 4:47 PM To: Struts Users Mailing List Subject: Re: Checkboxes with session-scoped DynaActionForms Wendy Barrett - Thanks for your help! Both of your answers helped me fix the problem I was having with checkboxes and session-scoped DynaActionForms. Wendy - I feel like the reset method of the DynaActionForm should be able to automatically take care of checkboxes, perhaps with a little extra help like specifying clearOnReset=true or isCheckbox=true in the set-property element for the property, but oh well... I'm not going to push it on the dev list. Matt - Original Message - From: Wendy Smoak [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 3:03 PM Subject: RE: Checkboxes with session-scoped DynaActionForms From: Sgarlata Matt [mailto:[EMAIL PROTECTED] Also, It looks like I am going to have to subclass DynaActionForm or DynaValidatorForm so that I can reset the checkboxes in the reset() method of the form bean. That seems like quite a pain (kind of defeats the purpose of Dyna forms, doesn't it?). Dyna forms merely free you of the need to write all those get/set methods. Defining the properties in struts-config.xml does not mean you can't or shouldn't override the 'reset' and/or 'validate' methods. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - This message and its contents (to include attachments) are the property of Kmart Corporation (Kmart) and may contain confidential and proprietary information. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on information contained herein is strictly prohibited. Unauthorized use of information contained herein may subject you to civil and criminal prosecution and penalties. If you are not the intended recipient, you should delete this message immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]