RE: Multibox deselection problem
use disabled instead of readonly. IIRC , HTML rarely uses readonly -- its mostly disabled attribute everywhere. It works just fine for me. > -Original Message- > From: Olivier Croisier [mailto:[EMAIL PROTECTED] > Sent: Monday, November 15, 2004 4:10 AM > To: Struts Users Mailing List > Subject: Re: Multibox deselection problem > > > Hi ! > > Thank you for you help, it works fine now ! > > BTW, it seems like Struts does not support all standart HTML > options : I had to use a pure HTML tag because the > "readonly" attribute does not exist in Struts, and I think > this mix is a bit dirty. But it works... > ("onLoad" not supported either...) > > Olivier Croisier > > > > This is a problem with HTTP: when all the checkboxes are > deselected, the > > browser doesn't send anything back, so you get the default > of what you > > started with. To solve this problem you must ensure that at > least one box is > > always selected. > > > > I solved this problem by creating an additional checkbox > that is hidden, > > read-only and selected. This will ensure that the browser > sends something > > back. > > > > String[] defaultEntities = {"A", "B", "C", "D", "filler"}; > > > > > value="filler"/> > > > > Wiebe > > > > -Original Message- > > From: Olivier Croisier [mailto:[EMAIL PROTECTED] > > Sent: Friday, November 12, 2004 6:47 AM > > To: [EMAIL PROTECTED] > > Subject: Multibox deselection problem > > > > Hi ! > > > > I have a problem with the Multibox behaviour. I have > checked the online doc > > but nothing helped me so far... Here is my problem : > > > > My app workflow is : > > prepareImportAction.do -> Import.jsp -> processImportAction.do > > > > In the prepareImportAction.do, I initialize the "entities" > var (of type > > String[], in session scope), so that the checkboxes are > checked by default > > when the jsp page is displayed : > > String[] defaultEntities = {"A", "B", "C", "D"}; > > myform.set("entities", defaultEntities); > > > > In the jsp page, I have a set of : > > > > > > > > > > > > I also have a small javascript that allows the user to > select or deselect > > all checkboxes in one click : > > function checkAll(field) > > { var i; > > for (i=0;i > { field[i].checked=true; } > > } > > (nearly the same for de-selecting all checkboxes) > > > > Now here is my problem. When I de-select all the checkboxes > in my jsp page, > > by hand or by javascript, my processImport.do receives a > String[] array > > containing the entities that were defined in > preparaImport.do as default, > > instead of an empty array. > > This only happens only when all entities are deselected : > if a single one is > > selected, I get the desired behaviour. > > > > May you help me to understand where I am wrong and why it > doesn't work > > please? > > > > Olivier Croisier > > > > > > -- > CROISIER Olivier > Software Engineer > Thales IS - ANS > [EMAIL PROTECTED] > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. Thank you, Standard & Poor's - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multibox deselection problem
For simple use-n-throw (non-dynaforms?) forms, a much better *generic* solution :- At the VERY BOTTOM (please note the caps to get your attention ;-) ) of the JSP that displays the form :- <% MyForm frm = (MyForm) request.getAttribute("formname"); frm.reset(); %> In scenarios where the user can "temporarily" navigate to other pages and comes BACK to this page the user will find all values gone... So, it works wonderfully ONLY for use-n-throw forms. >From my experience, forms with such checkboxes are not on the 'main page' >(that the user keeps coming back to for all screen flows). All my forms are explicit bean-classes, -- others can let you know if reset() works on dynaforms. And do not forget to code your reset() function. > -Original Message- > From: Wiebe de Jong [mailto:[EMAIL PROTECTED] > Sent: Friday, November 12, 2004 12:59 PM > To: 'Struts Users Mailing List' > Subject: RE: Multibox deselection problem > > > This is a problem with HTTP: when all the checkboxes are > deselected, the > browser doesn't send anything back, so you get the default of what you > started with. To solve this problem you must ensure that at > least one box is > always selected. > > I solved this problem by creating an additional checkbox that > is hidden, > read-only and selected. This will ensure that the browser > sends something > back. > > String[] defaultEntities = {"A", "B", "C", "D", "filler"}; > > value="filler"/> > > Wiebe > > -Original Message- > From: Olivier Croisier [mailto:[EMAIL PROTECTED] > Sent: Friday, November 12, 2004 6:47 AM > To: [EMAIL PROTECTED] > Subject: Multibox deselection problem > > Hi ! > > I have a problem with the Multibox behaviour. I have checked > the online doc > but nothing helped me so far... Here is my problem : > > My app workflow is : > prepareImportAction.do -> Import.jsp -> processImportAction.do > > In the prepareImportAction.do, I initialize the "entities" > var (of type > String[], in session scope), so that the checkboxes are > checked by default > when the jsp page is displayed : > String[] defaultEntities = {"A", "B", "C", "D"}; > myform.set("entities", defaultEntities); > > In the jsp page, I have a set of : > > > > > > I also have a small javascript that allows the user to select > or deselect > all checkboxes in one click : > function checkAll(field) > { var i; > for (i=0;i { field[i].checked=true; } > } > (nearly the same for de-selecting all checkboxes) > > Now here is my problem. When I de-select all the checkboxes > in my jsp page, > by hand or by javascript, my processImport.do receives a > String[] array > containing the entities that were defined in preparaImport.do > as default, > instead of an empty array. > This only happens only when all entities are deselected : if > a single one is > selected, I get the desired behaviour. > > May you help me to understand where I am wrong and why it doesn't work > please? > > Olivier Croisier > > -- > CROISIER Olivier > Software Engineer > Thales IS - ANS > [EMAIL PROTECTED] > > - > 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] > > The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. Thank you, Standard & Poor's - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multibox deselection problem
Hi ! Thank you for you help, it works fine now ! BTW, it seems like Struts does not support all standart HTML options : I had to use a pure HTML tag because the "readonly" attribute does not exist in Struts, and I think this mix is a bit dirty. But it works... ("onLoad" not supported either...) Olivier Croisier This is a problem with HTTP: when all the checkboxes are deselected, the browser doesn't send anything back, so you get the default of what you started with. To solve this problem you must ensure that at least one box is always selected. I solved this problem by creating an additional checkbox that is hidden, read-only and selected. This will ensure that the browser sends something back. String[] defaultEntities = {"A", "B", "C", "D", "filler"}; Wiebe -Original Message- From: Olivier Croisier [mailto:[EMAIL PROTECTED] Sent: Friday, November 12, 2004 6:47 AM To: [EMAIL PROTECTED] Subject: Multibox deselection problem Hi ! I have a problem with the Multibox behaviour. I have checked the online doc but nothing helped me so far... Here is my problem : My app workflow is : prepareImportAction.do -> Import.jsp -> processImportAction.do In the prepareImportAction.do, I initialize the "entities" var (of type String[], in session scope), so that the checkboxes are checked by default when the jsp page is displayed : String[] defaultEntities = {"A", "B", "C", "D"}; myform.set("entities", defaultEntities); In the jsp page, I have a set of : I also have a small javascript that allows the user to select or deselect all checkboxes in one click : function checkAll(field) { var i; for (i=0;i Now here is my problem. When I de-select all the checkboxes in my jsp page, by hand or by javascript, my processImport.do receives a String[] array containing the entities that were defined in preparaImport.do as default, instead of an empty array. This only happens only when all entities are deselected : if a single one is selected, I get the desired behaviour. May you help me to understand where I am wrong and why it doesn't work please? Olivier Croisier -- CROISIER Olivier Software Engineer Thales IS - ANS [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multibox deselection problem
Olivier Croisier wrote the following on 11/12/2004 9:46 AM: Now here is my problem. When I de-select all the checkboxes in my jsp page, by hand or by javascript, my processImport.do receives a String[] array containing the entities that were defined in preparaImport.do as default, instead of an empty array. Use the form reset method to always set the String array to an empty array first. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multibox deselection problem
This is a problem with HTTP: when all the checkboxes are deselected, the browser doesn't send anything back, so you get the default of what you started with. To solve this problem you must ensure that at least one box is always selected. I solved this problem by creating an additional checkbox that is hidden, read-only and selected. This will ensure that the browser sends something back. String[] defaultEntities = {"A", "B", "C", "D", "filler"}; Wiebe -Original Message- From: Olivier Croisier [mailto:[EMAIL PROTECTED] Sent: Friday, November 12, 2004 6:47 AM To: [EMAIL PROTECTED] Subject: Multibox deselection problem Hi ! I have a problem with the Multibox behaviour. I have checked the online doc but nothing helped me so far... Here is my problem : My app workflow is : prepareImportAction.do -> Import.jsp -> processImportAction.do In the prepareImportAction.do, I initialize the "entities" var (of type String[], in session scope), so that the checkboxes are checked by default when the jsp page is displayed : String[] defaultEntities = {"A", "B", "C", "D"}; myform.set("entities", defaultEntities); In the jsp page, I have a set of : I also have a small javascript that allows the user to select or deselect all checkboxes in one click : function checkAll(field) { var i; for (i=0;i