RE: Checkbox not checked
From: Curtis Taylor [mailto:[EMAIL PROTECTED] I'm not exactly sure, but I'm a tad suspect of your 'c:if test' expression. It looks suspiciously like a Python boolean test for the object's presence. AFAIK, in JSTL one needs to be more explicit as to what value (or lack thereof) when testing... Unless, of course, it's just a typo in your email...;-) No, that part is working fine. 'item.value.activity' is a Map of Booleans, and I'm checking whether there's any activity for that calendar year. The problem is that this: html-el:checkbox property=accounts value=${item.key}/ does not render as checked when the matching value _is_ present in the String[] property called 'accounts' in the form bean. :( I think it has to do with manually supplying the 'value', because it works if you do this: c:forEach items=${accountForm.map['accounts']} var=acct html-el:multibox property=accounts value=${acct}/ c:out value=${accountMap[acct].costCenterDesc}/ /c:forEach I could just hit delete now, but instead I'll archive my mistake: I used checkbox with a String[] property. The second snippet has the correct tag: multibox. Which is why that one works. -- 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: Checkbox not checked
Hi Wendy, I'm not exactly sure, but I'm a tad suspect of your 'c:if test' expression. It looks suspiciously like a Python boolean test for the object's presence. AFAIK, in JSTL one needs to be more explicit as to what value (or lack thereof) when testing... Unless, of course, it's just a typo in your email...;-) Curtis -- c dot tee at verizon dot net Wendy Smoak wrote: (No, this isn't the infamous how do I uncheck my checkbox question!) I have this: c:forEach items=${accountMap} var=item c:if test=${item.value.activity[accountForm.map.calendarYear]} html-el:checkbox property=accounts value=${item.key}/ c:out value=${item.key}/nbsp; c:out value=${item.value.costCenterDesc}/ /c:if /c:forEach Unfortunately, the checkboxes corresponding to the String[] 'accounts' property of the form are not being rendered as checked. Before I go back to the Action and create a separate Map to hold only the active accounts based on the selected year, does anyone think this ought to work the way it is? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: checkbox value from getter in collection of value object
Hello Shahfazal, As i understand from the 'applicantId' getter, you want to use these checkboxes as a selecting indicator. If so, create a String[] getter/setter in your ActionForm, let say: setSelectedApplicants(String[] ids) String[] getSelectedApplicants() now in your jsp you can write: html:multibox property=selectedApplicants bean:write name=appList property=applicantid !-- this is what i get from your logic iterate, basically, you need to get applicantId from your bean -- /html:multibox this should produce HTML like input type=checkbox name=selectedApplicants value=11 input type=checkbox name=selectedApplicants value=12 now when you submit page, and inspect ActionForm.getSelectedApplicants() string array, you should get the IDs of selected checkboxes. Hope this helps! ATTA On Dec 26, 2003, at 1:07 PM, shahfazal wrote: Hi all i already posted twice about this but i guess my email program had trouble formatting my mail or somethign but anyway long thing short i have a collection of ApplicationVO value objects, i need to display them in rows on a jsp. so i iterate thru the collection of the value objects, and at the beginning of the row i need a check box with a value of one of the properties of the value object how do i go about it? i know the multibox can do this but i'm having trouble binding the property to the value of this multibox .. can anyone help me? my code : logic:iterate id=appList name=incompleteFolderForm property=applications html:multibox property=??/html:multibox !-- i need the checkbox to have the value of the 'applicantId' getter property of my value object bean:write name=appList property=firstName/ bean:write name=appList property=lastName/ /logic:iterate can anyone help me?? i'm kinda desperate to find a solution ...would be really great if anyone could help me out Regards.. Shahfazal Mohammed Research A$$i$tant Center for Business and Information Technologies http://www.cbit.louisiana.edu 337.482.0626 work 337.322.1946 cell 337.233.1092 home - 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: Checkbox deselect problem
Hello Michael, We need to handle checkboxes in special way. Reset method in FormBean is exactly meant for this. We need to reset the checkboxes to its default value. Kulkarni. -Original Message- From: Frers Michael [mailto:[EMAIL PROTECTED] Sent: Monday, December 15, 2003 2:23 PM To: Struts Users Mailing List Subject: Checkbox deselect problem Hello i have a problem with the checkbox tag i have a ActionForm Bean containg one value test private class testBean extends ActionForm{ private String test; //+ Getter and Setter } no i inserted in my jsp page: html-el:checkbox property=test /html-el:checkbox now if i select the field the checkbox is marked as checked but now if i deselect the checkbox again the checkbox always stays checked in debug modus of my tomcatplugin the field always contains the value=on Someone can help me? - 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: checkbox condition check
Are you saying that you have a fixed set of options and depends on what value is from your bean, the option that has the same value will be checked? Maybe something like this? form input name=checkbox type=checkbox value=val1 c:if test=${myval == 'val1'}checked/c:if Check Box 1 /input input type=checkbox name=checkbox2 value=val2 c:if test=${myval == 'val1'}checked/c:if Check Box 2 /input input type=checkbox name=checkbox3 value=val3 c:if test=${myval == 'val1'}checked/c:if Check Box 3 /input /form Where myval is your the column's value you want to test for? -H On Dec 4, 2003, at 4:58 PM, Clark Kent wrote: I have a situation where I have a table with rows of information. checkbox1 - unique for row1 checkbox2 - unique for row2 checkbox3 - unique for row3 I do know that there are exactly 3 rows of information at all times for this table. Now I am trying to get these checkboxes to work based on each unique row. What kind of struts tag do I use to perform the checkbox to have a check against it or not based on whether that particular checkbox info appears in the row because each checkbox has its respective getter which returns boolean. some tag to check for condition html:checkbox property=a1 end tag - Do you Yahoo!? Free Pop-Up Blocker - Get it now - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: checkbox condition check
Ops the c:if's tests should be c:if test=${myval == 'val1'}checked/c:if c:if test=${myval == 'val2'}checked/c:if c:if test=${myval == 'val3'}checked/c:if or Check Box 1,2,and 3 respectively. -H On Dec 4, 2003, at 7:28 PM, Hien Q Nguyen wrote: Are you saying that you have a fixed set of options and depends on what value is from your bean, the option that has the same value will be checked? Maybe something like this? form input name=checkbox type=checkbox value=val1 c:if test=${myval == 'val1'}checked/c:if Check Box 1 /input input type=checkbox name=checkbox2 value=val2 c:if test=${myval == 'val1'}checked/c:if Check Box 2 /input input type=checkbox name=checkbox3 value=val3 c:if test=${myval == 'val1'}checked/c:if Check Box 3 /input /form Where myval is your the column's value you want to test for? -H On Dec 4, 2003, at 4:58 PM, Clark Kent wrote: I have a situation where I have a table with rows of information. checkbox1 - unique for row1 checkbox2 - unique for row2 checkbox3 - unique for row3 I do know that there are exactly 3 rows of information at all times for this table. Now I am trying to get these checkboxes to work based on each unique row. What kind of struts tag do I use to perform the checkbox to have a check against it or not based on whether that particular checkbox info appears in the row because each checkbox has its respective getter which returns boolean. some tag to check for condition html:checkbox property=a1 end tag - Do you Yahoo!? Free Pop-Up Blocker - Get it now - 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: Checkbox and Map ActionForm
why not use JSTL c:forEach.? :) - Original Message - From: Ryan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 27, 2003 12:31 AM Subject: Checkbox and Map ActionForm I have checkboxes on my form that have multiple options/group. The name for each group of checkboxes is generated from the database, so I decided to use a map on my action form to collect the checkbox values since the names of the checkbox are not known. However, when more than one option is selected within a group, BeanUtils turns the array passed from the checkbox into the first value of the array. For example, if for box1 1,3,4 are selected, box1's value in the map is 1. Is there a way to collect the values submitted by a checkbox group without knowing the name of this group beforehand? Thanks Ryan The html form: html:form action=/setMethods scope=request html:checkbox property=value(box1) value=1/1 html:checkbox property=value(box1) value=2/2 html:checkbox property=value(box1) value=3/3 html:checkbox property=value(box1) value=4/4 html:checkbox property=value(box1) value=5/5 brbr html:checkbox property=value(box2) value=a/a html:checkbox property=value(box2) value=b/b html:checkbox property=value(box2) value=c/c br input type=submit /html:form The action form public class FooForm extends ActionForm { private final Map values = new HashMap(); public void setValue(String key, Object value){ values.put(key, value); } public Object getValue(String key){ return values.get(key); } } - 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: Checkbox and Map ActionForm
The array generated from selecting multiple checkboxes with the same name is not being passed as a whole value into the action form. Instead only the first value is being set as the value. I was wondering how you would get the whole array into the action form. Thanks Ryan Ricky wrote: why not use JSTL c:forEach.? :) - Original Message - From: Ryan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 27, 2003 12:31 AM Subject: Checkbox and Map ActionForm I have checkboxes on my form that have multiple options/group. The name for each group of checkboxes is generated from the database, so I decided to use a map on my action form to collect the checkbox values since the names of the checkbox are not known. However, when more than one option is selected within a group, BeanUtils turns the array passed from the checkbox into the first value of the array. For example, if for box1 1,3,4 are selected, box1's value in the map is 1. Is there a way to collect the values submitted by a checkbox group without knowing the name of this group beforehand? Thanks Ryan The html form: html:form action=/setMethods scope=request html:checkbox property=value(box1) value=1/1 html:checkbox property=value(box1) value=2/2 html:checkbox property=value(box1) value=3/3 html:checkbox property=value(box1) value=4/4 html:checkbox property=value(box1) value=5/5 brbr html:checkbox property=value(box2) value=a/a html:checkbox property=value(box2) value=b/b html:checkbox property=value(box2) value=c/c br input type=submit /html:form The action form public class FooForm extends ActionForm { private final Map values = new HashMap(); public void setValue(String key, Object value){ values.put(key, value); } public Object getValue(String key){ return values.get(key); } } - 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: checkbox onclick event not getting called
try onclick=check(this.myname) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 25, 2003 11:20 AM To: [EMAIL PROTECTED] Subject: checkbox onclick event not getting called Hi, My code is like the following, when I click the checkbox, nothing happened (the 'add' button suppose to get disabled). I put a alert statment in the javascript, and didn't get it showed when click the checkbox... seems the function didn't get called at all, can anybody tell me why? Thanks a lot! SCRIPT LANGUAGE=JavaScript function check(element) { alert(getting called); document.myform.add.disabled = ( element.checked ); } html:form action=myAction name=myForm html:submit propery=add value=Add/ input type=checkbox onclick=check(this) name=myname value=myvalue/ - Do you Yahoo!? Free Pop-Up Blocker - Get it now - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox onclick event not getting called
This is probably OT, but anyway... It may be the way you are referencing the form. Try 'document.forms[0].add.disabled = ( element.checked );' That worked for me - I didn't use struts though - I just messed around with static html: html SCRIPT LANGUAGE=JavaScript function check(element) { //alert(element.checked); document.forms[0].add.disabled = ( element.checked ); } /script body form input type=checkbox onclick=check(this) name=myname value=myvalue/ input type=submit name=add / /form /body /html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 25 November 2003 16:20 To: [EMAIL PROTECTED] Subject: checkbox onclick event not getting called Hi, My code is like the following, when I click the checkbox, nothing happened (the 'add' button suppose to get disabled). I put a alert statment in the javascript, and didn't get it showed when click the checkbox... seems the function didn't get called at all, can anybody tell me why? Thanks a lot! SCRIPT LANGUAGE=JavaScript function check(element) { alert(getting called); document.myform.add.disabled = ( element.checked ); } html:form action=myAction name=myForm html:submit propery=add value=Add/ input type=checkbox onclick=check(this) name=myname value=myvalue/ - Do you Yahoo!? Free Pop-Up Blocker - Get it now ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox onclick event not getting called
It's still not working. Any other option? I am using Mozilla, will that be the reason? Jimmy Emmanual [EMAIL PROTECTED] wrote:try onclick=check(this.myname) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 25, 2003 11:20 AM To: [EMAIL PROTECTED] Subject: checkbox onclick event not getting called Hi, My code is like the following, when I click the checkbox, nothing happened (the 'add' button suppose to get disabled). I put a alert statment in the javascript, and didn't get it showed when click the checkbox... seems the function didn't get called at all, can anybody tell me why? Thanks a lot! function check(element) { alert(getting called); document.myform.add.disabled = ( element.checked ); } [input] - Do you Yahoo!? Free Pop-Up Blocker - Get it now - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Free Pop-Up Blocker - Get it now
RE: checkbox onclick event not getting called
This is the modified version of your code that i tried. It works in ie 5.5 and netscape 7.1 script function check(element) { alert(getting called); document.myForm.add.disabled = true; } /script form action=myAction name=myForm input type=submit value=Submit name=add input type=checkbox onclick=check(this.myname) name=myname value=myvalue/ /form -Original Message- From: Jimmy Emmanual [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 25, 2003 12:04 PM To: 'Struts Users Mailing List' Subject: RE: checkbox onclick event not getting called try onclick=check(this.myname) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 25, 2003 11:20 AM To: [EMAIL PROTECTED] Subject: checkbox onclick event not getting called Hi, My code is like the following, when I click the checkbox, nothing happened (the 'add' button suppose to get disabled). I put a alert statment in the javascript, and didn't get it showed when click the checkbox... seems the function didn't get called at all, can anybody tell me why? Thanks a lot! SCRIPT LANGUAGE=JavaScript function check(element) { alert(getting called); document.myform.add.disabled = ( element.checked ); } html:form action=myAction name=myForm html:submit propery=add value=Add/ input type=checkbox onclick=check(this) name=myname value=myvalue/ - Do you Yahoo!? Free Pop-Up Blocker - Get it now - 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: Checkbox values
Geert, this would create BookListKey[i].selectedBook = 1 for Checked Books When you have to render this info try logic:present name=BookListKey logic:iterate id=book name=BookListKey logic:equal name=book property=selectedBook value=1 brselected index = bean:write name=book property=id/ /logic:equal /logic:iterate /logic:present hope this helps Regards Sumit -Original Message- From: Geert Van Landeghem [mailto:[EMAIL PROTECTED] Sent: Friday, November 14, 2003 4:56 PM To: Struts Users Mailing List Subject: Checkbox values Hello all, I'm trying to show the selected rows in a html table by using check boxes. I'm using the same jsp to show the selected row indexes of the table. What am I'm doing wrong because I'm not able to see the selected indexes: logic:present name=selectedBook logic:iterate id=sel name=selectedBook brselected index = bean:write name=sel/ /logic:iterate /logic:present logic:iterate id=book name=BookListKey scope=request tr tdhtml:checkbox property=selectedBookbean:write name=book property=id//html:checkbox/td tdbean:write name=book property=authorLastName/nbsp;/td tdbean:write name=book property=authorFirstName/nbsp;/td tdbean:write name=book property=title/nbsp;/td /tr /logic:iterate tia, met vriendelijke groeten, salutations sincères, kind regards, Geert Van Landeghem Reynders Etiketten NV tel: +32 3 460.32.81 gsm: +32 477.75.95.33 mailto:[EMAIL PROTECTED] Give me the power to accept the things i cannot change, the strength to change the things i can change, and the insight to tell the difference - 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: Checkbox values: how to substitute the value attribute by the book id?
Sumit, I found a solution to this problem as following: !-- presenting the selected checkbox values -- logic:present name=bookListForm property=selectedBook logic:iterate id=sel name=bookListForm property=selectedBook brindex = bean:write name=sel/ /logic:iterate /logic:present !-- the form with the checkbox for each row of the html table -- !-- refers to this page being executed again -- html:form action=/booklist table width=95% border=1 tr th bgcolor=#330066font color=#FFnbsp;/font/th th bgcolor=#330066font color=#FFAuthorL/font/th th bgcolor=#330066font color=#FFAuthorF/font/th th bgcolor=#330066font color=#FFTitle/font/th /tr logic:iterate id=book name=BookListKey scope=request tr tdhtml:checkbox property=selectedBook value=??bean:write name=book property=id//html:checkbox/td tdbean:write name=book property=authorLastName/nbsp;/td tdbean:write name=book property=authorFirstName/nbsp;/td tdbean:write name=book property=title/nbsp;/td /tr /logic:iterate /table html:submitProcess/html:submit /html:form -Original Message- From: Sumit S. [mailto:[EMAIL PROTECTED] Sent: vrijdag 14 november 2003 12:51 To: Struts Users Mailing List Subject: RE: Checkbox values Geert, this would create BookListKey[i].selectedBook = 1 for Checked Books When you have to render this info try logic:present name=BookListKey logic:iterate id=book name=BookListKey logic:equal name=book property=selectedBook value=1 brselected index = bean:write name=book property=id/ /logic:equal /logic:iterate /logic:present hope this helps Regards Sumit -Original Message- From: Geert Van Landeghem [mailto:[EMAIL PROTECTED] Sent: Friday, November 14, 2003 4:56 PM To: Struts Users Mailing List Subject: Checkbox values Hello all, I'm trying to show the selected rows in a html table by using check boxes. I'm using the same jsp to show the selected row indexes of the table. What am I'm doing wrong because I'm not able to see the selected indexes: logic:present name=selectedBook logic:iterate id=sel name=selectedBook brselected index = bean:write name=sel/ /logic:iterate /logic:present logic:iterate id=book name=BookListKey scope=request tr tdhtml:checkbox property=selectedBookbean:write name=book property=id//html:checkbox/td tdbean:write name=book property=authorLastName/nbsp;/td tdbean:write name=book property=authorFirstName/nbsp;/td tdbean:write name=book property=title/nbsp;/td /tr /logic:iterate tia, met vriendelijke groeten, salutations sincères, kind regards, Geert Van Landeghem Reynders Etiketten NV tel: +32 3 460.32.81 gsm: +32 477.75.95.33 mailto:[EMAIL PROTECTED] Give me the power to accept the things i cannot change, the strength to change the things i can change, and the insight to tell the difference - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkbox values: how to substitute the value attribute by the book id?
But how to substitute the value=?? by the book id? Geert -Original Message- From: Geert Van Landeghem Sent: vrijdag 14 november 2003 14:48 To: Struts Users Mailing List Subject: RE: Checkbox values: how to substitute the value attribute by the book id? Sumit, I found a solution to this problem as following: !-- presenting the selected checkbox values -- logic:present name=bookListForm property=selectedBook logic:iterate id=sel name=bookListForm property=selectedBook brindex = bean:write name=sel/ /logic:iterate /logic:present !-- the form with the checkbox for each row of the html table -- !-- refers to this page being executed again -- html:form action=/booklist table width=95% border=1 tr th bgcolor=#330066font color=#FFnbsp;/font/th th bgcolor=#330066font color=#FFAuthorL/font/th th bgcolor=#330066font color=#FFAuthorF/font/th th bgcolor=#330066font color=#FFTitle/font/th /tr logic:iterate id=book name=BookListKey scope=request tr tdhtml:checkbox property=selectedBook value=??bean:write name=book property=id//html:checkbox/td tdbean:write name=book property=authorLastName/nbsp;/td tdbean:write name=book property=authorFirstName/nbsp;/td tdbean:write name=book property=title/nbsp;/td /tr /logic:iterate /table html:submitProcess/html:submit /html:form -Original Message- From: Sumit S. [mailto:[EMAIL PROTECTED] Sent: vrijdag 14 november 2003 12:51 To: Struts Users Mailing List Subject: RE: Checkbox values Geert, this would create BookListKey[i].selectedBook = 1 for Checked Books When you have to render this info try logic:present name=BookListKey logic:iterate id=book name=BookListKey logic:equal name=book property=selectedBook value=1 brselected index = bean:write name=book property=id/ /logic:equal /logic:iterate /logic:present hope this helps Regards Sumit -Original Message- From: Geert Van Landeghem [mailto:[EMAIL PROTECTED] Sent: Friday, November 14, 2003 4:56 PM To: Struts Users Mailing List Subject: Checkbox values Hello all, I'm trying to show the selected rows in a html table by using check boxes. I'm using the same jsp to show the selected row indexes of the table. What am I'm doing wrong because I'm not able to see the selected indexes: logic:present name=selectedBook logic:iterate id=sel name=selectedBook brselected index = bean:write name=sel/ /logic:iterate /logic:present logic:iterate id=book name=BookListKey scope=request tr tdhtml:checkbox property=selectedBookbean:write name=book property=id//html:checkbox/td tdbean:write name=book property=authorLastName/nbsp;/td tdbean:write name=book property=authorFirstName/nbsp;/td tdbean:write name=book property=title/nbsp;/td /tr /logic:iterate tia, met vriendelijke groeten, salutations sincères, kind regards, Geert Van Landeghem Reynders Etiketten NV tel: +32 3 460.32.81 gsm: +32 477.75.95.33 mailto:[EMAIL PROTECTED] Give me the power to accept the things i cannot change, the strength to change the things i can change, and the insight to tell the difference - 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] - 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: checkbox checking???
The array which are using to store values of checkboxes after form submission; just initialize that array with the value which you wana check. e.g. in form bean: String[] array = {1}; // this is an array which will be used to store values of the checkboxes on jsp: html:multibox property=array 1 /html:multibox this checkbox will be checked when you render the page. Regards, MMS -- From: mohamed ebrahim faisal [SMTP:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 9:38 PM To: [EMAIL PROTECTED] Subject: checkbox checking??? Hi I fetch data from the database abd store it in the Form Bean. After that while displaying the value in the JSP, i am associating one of the property to an array of checkboxes with the same property. I want the checkbox to be checked based on my property value, it might be differnt for checkboxes in the array. If it is a input type=checkbox. i can easily do it using attribute checked, but how to do it in html:checkbox . since struts Checkbox does not support checked attribute. Can anyone pls tell me. regards faisal _ The heat is on! Catch the latest action. http://server1.msn.co.in/sp03/formula2003/ Speed along with F1! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkbox problem?
Oki, thanks for all your suggestions; I'll try them out and see what happens... :) BTJ On Tue, 2003-06-10 at 22:11, Steve Raeburn wrote: The suggested method requires two actions. SetupAction - Form - ProcessAction The first action prepares any values required by your form, including setting the value of your checkboxes to true. The second action is the one that actually processes the user input gathered by the form. Hope this clarifies things. Steve -Original Message- From: Bjørn T Johansen [mailto:[EMAIL PROTECTED] Sent: June 10, 2003 12:38 PM To: Struts Users Mailing List Subject: Re: Checkbox problem? oki, maybe my explanation isn't the best :) (I know that I can't do it in the reset method, as it is clearly not working) but I am still not sure where to put the code to set the checkbox to true then. As far as I know, the action class isn't called before after the form bean has called the reset method and the page has been rendered (and the submit button has been pressed), or is it something I am missing? BTJ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- --- Bjørn T Johansen (BSc,MNIF) Executive Manager [EMAIL PROTECTED] Havleik Consulting Phone : +47 67 54 15 17 Conradisvei 4 Fax : +47 67 54 13 91 N-1338 Sandvika Cellular : +47 926 93 298 http://www.havleik.no --- The stickers on the side of the box said Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better, so clearly Linux was a supported platform. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Checkbox problem?
Can you describe what's going on in more detail? -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org - Original Message - From: Bjorn T Johansen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 4:26 AM Subject: Checkbox problem? I use checkboxes to input some variables in a form and as long as I insert new records, i.e. the checkbox variable gets set to false in the form's reset method, it works fine. But when I, say, edit the same record (and propagate the values of the form in the reset method), I never can uncheck the checkbox if it was set to true in the reset method. Are there any solutions/work around for this? Regards, BTJ -- - Bjørn T Johansen (BSc,MNIF) Executive Manager [EMAIL PROTECTED] Havleik Consulting Phone : +47 67 54 15 17 Conradisvei 4 Fax : +47 67 54 13 91 N-1338 Sandvika Cellular : +47 926 93 298 http://www.havleik.no -- - The stickers on the side of the box said Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better, so clearly Linux was a supported platform. -- - - 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: Checkbox problem?
I would suggest not doing the propagate in the reset. Just use it for the original values. The values entered on the form are automatically propagated by struts after the reset by the setters and getters. Just put in some logging or print statements in those methods and you will see when they are invoked. -Original Message- From: Bjorn T Johansen [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 4:27 AM To: [EMAIL PROTECTED] Subject: Checkbox problem? I use checkboxes to input some variables in a form and as long as I insert new records, i.e. the checkbox variable gets set to false in the form's reset method, it works fine. But when I, say, edit the same record (and propagate the values of the form in the reset method), I never can uncheck the checkbox if it was set to true in the reset method. Are there any solutions/work around for this? Regards, BTJ --- Bjørn T Johansen (BSc,MNIF) Executive Manager [EMAIL PROTECTED] Havleik Consulting Phone : +47 67 54 15 17 Conradisvei 4 Fax : +47 67 54 13 91 N-1338 Sandvika Cellular : +47 926 93 298 http://www.havleik.no --- The stickers on the side of the box said Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better, so clearly Linux was a supported platform. --- - 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: Checkbox problem?
I had some issues with the methods, so I came up with something else that works very nicely. In the JSP, right after the code for the checkbox, use: jsp:setProperty name=beanName property=checkboxProperty value=false / This allows the form submission to work correctly, without any messy code. However, I am no expert with this stuff, so if there is any reason not to do this I'd be interested in hearing it. Keith Kamholz Programming and Architecture Moog Inc. Phone: (716) 687-7001 -Original Message- From: Bjorn T Johansen [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 4:27 AM To: [EMAIL PROTECTED] Subject: Checkbox problem? I use checkboxes to input some variables in a form and as long as I insert new records, i.e. the checkbox variable gets set to false in the form's reset method, it works fine. But when I, say, edit the same record (and propagate the values of the form in the reset method), I never can uncheck the checkbox if it was set to true in the reset method. Are there any solutions/work around for this? Regards, BTJ --- Bjørn T Johansen (BSc,MNIF) Executive Manager [EMAIL PROTECTED] Havleik Consulting Phone : +47 67 54 15 17 Conradisvei 4 Fax : +47 67 54 13 91 N-1338 Sandvika Cellular : +47 926 93 298 http://www.havleik.no --- The stickers on the side of the box said Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better, so clearly Linux was a supported platform. --- - 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: Checkbox problem?
Yes, but to clarify... I am showing a jsp page with values read from a database. If the checkbox value is true, how do I then make the checkbox on my jsp-page checked and how do I then find out if the checkbox has been unchecked? Do I have to manually read the posted data and see if the checkbox attribute is missing or is there a better way? BTJ On Tue, 2003-06-10 at 15:45, Kandi Potter wrote: I would suggest not doing the propagate in the reset. Just use it for the original values. The values entered on the form are automatically propagated by struts after the reset by the setters and getters. Just put in some logging or print statements in those methods and you will see when they are invoked. -Original Message- From: Bjorn T Johansen [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 4:27 AM To: [EMAIL PROTECTED] Subject: Checkbox problem? I use checkboxes to input some variables in a form and as long as I insert new records, i.e. the checkbox variable gets set to false in the form's reset method, it works fine. But when I, say, edit the same record (and propagate the values of the form in the reset method), I never can uncheck the checkbox if it was set to true in the reset method. Are there any solutions/work around for this? Regards, BTJ --- Bjørn T Johansen (BSc,MNIF) Executive Manager [EMAIL PROTECTED] Havleik Consulting Phone : +47 67 54 15 17 Conradisvei 4 Fax : +47 67 54 13 91 N-1338 Sandvika Cellular : +47 926 93 298 http://www.havleik.no --- The stickers on the side of the box said Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better, so clearly Linux was a supported platform. --- - 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] -- --- Bjørn T Johansen (BSc,MNIF) Executive Manager [EMAIL PROTECTED] Havleik Consulting Phone : +47 67 54 15 17 Conradisvei 4 Fax : +47 67 54 13 91 N-1338 Sandvika Cellular : +47 926 93 298 http://www.havleik.no --- The stickers on the side of the box said Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better, so clearly Linux was a supported platform. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkbox problem?
In your ActionForm reset() method, set the checkbox value to false. Struts will set the value to true if the box is checked. If you are using DynaForms, you will need to extend it and override the reset() method. To populate the checkbox initially, you need to instantiate and populate the form bean and place it in the appropraite context. For more details, see: http://jakarta.apache.org/struts/faqs/newbie.html#prepopulate http://jakarta.apache.org/struts/faqs/newbie.html#checkbox -Kevin --- Bjørn T Johansen [EMAIL PROTECTED] wrote: Yes, but to clarify... I am showing a jsp page with values read from a database. If the checkbox value is true, how do I then make the checkbox on my jsp-page checked and how do I then find out if the checkbox has been unchecked? Do I have to manually read the posted data and see if the checkbox attribute is missing or is there a better way? BTJ On Tue, 2003-06-10 at 15:45, Kandi Potter wrote: I would suggest not doing the propagate in the reset. Just use it for the original values. The values entered on the form are automatically propagated by struts after the reset by the setters and getters. Just put in some logging or print statements in those methods and you will see when they are invoked. -Original Message- From: Bjorn T Johansen [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 4:27 AM To: [EMAIL PROTECTED] Subject: Checkbox problem? I use checkboxes to input some variables in a form and as long as I insert new records, i.e. the checkbox variable gets set to false in the form's reset method, it works fine. But when I, say, edit the same record (and propagate the values of the form in the reset method), I never can uncheck the checkbox if it was set to true in the reset method. Are there any solutions/work around for this? Regards, BTJ --- Bjørn T Johansen (BSc,MNIF) Executive Manager [EMAIL PROTECTED] Havleik Consulting Phone : +47 67 54 15 17 Conradisvei 4 Fax : +47 67 54 13 91 N-1338 Sandvika Cellular : +47 926 93 298 http://www.havleik.no --- The stickers on the side of the box said Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better, so clearly Linux was a supported platform. --- - 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] -- --- Bjørn T Johansen (BSc,MNIF) Executive Manager [EMAIL PROTECTED] Havleik Consulting Phone : +47 67 54 15 17 Conradisvei 4 Fax : +47 67 54 13 91 N-1338 Sandvika Cellular : +47 926 93 298 http://www.havleik.no --- The stickers on the side of the box said Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better, so clearly Linux was a supported platform. --- - 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: Checkbox problem?
[EMAIL PROTECTED] | Yes, but to clarify... | I am showing a jsp page with values read from a database. If the | checkbox value is true, how do I then make the checkbox on my jsp-page | checked and how do I then find out if the checkbox has been unchecked? | Do I have to manually read the posted data and see if the checkbox | attribute is missing or is there a better way? I assume that you are using an Action with an ActionForm. To make the value of the checkbox come up correctly, import struts tags into your jsp-page: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=strb % %@ taglib uri=/WEB-INF/struts-html.tld prefix=strh % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=strl % Then use the Struts checkbox tag: strh:checkbox property=done/ Assuming that your form has the methods getDone and setDone, these methods will be used to render the value of the checkbox correctly. As to the question of boolean values that are set to false by the user: You don't have to parse the posted data manually. The method reset() in ActionForm is run before the posted data is used to populate the form. Write your own reset() method where you set the boolean fields to false. -- mvh Tor Henrik Hanken - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Checkbox problem?
You are missing my point! If I just could set the checkbox value to false in the reset method, everything is fine. But there are times when that value has to be reset to true and not false and if I do that in my reset method, I am not able to see of the user unchek the checkbox, because the boolean variable is still true after the form has been posted! BTJ On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote: [EMAIL PROTECTED] | Yes, but to clarify... | I am showing a jsp page with values read from a database. If the | checkbox value is true, how do I then make the checkbox on my jsp-page | checked and how do I then find out if the checkbox has been unchecked? | Do I have to manually read the posted data and see if the checkbox | attribute is missing or is there a better way? I assume that you are using an Action with an ActionForm. To make the value of the checkbox come up correctly, import struts tags into your jsp-page: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=strb % %@ taglib uri=/WEB-INF/struts-html.tld prefix=strh % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=strl % Then use the Struts checkbox tag: strh:checkbox property=done/ Assuming that your form has the methods getDone and setDone, these methods will be used to render the value of the checkbox correctly. As to the question of boolean values that are set to false by the user: You don't have to parse the posted data manually. The method reset() in ActionForm is run before the posted data is used to populate the form. Write your own reset() method where you set the boolean fields to false. -- --- Bjørn T Johansen (BSc,MNIF) Executive Manager [EMAIL PROTECTED] Havleik Consulting Phone : +47 67 54 15 17 Conradisvei 4 Fax : +47 67 54 13 91 N-1338 Sandvika Cellular : +47 926 93 298 http://www.havleik.no --- The stickers on the side of the box said Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better, so clearly Linux was a supported platform. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Checkbox problem?
On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote: You are missing my point! If I just could set the checkbox value to false in the reset method, everything is fine. But there are times when that value has to be reset to true and not false and if I do that in my reset method, I am not able to see of the user unchek the checkbox, because the boolean variable is still true after the form has been posted! No, actually *YOU* are missing the point! Several people have tried to explain how this works to you. So, for one last effort IMPORTANT DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO TRUE IN THE RESET METHOD! /IMPORTANT If you want the field to be true when the page is rendered, set it to true from your action class, NOT in the reset of your formbean. I hope that clears it up for you. BTJ On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote: [EMAIL PROTECTED] | Yes, but to clarify... | I am showing a jsp page with values read from a database. If the | checkbox value is true, how do I then make the checkbox on my jsp-page | checked and how do I then find out if the checkbox has been unchecked? | Do I have to manually read the posted data and see if the checkbox | attribute is missing or is there a better way? I assume that you are using an Action with an ActionForm. To make the value of the checkbox come up correctly, import struts tags into your jsp-page: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=strb % %@ taglib uri=/WEB-INF/struts-html.tld prefix=strh % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=strl % Then use the Struts checkbox tag: strh:checkbox property=done/ Assuming that your form has the methods getDone and setDone, these methods will be used to render the value of the checkbox correctly. As to the question of boolean values that are set to false by the user: You don't have to parse the posted data manually. The method reset() in ActionForm is run before the posted data is used to populate the form. Write your own reset() method where you set the boolean fields to false. -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkbox problem?
Go get 'em, James! -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 2:29 PM To: Struts Users Mailing List Subject: Re: Checkbox problem? On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote: You are missing my point! If I just could set the checkbox value to false in the reset method, everything is fine. But there are times when that value has to be reset to true and not false and if I do that in my reset method, I am not able to see of the user unchek the checkbox, because the boolean variable is still true after the form has been posted! No, actually *YOU* are missing the point! Several people have tried to explain how this works to you. So, for one last effort IMPORTANT DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO TRUE IN THE RESET METHOD! /IMPORTANT If you want the field to be true when the page is rendered, set it to true from your action class, NOT in the reset of your formbean. I hope that clears it up for you. BTJ On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote: [EMAIL PROTECTED] | Yes, but to clarify... | I am showing a jsp page with values read from a database. If the | checkbox value is true, how do I then make the checkbox on my | jsp-page checked and how do I then find out if the checkbox has | been unchecked? Do I have to manually read the posted data and see | if the checkbox attribute is missing or is there a better way? I assume that you are using an Action with an ActionForm. To make the value of the checkbox come up correctly, import struts tags into your jsp-page: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=strb % %@ taglib uri=/WEB-INF/struts-html.tld prefix=strh % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=strl % Then use the Struts checkbox tag: strh:checkbox property=done/ Assuming that your form has the methods getDone and setDone, these methods will be used to render the value of the checkbox correctly. As to the question of boolean values that are set to false by the user: You don't have to parse the posted data manually. The method reset() in ActionForm is run before the posted data is used to populate the form. Write your own reset() method where you set the boolean fields to false. -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - 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: Checkbox problem?
oki, maybe my explanation isn't the best :) (I know that I can't do it in the reset method, as it is clearly not working) but I am still not sure where to put the code to set the checkbox to true then. As far as I know, the action class isn't called before after the form bean has called the reset method and the page has been rendered (and the submit button has been pressed), or is it something I am missing? BTJ On Tue, 2003-06-10 at 20:28, James Mitchell wrote: On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote: You are missing my point! If I just could set the checkbox value to false in the reset method, everything is fine. But there are times when that value has to be reset to true and not false and if I do that in my reset method, I am not able to see of the user unchek the checkbox, because the boolean variable is still true after the form has been posted! No, actually *YOU* are missing the point! Several people have tried to explain how this works to you. So, for one last effort IMPORTANT DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO TRUE IN THE RESET METHOD! /IMPORTANT If you want the field to be true when the page is rendered, set it to true from your action class, NOT in the reset of your formbean. I hope that clears it up for you. BTJ On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote: [EMAIL PROTECTED] | Yes, but to clarify... | I am showing a jsp page with values read from a database. If the | checkbox value is true, how do I then make the checkbox on my jsp-page | checked and how do I then find out if the checkbox has been unchecked? | Do I have to manually read the posted data and see if the checkbox | attribute is missing or is there a better way? I assume that you are using an Action with an ActionForm. To make the value of the checkbox come up correctly, import struts tags into your jsp-page: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=strb % %@ taglib uri=/WEB-INF/struts-html.tld prefix=strh % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=strl % Then use the Struts checkbox tag: strh:checkbox property=done/ Assuming that your form has the methods getDone and setDone, these methods will be used to render the value of the checkbox correctly. As to the question of boolean values that are set to false by the user: You don't have to parse the posted data manually. The method reset() in ActionForm is run before the posted data is used to populate the form. Write your own reset() method where you set the boolean fields to false. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkbox problem?
public ... execute (..., , ) { BeanUtils.setProperty(actionForm, checkboxPropertyName, true ) } or something similar, I believe. -Josh -Original Message- From: Bjørn T Johansen [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 3:38 PM To: Struts Users Mailing List Subject: Re: Checkbox problem? oki, maybe my explanation isn't the best :) (I know that I can't do it in the reset method, as it is clearly not working) but I am still not sure where to put the code to set the checkbox to true then. As far as I know, the action class isn't called before after the form bean has called the reset method and the page has been rendered (and the submit button has been pressed), or is it something I am missing? BTJ On Tue, 2003-06-10 at 20:28, James Mitchell wrote: On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote: You are missing my point! If I just could set the checkbox value to false in the reset method, everything is fine. But there are times when that value has to be reset to true and not false and if I do that in my reset method, I am not able to see of the user unchek the checkbox, because the boolean variable is still true after the form has been posted! No, actually *YOU* are missing the point! Several people have tried to explain how this works to you. So, for one last effort IMPORTANT DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO TRUE IN THE RESET METHOD! /IMPORTANT If you want the field to be true when the page is rendered, set it to true from your action class, NOT in the reset of your formbean. I hope that clears it up for you. BTJ On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote: [EMAIL PROTECTED] | Yes, but to clarify... | I am showing a jsp page with values read from a database. If the | checkbox value is true, how do I then make the checkbox on my jsp-page | checked and how do I then find out if the checkbox has been unchecked? | Do I have to manually read the posted data and see if the checkbox | attribute is missing or is there a better way? I assume that you are using an Action with an ActionForm. To make the value of the checkbox come up correctly, import struts tags into your jsp-page: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=strb % %@ taglib uri=/WEB-INF/struts-html.tld prefix=strh % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=strl % Then use the Struts checkbox tag: strh:checkbox property=done/ Assuming that your form has the methods getDone and setDone, these methods will be used to render the value of the checkbox correctly. As to the question of boolean values that are set to false by the user: You don't have to parse the posted data manually. The method reset() in ActionForm is run before the posted data is used to populate the form. Write your own reset() method where you set the boolean fields to false. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Checkbox problem?
You can pre-populate the form in a previous action. Here is an example. http://jakarta.apache.org/struts/faqs/newbie.html#prepopulate -Kevin --- Bjørn T Johansen [EMAIL PROTECTED] wrote: oki, maybe my explanation isn't the best :) (I know that I can't do it in the reset method, as it is clearly not working) but I am still not sure where to put the code to set the checkbox to true then. As far as I know, the action class isn't called before after the form bean has called the reset method and the page has been rendered (and the submit button has been pressed), or is it something I am missing? BTJ On Tue, 2003-06-10 at 20:28, James Mitchell wrote: On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote: You are missing my point! If I just could set the checkbox value to false in the reset method, everything is fine. But there are times when that value has to be reset to true and not false and if I do that in my reset method, I am not able to see of the user unchek the checkbox, because the boolean variable is still true after the form has been posted! No, actually *YOU* are missing the point! Several people have tried to explain how this works to you. So, for one last effort IMPORTANT DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO TRUE IN THE RESET METHOD! /IMPORTANT If you want the field to be true when the page is rendered, set it to true from your action class, NOT in the reset of your formbean. I hope that clears it up for you. BTJ On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote: [EMAIL PROTECTED] | Yes, but to clarify... | I am showing a jsp page with values read from a database. If the | checkbox value is true, how do I then make the checkbox on my jsp-page | checked and how do I then find out if the checkbox has been unchecked? | Do I have to manually read the posted data and see if the checkbox | attribute is missing or is there a better way? I assume that you are using an Action with an ActionForm. To make the value of the checkbox come up correctly, import struts tags into your jsp-page: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=strb % %@ taglib uri=/WEB-INF/struts-html.tld prefix=strh % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=strl % Then use the Struts checkbox tag: strh:checkbox property=done/ Assuming that your form has the methods getDone and setDone, these methods will be used to render the value of the checkbox correctly. As to the question of boolean values that are set to false by the user: You don't have to parse the posted data manually. The method reset() in ActionForm is run before the posted data is used to populate the form. Write your own reset() method where you set the boolean fields to false. - 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: Checkbox problem?
Generally, a good strategy is to have a prepare action and a process action. Your prepare action is where you would set your boolean form properties. You then forward to the JSP, which renders the checkboxes. The process action (from submitting the form) will determine whether the checkboxes are set or not. -Original Message- From: Bjørn T Johansen [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 12:38 PM To: Struts Users Mailing List Subject: Re: Checkbox problem? oki, maybe my explanation isn't the best :) (I know that I can't do it in the reset method, as it is clearly not working) but I am still not sure where to put the code to set the checkbox to true then. As far as I know, the action class isn't called before after the form bean has called the reset method and the page has been rendered (and the submit button has been pressed), or is it something I am missing? BTJ On Tue, 2003-06-10 at 20:28, James Mitchell wrote: On Tuesday 10 June 2003 14:11, Bjørn T Johansen wrote: You are missing my point! If I just could set the checkbox value to false in the reset method, everything is fine. But there are times when that value has to be reset to true and not false and if I do that in my reset method, I am not able to see of the user unchek the checkbox, because the boolean variable is still true after the form has been posted! No, actually *YOU* are missing the point! Several people have tried to explain how this works to you. So, for one last effort IMPORTANT DO *NOT* SET THE FIELDS YOU INTENT TO USE AS CHECKBOXES (booleans) TO TRUE IN THE RESET METHOD! /IMPORTANT If you want the field to be true when the page is rendered, set it to true from your action class, NOT in the reset of your formbean. I hope that clears it up for you. BTJ On Tue, 2003-06-10 at 19:22, Tor Henrik Hanken wrote: [EMAIL PROTECTED] | Yes, but to clarify... | I am showing a jsp page with values read from a database. If the | checkbox value is true, how do I then make the checkbox on my jsp- page | checked and how do I then find out if the checkbox has been unchecked? | Do I have to manually read the posted data and see if the checkbox | attribute is missing or is there a better way? I assume that you are using an Action with an ActionForm. To make the value of the checkbox come up correctly, import struts tags into your jsp-page: %@ taglib uri=/WEB-INF/struts-bean.tld prefix=strb % %@ taglib uri=/WEB-INF/struts-html.tld prefix=strh % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=strl % Then use the Struts checkbox tag: strh:checkbox property=done/ Assuming that your form has the methods getDone and setDone, these methods will be used to render the value of the checkbox correctly. As to the question of boolean values that are set to false by the user: You don't have to parse the posted data manually. The method reset() in ActionForm is run before the posted data is used to populate the form. Write your own reset() method where you set the boolean fields to false. - 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: Checkbox problem?
The suggested method requires two actions. SetupAction - Form - ProcessAction The first action prepares any values required by your form, including setting the value of your checkboxes to true. The second action is the one that actually processes the user input gathered by the form. Hope this clarifies things. Steve -Original Message- From: Bjørn T Johansen [mailto:[EMAIL PROTECTED] Sent: June 10, 2003 12:38 PM To: Struts Users Mailing List Subject: Re: Checkbox problem? oki, maybe my explanation isn't the best :) (I know that I can't do it in the reset method, as it is clearly not working) but I am still not sure where to put the code to set the checkbox to true then. As far as I know, the action class isn't called before after the form bean has called the reset method and the page has been rendered (and the submit button has been pressed), or is it something I am missing? BTJ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkbox problem?
Steve wrote: The suggested method requires two actions. SetupAction - Form - ProcessAction The first action prepares any values required by your form, including setting the value of your checkboxes to true. The second action is the one that actually processes the user input gathered by the form. Not necessarily two Actions... I use LookupDispatchAction with a request parameter to control which method should be called. -- Wendy Smoak
RE: Checkbox
thanx. I have to set the value of the checkbox in the JSP. for this I write html:checkbox property='primKey value=val/ problem is that the value is dynamic, so I have to use something like value=%=val% but this is scripting ... :-( use of bean:write fails to render the checkbox. Do I have any other option. -Original Message- From: Carl Walker [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 4:42 PM To: Struts Users Mailing List Subject: Re: Checkbox You should use a java.lang.String or java.lang.String[] property if you want to have 'abc' submitted when checkbox 'chk' is checked. If you want 'true' to be sent when 'chk' is checked, then change 'abc' to 'true'. Take a look at this example for additional guidance %-- FILE checkForm.jsp --% %@ taglib prefix=html uri=/WEB-INF/struts-html.tld % html:html body h1checkForm/h1 html:form action=/check.do pDo you like soda?/p html:checkbox property=likesSoda value=trueYes/html:checkboxbr pIf you like soda (or were forced to drink one) what would you drink?/p html:checkbox property=sodas value=cokeCoke/html:checkboxbr html:checkbox property=sodas value=pepsiPepsi/html:checkboxbr html:checkbox property=sodas value=7-up7-up/html:checkboxbr html:submit value=Submit / /html:form /body /html:html %-- END FILE checkForm.jsp --% %-- FILE check.jsp --% %@ page import=java.util.* % %@ taglib prefix=logic uri=/WEB-INF/struts-logic.tld % %@ taglib prefix=bean uri=/WEB-INF/struts-bean.tld % html body h1check/h1 bean:define id=likesSoda name=SodaForm property=likesSoda / pLikes soda?: bean:write name=likesSoda //p pPreferred sodas:/p bean:define id=sodas name=SodaForm property=sodas / logic:iterate id=soda name=sodas bean:write name=soda /br /logic:iterate /ul /body /html %-- END FILE check.jsp --% Put these in your struts-config.xml (in the appropriate sections). form-bean name=SodaForm type=org.apache.struts.action.DynaActionForm form-property name=likesSoda type=java.lang.Boolean initial=false/ form-property name=sodas type=java.lang.String[] / /form-bean action path=/checkForm forward=/checkForm.jsp / action path=/check name=SodaForm scope=request forward=/check.jsp / FILE Abhinav (Cognizant) wrote: This one is not getting into my head .. html:checkbox property=chk value=abc / and in the form bean boolean getChk(), void setChk(boolean) checkbox is checked and form is submitted. how do I retreieve the value abc Thanx. Name: InterScan_SafeStamp.txt InterScan_SafeStamp.txtType: Plain Text (text/plain) Encoding: 7bit Name: InterScan_Disclaimer.txt InterScan_Disclaimer.txtType: Plain Text (text/plain) Encoding: 7bit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** Message from InterScan E-Mail VirusWall NT ** ** No virus found in attached file noname.htm No Virus detected in the attached file(s). * End of message *** This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkbox
Right, but do not let purity stand in the way of practicality! I simply don't use the Struts tag when setting dynamic values: input type=checkbox name='primKey value=bean:write name=myBean property=val / / which works fine. Mark -Original Message- From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 8:55 AM To: Struts Users Mailing List Subject: RE: Checkbox thanx. I have to set the value of the checkbox in the JSP. for this I write html:checkbox property='primKey value=val/ problem is that the value is dynamic, so I have to use something like value=%=val% but this is scripting ... :-( use of bean:write fails to render the checkbox. Do I have any other option. -Original Message- From: Carl Walker [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 4:42 PM To: Struts Users Mailing List Subject: Re: Checkbox You should use a java.lang.String or java.lang.String[] property if you want to have 'abc' submitted when checkbox 'chk' is checked. If you want 'true' to be sent when 'chk' is checked, then change 'abc' to 'true'. Take a look at this example for additional guidance %-- FILE checkForm.jsp --% %@ taglib prefix=html uri=/WEB-INF/struts-html.tld % html:html body h1checkForm/h1 html:form action=/check.do pDo you like soda?/p html:checkbox property=likesSoda value=trueYes/html:checkboxbr pIf you like soda (or were forced to drink one) what would you drink?/p html:checkbox property=sodas value=cokeCoke/html:checkboxbr html:checkbox property=sodas value=pepsiPepsi/html:checkboxbr html:checkbox property=sodas value=7-up7-up/html:checkboxbr html:submit value=Submit / /html:form /body /html:html %-- END FILE checkForm.jsp --% %-- FILE check.jsp --% %@ page import=java.util.* % %@ taglib prefix=logic uri=/WEB-INF/struts-logic.tld % %@ taglib prefix=bean uri=/WEB-INF/struts-bean.tld % html body h1check/h1 bean:define id=likesSoda name=SodaForm property=likesSoda / pLikes soda?: bean:write name=likesSoda //p pPreferred sodas:/p bean:define id=sodas name=SodaForm property=sodas / logic:iterate id=soda name=sodas bean:write name=soda /br /logic:iterate /ul /body /html %-- END FILE check.jsp --% Put these in your struts-config.xml (in the appropriate sections). form-bean name=SodaForm type=org.apache.struts.action.DynaActionForm form-property name=likesSoda type=java.lang.Boolean initial=false/ form-property name=sodas type=java.lang.String[] / /form-bean action path=/checkForm forward=/checkForm.jsp / action path=/check name=SodaForm scope=request forward=/check.jsp / FILE Abhinav (Cognizant) wrote: This one is not getting into my head .. html:checkbox property=chk value=abc / and in the form bean boolean getChk(), void setChk(boolean) checkbox is checked and form is submitted. how do I retreieve the value abc Thanx. Name: InterScan_SafeStamp.txt InterScan_SafeStamp.txtType: Plain Text (text/plain) Encoding: 7bit Name: InterScan_Disclaimer.txt InterScan_Disclaimer.txtType: Plain Text (text/plain) Encoding: 7bit - 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: Checkbox ????
I had some issues with this method, so I came up with something else that works very nicely. In the JSP, right after the code for the checkbox, use: jsp:setProperty name=beanName property=checkboxProperty value=false / This works very nicely, regardless of the scope that the bean is in. However, I am no expert with this stuff, so if there is any reason not to do this I'd be interested in hearing it. - Keith www.buffalo.edu/~kkamholz -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 8:18 AM To: Struts Users Mailing List Subject: RE: Checkbox The value is what is submitted for the checkbox if the checkbox is a checked checkbox. For example: if your form has a string property named foo, and your checkbox's value is bob, then if you check the checkbox and submit, form.getFoo() will return bob. If you dont check the checkbox and submit, NOTHING is submitted (not a null, not an empty string, nothing!) - so setFoo() is NOT called and if its value was bob it will STAY bob. Note that if you are using a request scoped actionForm you probably wont notice this as a problem as you will get a new form instance each submit anyway. Of course if you set foo to bob in your reset, then the checkbox will display as checked, BUT if you uncheck it and submit, nothing is submitted, so the value will still be bob in the form... The place to preset values for your checkbox is in the action you go through before going to the view, and your reset method should should set the value for foo to unbob or false (if you use a boolean property) or false or whatever so that unchecked boxes can be detected by your code. (For various reasons its recommended to preceed all views with an action - even if its a no-op action - instead of linking directly to the jsp) -Original Message- From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Thursday, 29 May 2003 20:00 To: Struts Users Mailing List Subject: Checkbox The documentation says : You must set the boolean property to false in the reset method of ActionForm. What does it mean. Browser will only submit those checkboxes which are checked. And what is the significance of 'value' attribute of the checkbox thus generated given that it has one of {on, off}. I have to show a checkbox prechecked when the page loads. How can I do that. The checkbox value has no influence on it. Thanx. - 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: Checkbox ????
This one is not getting into my head .. html:checkbox property=chk value=abc / and in the form bean boolean getChk(), void setChk(boolean) checkbox is checked and form is submitted. how do I retreieve the value abc Thanx. -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 5:48 PM To: Struts Users Mailing List Subject: RE: Checkbox The value is what is submitted for the checkbox if the checkbox is a checked checkbox. For example: if your form has a string property named foo, and your checkbox's value is bob, then if you check the checkbox and submit, form.getFoo() will return bob. If you dont check the checkbox and submit, NOTHING is submitted (not a null, not an empty string, nothing!) - so setFoo() is NOT called and if its value was bob it will STAY bob. Note that if you are using a request scoped actionForm you probably wont notice this as a problem as you will get a new form instance each submit anyway. Of course if you set foo to bob in your reset, then the checkbox will display as checked, BUT if you uncheck it and submit, nothing is submitted, so the value will still be bob in the form... The place to preset values for your checkbox is in the action you go through before going to the view, and your reset method should should set the value for foo to unbob or false (if you use a boolean property) or false or whatever so that unchecked boxes can be detected by your code. (For various reasons its recommended to preceed all views with an action - even if its a no-op action - instead of linking directly to the jsp) -Original Message- From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Thursday, 29 May 2003 20:00 To: Struts Users Mailing List Subject: Checkbox The documentation says : You must set the boolean property to false in the reset method of ActionForm. What does it mean. Browser will only submit those checkboxes which are checked. And what is the significance of 'value' attribute of the checkbox thus generated given that it has one of {on, off}. I have to show a checkbox prechecked when the page loads. How can I do that. The checkbox value has no influence on it. Thanx. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** Message from InterScan E-Mail VirusWall NT ** ** No virus found in attached file noname.htm No Virus detected in the attached file(s). * End of message *** This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Checkbox
You should use a java.lang.String or java.lang.String[] property if you want to have 'abc' submitted when checkbox 'chk' is checked. If you want 'true' to be sent when 'chk' is checked, then change 'abc' to 'true'. Take a look at this example for additional guidance %-- FILE checkForm.jsp --% %@ taglib prefix=html uri=/WEB-INF/struts-html.tld % html:html body h1checkForm/h1 html:form action=/check.do pDo you like soda?/p html:checkbox property=likesSoda value=trueYes/html:checkboxbr pIf you like soda (or were forced to drink one) what would you drink?/p html:checkbox property=sodas value=cokeCoke/html:checkboxbr html:checkbox property=sodas value=pepsiPepsi/html:checkboxbr html:checkbox property=sodas value=7-up7-up/html:checkboxbr html:submit value=Submit / /html:form /body /html:html %-- END FILE checkForm.jsp --% %-- FILE check.jsp --% %@ page import=java.util.* % %@ taglib prefix=logic uri=/WEB-INF/struts-logic.tld % %@ taglib prefix=bean uri=/WEB-INF/struts-bean.tld % html body h1check/h1 bean:define id=likesSoda name=SodaForm property=likesSoda / pLikes soda?: bean:write name=likesSoda //p pPreferred sodas:/p bean:define id=sodas name=SodaForm property=sodas / logic:iterate id=soda name=sodas bean:write name=soda /br /logic:iterate /ul /body /html %-- END FILE check.jsp --% Put these in your struts-config.xml (in the appropriate sections). form-bean name=SodaForm type=org.apache.struts.action.DynaActionForm form-property name=likesSoda type=java.lang.Boolean initial=false/ form-property name=sodas type=java.lang.String[] / /form-bean action path=/checkForm forward=/checkForm.jsp / action path=/check name=SodaForm scope=request forward=/check.jsp / FILE Abhinav (Cognizant) wrote: This one is not getting into my head .. html:checkbox property=chk value=abc / and in the form bean boolean getChk(), void setChk(boolean) checkbox is checked and form is submitted. how do I retreieve the value abc Thanx. Name: InterScan_SafeStamp.txt InterScan_SafeStamp.txtType: Plain Text (text/plain) Encoding: 7bit Name: InterScan_Disclaimer.txt InterScan_Disclaimer.txtType: Plain Text (text/plain) Encoding: 7bit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkbox
By default, a boolean checkbox returns ON when checked, nothing when not (so you have to initialize and reset it to false in your ActionForm). If you want a value to be sent when checked, change the checkbox's type to String. Mark -Original Message- From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 6:55 AM To: Struts Users Mailing List Subject: Checkbox This one is not getting into my head .. html:checkbox property=chk value=abc / and in the form bean boolean getChk(), void setChk(boolean) checkbox is checked and form is submitted. how do I retreieve the value abc Thanx. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkbox ????
The value is what is submitted for the checkbox if the checkbox is a checked checkbox. For example: if your form has a string property named foo, and your checkbox's value is bob, then if you check the checkbox and submit, form.getFoo() will return bob. If you dont check the checkbox and submit, NOTHING is submitted (not a null, not an empty string, nothing!) - so setFoo() is NOT called and if its value was bob it will STAY bob. Note that if you are using a request scoped actionForm you probably wont notice this as a problem as you will get a new form instance each submit anyway. Of course if you set foo to bob in your reset, then the checkbox will display as checked, BUT if you uncheck it and submit, nothing is submitted, so the value will still be bob in the form... The place to preset values for your checkbox is in the action you go through before going to the view, and your reset method should should set the value for foo to unbob or false (if you use a boolean property) or false or whatever so that unchecked boxes can be detected by your code. (For various reasons its recommended to preceed all views with an action - even if its a no-op action - instead of linking directly to the jsp) -Original Message- From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Thursday, 29 May 2003 20:00 To: Struts Users Mailing List Subject: Checkbox The documentation says : You must set the boolean property to false in the reset method of ActionForm. What does it mean. Browser will only submit those checkboxes which are checked. And what is the significance of 'value' attribute of the checkbox thus generated given that it has one of {on, off}. I have to show a checkbox prechecked when the page loads. How can I do that. The checkbox value has no influence on it. Thanx. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: checkbox
Richard Raquepo írta: is there a maximum # of checkbox that a user can only select... i have a least 500 checkboxes when i all of them is check submit won't work but checking say sumthing around 200 chekboxes , submit will work? No, but there is a limitation of max length (around 2000, not sure) of the GET URL in IE. So if you have a plenty of input fields, you can easily reach this length. Try to use POST instead. Hth, Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox
I was under the impression the max length of a get url was much lower (as far as the spec goes - although I believe IE and Mozilla both support longer ones than the minumum the spec mandates). Dont have the figures though :-( -Original Message- From: Gemes Tibor [mailto:[EMAIL PROTECTED] Sent: Thursday, 3 April 2003 18:57 To: Struts Users Mailing List Subject: Re: checkbox Richard Raquepo írta: is there a maximum # of checkbox that a user can only select... i have a least 500 checkboxes when i all of them is check submit won't work but checking say sumthing around 200 chekboxes , submit will work? No, but there is a limitation of max length (around 2000, not sure) of the GET URL in IE. So if you have a plenty of input fields, you can easily reach this length. Try to use POST instead. Hth, Tib - 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: checkbox
Andrew Hill írta: I was under the impression the max length of a get url was much lower (as far as the spec goes - although I believe IE and Mozilla both support longer ones than the minumum the spec mandates). Dont have the figures though :-( Ok I looked it up: The HTTP 1.1 (RFC2068) does not explicitly limit the length of the URL to anything. The length of a URL is unbounded. Most versions of Internet Explorer have a well defined hard limit of 2083 characters for the length of the URL. Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox
Thanks for clarrifying that. URL limitations are a micro$oft 'feature' eh? Why am I not surprised? ;- -Original Message- From: Gemes Tibor [mailto:[EMAIL PROTECTED] Sent: Thursday, 3 April 2003 19:16 To: Struts Users Mailing List Subject: Re: checkbox Andrew Hill írta: I was under the impression the max length of a get url was much lower (as far as the spec goes - although I believe IE and Mozilla both support longer ones than the minumum the spec mandates). Dont have the figures though :-( Ok I looked it up: The HTTP 1.1 (RFC2068) does not explicitly limit the length of the URL to anything. The length of a URL is unbounded. Most versions of Internet Explorer have a well defined hard limit of 2083 characters for the length of the URL. Tib - 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: checkbox
All this is fine and dandy but isn't form-submission typically a POST operation? If you use html:form the default is POST. Sri -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2003 6:34 AM To: Struts Users Mailing List Subject: RE: checkbox Thanks for clarrifying that. URL limitations are a micro$oft 'feature' eh? Why am I not surprised? ;- -Original Message- From: Gemes Tibor [mailto:[EMAIL PROTECTED] Sent: Thursday, 3 April 2003 19:16 To: Struts Users Mailing List Subject: Re: checkbox Andrew Hill írta: I was under the impression the max length of a get url was much lower (as far as the spec goes - although I believe IE and Mozilla both support longer ones than the minumum the spec mandates). Dont have the figures though :-( Ok I looked it up: The HTTP 1.1 (RFC2068) does not explicitly limit the length of the URL to anything. The length of a URL is unbounded. Most versions of Internet Explorer have a well defined hard limit of 2083 characters for the length of the URL. Tib - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: checkbox
I think your issue has to do more with design than what you're asking. Is an user interface really useful when there are 200-500 checkboxes to choose from? Maybe not... Try reorganizating your data so that it can be either narrowed down or presented differently, maybe thru a search prior to presentation of the final form. -c - Original Message - From: Richard Raquepo [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, April 03, 2003 5:48 AM Subject: checkbox is there a maximum # of checkbox that a user can only select... i have a least 500 checkboxes when i all of them is check submit won't work but checking say sumthing around 200 chekboxes , submit will work? is there a limitation of html checkox that i'm not aware of... thanks... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: checkbox
Actually it could be more... it's just that a possible search would return one or more records... so i got to be able to process it and show checkboxes... anyways, the problem is in the form method... when you have so many checkboxes you cannot use the method=get since i think the query strings added in the url post is long and the browser is limited. so try using method=post instead... thanks... - Original Message - From: Claude Betancourt [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, April 04, 2003 3:55 AM Subject: Re: checkbox I think your issue has to do more with design than what you're asking. Is an user interface really useful when there are 200-500 checkboxes to choose from? Maybe not... Try reorganizating your data so that it can be either narrowed down or presented differently, maybe thru a search prior to presentation of the final form. -c - Original Message - From: Richard Raquepo [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, April 03, 2003 5:48 AM Subject: checkbox is there a maximum # of checkbox that a user can only select... i have a least 500 checkboxes when i all of them is check submit won't work but checking say sumthing around 200 chekboxes , submit will work? is there a limitation of html checkox that i'm not aware of... thanks... - 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: checkbox
Sri Sankaran írta: All this is fine and dandy but isn't form-submission typically a POST operation? If you use html:form the default is POST. The thead was about what issues should one be aware of using huge amount of checkboxes. This *is* an issue in this case and we clarified it. Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox
Not if you POST it -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, 4 April 2003 15:23 To: [EMAIL PROTECTED] Subject: RE: checkbox Well, I have a health form I am implementing. I plan to have around 75 to 100 checkboxes. Is that too many? -Original Message- From: Gemes Tibor [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 9:04 AM To: Struts Users Mailing List Subject: Re: checkbox Sri Sankaran írta: All this is fine and dandy but isn't form-submission typically a POST operation? If you use html:form the default is POST. The thead was about what issues should one be aware of using huge amount of checkboxes. This *is* an issue in this case and we clarified it. Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - 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: checkbox
[EMAIL PROTECTED] írta: Well, I have a health form I am implementing. I plan to have around 75 to 100 checkboxes. Is that too many? If I were you I'd split it up for about 4-5 pages and max 20 inputs on each. It would make the cliend feel comfortable. But it could work in one page using POST or keeping the URL below 2068. Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox with struts
If you use: html:checkbox property=.. it will automatically put it into the dynaactionform that you set up for the action on submit of the form. -Tim -Original Message- From: Giovanni Di Lembo [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 2:06 PM To: Struts Users Mailing List Subject: checkbox with struts I'd like to pass the value of a checkbox from a jsp to my DynaActionForm...but Actually I don't know how to start. Please help - 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: checkbox and iterate problem
Sorry, my mistake, it is Boolean ActionForm reset method is ((OrderEntryLineItemForm) iterator.next()).setMarkedForRemoval(Boolean.FALSE); jsp is nested:checkbox property=markedForRemoval value=true/ Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 5:51 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I'm afraid you've lost me, I thought the propery HAD to be boolean for a checkbox. Can you please send me a code snippet of what you have working (even if its different then what I am trying to do). High level: I just want to read a list a of strings items from a DB, and then populate a form with the items and let the user select them or not. Thanx Mine is Collection, so I iterate thru the collection and set false (String) to each checked. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 5:20 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I changed everything from boolean (primative) to Boolean (Object type), no difference I still see the same behavior. After submit my setter function is not called. but for a non-indexed checkbox it is called. However the getter() is always called. Neal try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
RE: checkbox and iterate problem
Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox and iterate problem
I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - 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: checkbox and iterate problem
try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - 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: checkbox and iterate problem
I changed everything from boolean (primative) to Boolean (Object type), no difference I still see the same behavior. After submit my setter function is not called. but for a non-indexed checkbox it is called. However the getter() is always called. Neal try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox and iterate problem
Mine is Collection, so I iterate thru the collection and set false (String) to each checked. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 5:20 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I changed everything from boolean (primative) to Boolean (Object type), no difference I still see the same behavior. After submit my setter function is not called. but for a non-indexed checkbox it is called. However the getter() is always called. Neal try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: checkbox and iterate problem
I'm afraid you've lost me, I thought the propery HAD to be boolean for a checkbox. Can you please send me a code snippet of what you have working (even if its different then what I am trying to do). High level: I just want to read a list a of strings items from a DB, and then populate a form with the items and let the user select them or not. Thanx Mine is Collection, so I iterate thru the collection and set false (String) to each checked. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 5:20 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I changed everything from boolean (primative) to Boolean (Object type), no difference I still see the same behavior. After submit my setter function is not called. but for a non-indexed checkbox it is called. However the getter() is always called. Neal try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail
RE: checkbox and iterate problem
I got it working..Thank you for your assistance. I completely rewrote my code, and instead of using indexed=true, I constructed the property inline using %= blah % I'm not sure why I couldn;t get it working the first way, but now it works. Neal Mine is Collection, so I iterate thru the collection and set false (String) to each checked. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Neal [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 5:20 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I changed everything from boolean (primative) to Boolean (Object type), no difference I still see the same behavior. After submit my setter function is not called. but for a non-indexed checkbox it is called. However the getter() is always called. Neal try Boolean.FALSE (Object) instead of false (which is a primitive type). Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 2:04 PM To: [EMAIL PROTECTED] Subject: RE: checkbox and iterate problem I have a Reset method, and I am calling mFolders[i].setChecked(false) for each item in my array. Is that what you mean by setting the default value ? If so, it hasn't fixed my problem. Thanx Have to set default value in reset method. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: February 26, 2003 1:18 PM To: [EMAIL PROTECTED] Subject: checkbox and iterate problem Hi, I'm having a problem with checkboxes and I was hoping someone could help. The short version is: when using logic:iteratate over an array of checkboxes, the setter method is not called after submit Long version I have class CheckableString { String str; boolean checked = false; // etc.. }; I have a Form HostForm extends ActionForm { CheckableString[] mFolders = new CheckableString[100]; public CheckableString getFolder(int n) { System.err.println(HostForm getFolder a + mFolders[n]); return mFolders[n]; } public CheckableString[] getFolder() { System.err.println(HostForm getFolder b + this); for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm getFolder b + mFolders[i]); } return mFolders; } public void setFolder(int n, CheckableString folders) { System.err.println(HostForm setFolder a + folders + + this); mFolders[n] = folders; } public void setFolder(CheckableString[] folders) { System.err.println(HostForm setFolder b + this); mFolders = folders; } public void reset(ActionMapping a, HttpServletRequest b) { System.err.println(HostForm reset + this); flag = false; for (int i = 0; i != mFolders.length; i++) { System.err.println(HostForm reset + mFolders[i]); if (mFolders[i] != null) mFolders[i].setChecked(false); } } } I have an Action class setup the form, populating values from a database, it then forwards to a jsp page html:form .. logic:iterate id=quack name=hostForm property=folder indexId=index logic:present name='quack' tr th align=left html:checkbox indexed='true' value='true' property=checked name='quack' / bean:write name=quack/ bean:write name=index/ /th /tr /logic:present /logic:iterate The form is populated correctly, items marked as true are selected. And looking at the logs the getter function is called The problem is when I submit, the setter function is NEVER called, and the Form is not populated. note: If I have a simple non-indexed checkbox, then that works as expected and the setter is called I am using struts 1.1RC1 Anyone got any ideas ??, I'm stumped Thanks Neal - 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] - 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: Checkbox in a multiple-page form.
Same problem here as well. But in my case the checkbox values are coming from the database. So I can't set all checkbox properties to false in the reset() method. Any solution in mind? Affan - Original Message - From: ROSSEL Olivier [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 07, 2003 3:45 PM Subject: Checkbox in a multiple-page form. I have a form on 3 pages. So my form bean is in session scope. The JSP are as follows: Page1: some text inputs+some checkboxes. Next Page2: more advanced stuff PreviousNext Page3: even more advanced stuff PreviousFinish My problem is the classic problem of checkboxes. I do check some of them on page1. I go to page 2, then to page 3. Then back, back. And guess what? All my checkboxes on page 1 are empty. Of course, they are empty cause I coded that in the reset() method of my form bean: all checkboxes = false. (it's in the FAQ). Well, replacing the value of the checkbox with false seems to have erased the value the user had chosen. I (of course) missed something. Any help? ---cut here--- This e-mail is intended only for the above addressee. It may contain privileged information. If you are not the addressee you must not copy, distribute, disclose or use any of the information in it. If you have received it in error please delete it and immediately notify the sender. Security Notice: all e-mail, sent to or from this address, may be accessed by someone other than the recipient, for system management and security reasons. This access is controlled under Regulation of Investigatory Powers Act 2000, Lawful Business Practises. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Checkbox in a multiple-page form.
Hi, Actually you would have the same problem on pages 2, 3, etc. if there were any checkboxes. we had the same problem and solved it by writing separate reset functions for each page. In the general action forms reset method an additional property (e.g. pageId) of the action form controlls the execution of the correct reset function. The value for the property (pageId) is set by the browse buttons for your pages. In our case we set the property in the action class extened by LookupDispatchAction, so if we pressed the button for Page2 the property pageId is set to page2 and only the reset method of page2 is executed. Hope this helps... Some code snippets: /** * From the action class extended from LookupDispatchAction */ protected Map getKeyMethodMap() { Map map = new HashMap(); System.err.println(Method: getKeyMethodMap); map.put(MyApp.Wizard.Page1.Label, page1); map.put(MyApp.Wizard.Page2.Label, page2); //... and many other button mappings return map; } public ActionForward page1(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.err.println(Method: page1); // get the form MyActionForm f = (MyActionForm)form; f.setPageId(page1); return mapping.findForward(page1); } public ActionForward page2(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.err.println(Method: page2); // get the form MyActionForm f = (MyActionForm )form; f.setPageId(page2); return mapping.findForward(page2); } /** * From the action form extened from ActionForm */ private void reset1(ActionMapping mapping, HttpServletRequest request) { System.err.println(MyWizardForm.reset1); // code to reset the checkboxes of page1... } private void reset2(ActionMapping mapping, HttpServletRequest request) { System.err.println(MyWizardForm.reset2); // code to reset the checkboxes... } public void reset(ActionMapping mapping, HttpServletRequest request) { System.err.println(MyWizardForm.reset (master)); // reset the checkboxes... if (this.pageId.equals(page1)) reset1(mapping, request); if (this.pageId.equals(page2)) reset2(mapping, request); } -Original Message- From: ROSSEL Olivier [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 07, 2003 11:46 AM To: '[EMAIL PROTECTED]' Subject: Checkbox in a multiple-page form. I have a form on 3 pages. So my form bean is in session scope. The JSP are as follows: Page1: some text inputs+some checkboxes. Next Page2: more advanced stuff PreviousNext Page3: even more advanced stuff PreviousFinish My problem is the classic problem of checkboxes. I do check some of them on page1. I go to page 2, then to page 3. Then back, back. And guess what? All my checkboxes on page 1 are empty. Of course, they are empty cause I coded that in the reset() method of my form bean: all checkboxes = false. (it's in the FAQ). Well, replacing the value of the checkbox with false seems to have erased the value the user had chosen. I (of course) missed something. Any help? ---cut here--- This e-mail is intended only for the above addressee. It may contain privileged information. If you are not the addressee you must not copy, distribute, disclose or use any of the information in it. If you have received it in error please delete it and immediately notify the sender. Security Notice: all e-mail, sent to or from this address, may be accessed by someone other than the recipient, for system management and security reasons. This access is controlled under Regulation of Investigatory Powers Act 2000, Lawful Business Practises. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Checkbox in a multiple-page form.
Same problem here as well. But in my case the checkbox values are coming from the database. So I can't set all checkbox properties to false in the reset() method. Any solution in mind? It is quite tricky. In the reset, you must check what's the page where you clicked the submit button. If you clicked the Next button of page 1, then you should reset the checkboxes of page 1. If you come from page 2, then you should do nothing. It works for me (I use a property in the submit buttons , for example moveFromPage1 in the Next button of page 1, moveFromPage2 in the Previous button of page 2). Then I check in my reset method: if (request.getParameter(moveFromPage1) != null) { setCheckboxes(false); } So the behaviour is ok: i click next from page 1: i am redirected to page 2. the reset is done: the checkboxes are reset to false (because i really moveFromPage1) the checkboxes that must be checked, because of the request values, are set to true. or: i click previous from page 2: i am redirected to page 1. the reset is done: the checkboxes are untouched (because i don't moveFromPage1) there are no checkboxes that must be checked (because there are no checkboxes values in the current request : it comes from page 2 which has none). Conclusion: in case 1, we reset() what the FAQ wants to reset(). in case 2, we reset() nothing. Clear? This e-mail is intended only for the above addressee. It may contain privileged information. If you are not the addressee you must not copy, distribute, disclose or use any of the information in it. If you have received it in error please delete it and immediately notify the sender. Security Notice: all e-mail, sent to or from this address, may be accessed by someone other than the recipient, for system management and security reasons. This access is controlled under Regulation of Investigatory Powers Act 2000, Lawful Business Practises. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Checkbox in a multiple-page form.
Hi, Actually you would have the same problem on pages 2, 3, etc. if there were any checkboxes. we had the same problem and solved it by writing separate reset functions for each page. In the general action forms reset method an additional property (e.g. pageId) of the action form controlls the execution of the correct reset function. The value for the property (pageId) is set by the browse buttons for your pages. In our case we set the property in the action class extened by LookupDispatchAction, so if we pressed the button for Page2 the property pageId is set to page2 and only the reset method of page2 is executed. Hope this helps... Really neat solution!!! Thanks a lot. May be Mr Husted should add that one in his tips. This e-mail is intended only for the above addressee. It may contain privileged information. If you are not the addressee you must not copy, distribute, disclose or use any of the information in it. If you have received it in error please delete it and immediately notify the sender. Security Notice: all e-mail, sent to or from this address, may be accessed by someone other than the recipient, for system management and security reasons. This access is controlled under Regulation of Investigatory Powers Act 2000, Lawful Business Practises. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: checkbox problem
may u need to reset the value of the checkbox to (false or true) in the reset method of ur formbean -Original Message- From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann;t-systems.com] Sent: Monday, November 11, 2002 7:00 PM To: '[EMAIL PROTECTED]' Subject: checkbox problem Hello Struts user! I use a html:checkbox for setting a boolean value. But after submit, the boolean value in the form bean isn't set correctly. Do I have to use a String value for that in my form bean? I tried this, but without success. Regards, Bernhard -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: checkbox problem
You need to set it to false in the reset() method. James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org If you were plowing a field, which would you rather use? Two strong oxen or 1024 chickens? - Seymour Cray (1925-1996), father of supercomputing -Original Message- From: Saini, Deepank [mailto:deepank.saini;cgey.com] Sent: Monday, November 11, 2002 8:33 AM To: 'Struts Users Mailing List' Subject: RE: checkbox problem may u need to reset the value of the checkbox to (false or true) in the reset method of ur formbean -Original Message- From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann;t-systems.com] Sent: Monday, November 11, 2002 7:00 PM To: '[EMAIL PROTECTED]' Subject: checkbox problem Hello Struts user! I use a html:checkbox for setting a boolean value. But after submit, the boolean value in the form bean isn't set correctly. Do I have to use a String value for that in my form bean? I tried this, but without success. Regards, Bernhard -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: checkbox problem
if u want uncheck the box, after a submit , set it to false -Original Message- From: James Mitchell [mailto:jmitchtx;telocity.com] Sent: Monday, November 11, 2002 7:06 PM To: Struts Users Mailing List Subject: RE: checkbox problem You need to set it to false in the reset() method. James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org If you were plowing a field, which would you rather use? Two strong oxen or 1024 chickens? - Seymour Cray (1925-1996), father of supercomputing -Original Message- From: Saini, Deepank [mailto:deepank.saini;cgey.com] Sent: Monday, November 11, 2002 8:33 AM To: 'Struts Users Mailing List' Subject: RE: checkbox problem may u need to reset the value of the checkbox to (false or true) in the reset method of ur formbean -Original Message- From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann;t-systems.com] Sent: Monday, November 11, 2002 7:00 PM To: '[EMAIL PROTECTED]' Subject: checkbox problem Hello Struts user! I use a html:checkbox for setting a boolean value. But after submit, the boolean value in the form bean isn't set correctly. Do I have to use a String value for that in my form bean? I tried this, but without success. Regards, Bernhard -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: checkbox problem
well i am not sure why it should show true if it has been unchecked, but one last shot, if u r calling a javascript function on the submit, the problem could well be in the javascript function. Bye the way do u have a submit button or r u caling a javascript function onchange of the checkbox? -Original Message- From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann;t-systems.com] Sent: Monday, November 11, 2002 7:12 PM To: 'Struts Users Mailing List' Subject: AW: checkbox problem Thanks for your comment, but I'm not sure if that's the problem. Here is the scenario: 1.) While populating the form, the value is true. 2.) Then the user disables the checkbox - for setting the value to false. 3.) Submit occurs. 4.) In the action I check the value and I see that it is true. Do I really have to reset the form for such a scenario? Regards, Bernhard -Ursprüngliche Nachricht- Von: James Mitchell [mailto:jmitchtx;telocity.com] Gesendet: Montag, 11. November 2002 14:36 An: Struts Users Mailing List Betreff: RE: checkbox problem You need to set it to false in the reset() method. James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org If you were plowing a field, which would you rather use? Two strong oxen or 1024 chickens? - Seymour Cray (1925-1996), father of supercomputing -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
/ /OREF:CPTD2D27 RE: checkbox problem
This posting is useful for dealing with checkboxes: http://www.mail-archive.com/struts-user;jakarta.apache.org/msg37244.html Saini, Deepank deepank.saini@c To: 'Struts Users Mailing List' [EMAIL PROTECTED] gey.com cc: Subject: RE: checkbox problem 11/11/2002 03:46 PM Please respond to Struts Users Mailing List well i am not sure why it should show true if it has been unchecked, but one last shot, if u r calling a javascript function on the submit, the problem could well be in the javascript function. Bye the way do u have a submit button or r u caling a javascript function onchange of the checkbox? -Original Message- From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann;t-systems.com] Sent: Monday, November 11, 2002 7:12 PM To: 'Struts Users Mailing List' Subject: AW: checkbox problem Thanks for your comment, but I'm not sure if that's the problem. Here is the scenario: 1.) While populating the form, the value is true. 2.) Then the user disables the checkbox - for setting the value to false. 3.) Submit occurs. 4.) In the action I check the value and I see that it is true. Do I really have to reset the form for such a scenario? Regards, Bernhard -Ursprüngliche Nachricht- Von: James Mitchell [mailto:jmitchtx;telocity.com] Gesendet: Montag, 11. November 2002 14:36 An: Struts Users Mailing List Betreff: RE: checkbox problem You need to set it to false in the reset() method. James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org If you were plowing a field, which would you rather use? Two strong oxen or 1024 chickens? - Seymour Cray (1925-1996), father of supercomputing -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: checkbox always checked(help needed)
Sandeep == Sandeep Karnwal Sandeep writes: Sandeep Hi! all Sandeep I am using multibox to display the multiple checkbox. Sandeep By default all checkbox should be checked. I am not able to find any of the Sandeep property of the multibox so that by default all checkbox should be checked. Sandeep What is the property of the multibox so that all check box should be checked Sandeep (when I display first time) or is there other way to do that. The checkbox in a multibox tag will be checked if the value attribute is equal to one of the objects in the collection specified by the bean property. If your page is fronted by an action where you can prepare the actionform in this way, then it will always be checked. -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] ; SCJP -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: checkbox always checked(help needed)
Thanks David This solves my problem. Regards Sandeep -Original Message- From: [EMAIL PROTECTED] [mailto:dmkarr;earthlink.net] Sent: Thursday, November 07, 2002 8:25 PM To: [EMAIL PROTECTED] Subject: Re: checkbox always checked(help needed) Sandeep == Sandeep Karnwal Sandeep writes: Sandeep Hi! all Sandeep I am using multibox to display the multiple checkbox. Sandeep By default all checkbox should be checked. I am not able to find any of the Sandeep property of the multibox so that by default all checkbox should be checked. Sandeep What is the property of the multibox so that all check box should be checked Sandeep (when I display first time) or is there other way to do that. The checkbox in a multibox tag will be checked if the value attribute is equal to one of the objects in the collection specified by the bean property. If your page is fronted by an action where you can prepare the actionform in this way, then it will always be checked. -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] ; SCJP -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: Checkbox problem
I suppose you have several checkboxes corresponding to the List of objects. Are you using the html:multibox tag? If not, you should. The Struts framework will save the selected values in a String array that you provide. The value stored will be the value of the checkbox. For example html:multibox property=selectedItems value=foo/ if the checkbox is selected the array will include the string 'foo'. Have you looked at the html-multibox.jsp that is part of the struts-exercise-taglib application that ships with Struts? Sri -Original Message- From: Kishore, Sahu [mailto:kishores;tanning.com] Sent: Thursday, October 24, 2002 3:19 AM To: '[EMAIL PROTECTED]' Subject: Checkbox problem In my form bean I have an attribute which is an Arraylist of objects who in turn contain many attributes one of which is a string representing a checkbox of my screen. Problem : -When I check anyof the check boxes and proceed to the next screens and comeback again to the screen having the check boxes to uncheck some of the checkboxes which I have checked earlier then it's not getting updated in the form bean. I have taken the default value of the attribute representing the checkbox as false. And when it gets checked I'm making it to True. So any solution? Thanks Kishor -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Checkbox won't stay checked! [ Was: Damn where is bug in mycode???? ]
Karr, David wrote: You might try using a more specific title line. We'd all be better off if you asked a direct question, as opposed to having us scan all of your code for anything that might be wrong. Is this code not working? If not, what is happening? Are you getting any specific error messages? Are you including the correct taglibs on your JSP page, and the correct jar files in your WAR? Note that the html:checkbox tag will only add the 'checked=checked' attribute if the value of your property is true, yes, or on (which has always bothered me somewhat, although I haven't experimented with this enough to figure out what would be a better strategy). If all else fails, it's always handy to have your debugger set up to debug your application, INCLUDING the Struts source code (associated with the release that you're using) so you can see for yourself exactly what decisions are made in the code. +1 - very handy. You have the source, so there's no excuses not to use it! ;-) -- Eddie Bush -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When Ch eckBox is unchecked
This is by design and you will have to write some code to accommodate it. The HTML spec mandates that no request values are passed for unchecked checkboxes, so you will have to keep track of the checkboxes yourself. What I do is type the checkboxes as String rather than boolean in the ActionForm and track true and false through the iterator. Mark -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 7:11 AM To: 'Struts Users Mailing List' Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When Ch eckBox is unchecked Hi, I'm trying to iterate through a Boolean Array using logic:iterate and then display these as check boxes. This works fine, but when submitting the form and resending the Boolean Array back to the Action class, only the values that are true are returned. In the struts documentation it says: WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method. But this only implies for a single property. Is there a workaround or a fix for this? My jsp code: logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=flags name=flags value=on checked=checked /logic:equal logic:notEqual name= flag value=true input type=checkbox id=flags name=flags value=on /logic:notEqual /logic:iterate Cheers, Chico. -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked
For multiple, you also must set values back to false in reset() (The question here of course is which checkbox refers to which element. You may need to refactor such that your checkboxes return non boolean values so you can tell which is which at the server end). The reason for this is that the html spec in all its gory... uh I mean glory... has in its infinite wisdom defined that a checkbox ( radio button I think) that has not been ticked will not submit any value to the server. Afaik same is true for SELECT btw (multiple selections where nothing selected) -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 19:11 To: 'Struts Users Mailing List' Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Hi, I'm trying to iterate through a Boolean Array using logic:iterate and then display these as check boxes. This works fine, but when submitting the form and resending the Boolean Array back to the Action class, only the values that are true are returned. In the struts documentation it says: WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method. But this only implies for a single property. Is there a workaround or a fix for this? My jsp code: logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=flags name=flags value=on checked=checked /logic:equal logic:notEqual name= flag value=true input type=checkbox id=flags name=flags value=on /logic:notEqual /logic:iterate Cheers, Chico. -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n CheckBox is unchecked
If that is the case, then why does it work with single boolean properties? I only get this problem when working with an array. Chico -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: 04 October 2002 13:12 To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n Ch eckBox is unchecked This is by design and you will have to write some code to accommodate it. The HTML spec mandates that no request values are passed for unchecked checkboxes, so you will have to keep track of the checkboxes yourself. What I do is type the checkboxes as String rather than boolean in the ActionForm and track true and false through the iterator. Mark -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 7:11 AM To: 'Struts Users Mailing List' Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When Ch eckBox is unchecked Hi, I'm trying to iterate through a Boolean Array using logic:iterate and then display these as check boxes. This works fine, but when submitting the form and resending the Boolean Array back to the Action class, only the values that are true are returned. In the struts documentation it says: WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method. But this only implies for a single property. Is there a workaround or a fix for this? My jsp code: logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=flags name=flags value=on checked=checked /logic:equal logic:notEqual name= flag value=true input type=checkbox id=flags name=flags value=on /logic:notEqual /logic:iterate Cheers, Chico. -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked
Hey man! RU refactoring my messages? ;-) -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 8:17 AM To: Struts Users Mailing List Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked For multiple, you also must set values back to false in reset() (The question here of course is which checkbox refers to which element. You may need to refactor such that your checkboxes return non boolean values so you can tell which is which at the server end). The reason for this is that the html spec in all its gory... uh I mean glory... has in its infinite wisdom defined that a checkbox ( radio button I think) that has not been ticked will not submit any value to the server. Afaik same is true for SELECT btw (multiple selections where nothing selected) -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 19:11 To: 'Struts Users Mailing List' Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Hi, I'm trying to iterate through a Boolean Array using logic:iterate and then display these as check boxes. This works fine, but when submitting the form and resending the Boolean Array back to the Action class, only the values that are true are returned. In the struts documentation it says: WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method. But this only implies for a single property. Is there a workaround or a fix for this? My jsp code: logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=flags name=flags value=on checked=checked /logic:equal logic:notEqual name= flag value=true input type=checkbox id=flags name=flags value=on /logic:notEqual /logic:iterate Cheers, Chico. -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n CheckBox is unchecked
I'm not sure what you mean. If a checkbox or radio button is not checked, it has NO state. This means boolean false is never passed. Only boolean trues are passed in the request object. If you are defining individual objects as boolean in your ActionForm, the JVM assigns their state to false by default, so any individual object that is passed in the request object will be true and change the state accordingly. It may look like your form is setting your ActionForm booleans to false, but it is not - the JVM is. This is why it won't work with an array - the JVM sets arrays to null by default. Mark -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 8:18 AM To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n CheckBox is unchecked If that is the case, then why does it work with single boolean properties? I only get this problem when working with an array. Chico -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: 04 October 2002 13:12 To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n Ch eckBox is unchecked This is by design and you will have to write some code to accommodate it. The HTML spec mandates that no request values are passed for unchecked checkboxes, so you will have to keep track of the checkboxes yourself. What I do is type the checkboxes as String rather than boolean in the ActionForm and track true and false through the iterator. Mark -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 7:11 AM To: 'Struts Users Mailing List' Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When Ch eckBox is unchecked Hi, I'm trying to iterate through a Boolean Array using logic:iterate and then display these as check boxes. This works fine, but when submitting the form and resending the Boolean Array back to the Action class, only the values that are true are returned. In the struts documentation it says: WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method. But this only implies for a single property. Is there a workaround or a fix for this? My jsp code: logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=flags name=flags value=on checked=checked /logic:equal logic:notEqual name= flag value=true input type=checkbox id=flags name=flags value=on /logic:notEqual /logic:iterate Cheers, Chico. -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n CheckBox is unchecked
Yeah of course I gotcha now ... Cheers chico -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: 04 October 2002 13:26 To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n CheckBox is unchecked I'm not sure what you mean. If a checkbox or radio button is not checked, it has NO state. This means boolean false is never passed. Only boolean trues are passed in the request object. If you are defining individual objects as boolean in your ActionForm, the JVM assigns their state to false by default, so any individual object that is passed in the request object will be true and change the state accordingly. It may look like your form is setting your ActionForm booleans to false, but it is not - the JVM is. This is why it won't work with an array - the JVM sets arrays to null by default. Mark -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 8:18 AM To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n CheckBox is unchecked If that is the case, then why does it work with single boolean properties? I only get this problem when working with an array. Chico -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: 04 October 2002 13:12 To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n Ch eckBox is unchecked This is by design and you will have to write some code to accommodate it. The HTML spec mandates that no request values are passed for unchecked checkboxes, so you will have to keep track of the checkboxes yourself. What I do is type the checkboxes as String rather than boolean in the ActionForm and track true and false through the iterator. Mark -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 7:11 AM To: 'Struts Users Mailing List' Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When Ch eckBox is unchecked Hi, I'm trying to iterate through a Boolean Array using logic:iterate and then display these as check boxes. This works fine, but when submitting the form and resending the Boolean Array back to the Action class, only the values that are true are returned. In the struts documentation it says: WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method. But this only implies for a single property. Is there a workaround or a fix for this? My jsp code: logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=flags name=flags value=on checked=checked /logic:equal logic:notEqual name= flag value=true input type=checkbox id=flags name=flags value=on /logic:notEqual /logic:iterate Cheers, Chico. -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked
Wrote it before I read yours. Just had a beer and a GT so my telepathic powers must have come online as a result ;-) Ahhh... I do so love Fridays. -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 20:21 To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Hey man! RU refactoring my messages? ;-) -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 8:17 AM To: Struts Users Mailing List Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked For multiple, you also must set values back to false in reset() (The question here of course is which checkbox refers to which element. You may need to refactor such that your checkboxes return non boolean values so you can tell which is which at the server end). The reason for this is that the html spec in all its gory... uh I mean glory... has in its infinite wisdom defined that a checkbox ( radio button I think) that has not been ticked will not submit any value to the server. Afaik same is true for SELECT btw (multiple selections where nothing selected) -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 19:11 To: 'Struts Users Mailing List' Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Hi, I'm trying to iterate through a Boolean Array using logic:iterate and then display these as check boxes. This works fine, but when submitting the form and resending the Boolean Array back to the Action class, only the values that are true are returned. In the struts documentation it says: WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method. But this only implies for a single property. Is there a workaround or a fix for this? My jsp code: logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=flags name=flags value=on checked=checked /logic:equal logic:notEqual name= flag value=true input type=checkbox id=flags name=flags value=on /logic:notEqual /logic:iterate Cheers, Chico. -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked
Sorted!! Got a String[] (checkboxes), and when form is submitted the positions of the checked checkboxes are sent in this array ... % int i = 0; % logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=checkboxes name=checkboxes value=%=new Integer(i).toString()% checked=checked /logic:equal logic:notEqual name=flag value=true input type=checkbox id=checkboxes name=checkboxes value=%=new Integer(i).toString()% /logic:notEqual % i++; % /logic:iterate Cheers, Chico. Ps. U guys r nutz, leave the telepathic powers at home!! -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: 04 October 2002 13:42 To: Struts Users Mailing List Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Wrote it before I read yours. Just had a beer and a GT so my telepathic powers must have come online as a result ;-) Ahhh... I do so love Fridays. -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 20:21 To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Hey man! RU refactoring my messages? ;-) -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 8:17 AM To: Struts Users Mailing List Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked For multiple, you also must set values back to false in reset() (The question here of course is which checkbox refers to which element. You may need to refactor such that your checkboxes return non boolean values so you can tell which is which at the server end). The reason for this is that the html spec in all its gory... uh I mean glory... has in its infinite wisdom defined that a checkbox ( radio button I think) that has not been ticked will not submit any value to the server. Afaik same is true for SELECT btw (multiple selections where nothing selected) -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 19:11 To: 'Struts Users Mailing List' Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Hi, I'm trying to iterate through a Boolean Array using logic:iterate and then display these as check boxes. This works fine, but when submitting the form and resending the Boolean Array back to the Action class, only the values that are true are returned. In the struts documentation it says: WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method. But this only implies for a single property. Is there a workaround or a fix for this? My jsp code: logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=flags name=flags value=on checked=checked /logic:equal logic:notEqual name= flag value=true input type=checkbox id=flags name=flags value=on /logic:notEqual /logic:iterate Cheers, Chico. -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n CheckBox is unchecked
And the crowd roars!!! -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 8:56 AM To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted Whe n CheckBox is unchecked Sorted!! Got a String[] (checkboxes), and when form is submitted the positions of the checked checkboxes are sent in this array ... % int i = 0; % logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=checkboxes name=checkboxes value=%=new Integer(i).toString()% checked=checked /logic:equal logic:notEqual name=flag value=true input type=checkbox id=checkboxes name=checkboxes value=%=new Integer(i).toString()% /logic:notEqual % i++; % /logic:iterate Cheers, Chico. Ps. U guys r nutz, leave the telepathic powers at home!! -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: 04 October 2002 13:42 To: Struts Users Mailing List Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Wrote it before I read yours. Just had a beer and a GT so my telepathic powers must have come online as a result ;-) Ahhh... I do so love Fridays. -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 20:21 To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Hey man! RU refactoring my messages? ;-) -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 8:17 AM To: Struts Users Mailing List Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked For multiple, you also must set values back to false in reset() (The question here of course is which checkbox refers to which element. You may need to refactor such that your checkboxes return non boolean values so you can tell which is which at the server end). The reason for this is that the html spec in all its gory... uh I mean glory... has in its infinite wisdom defined that a checkbox ( radio button I think) that has not been ticked will not submit any value to the server. Afaik same is true for SELECT btw (multiple selections where nothing selected) -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 19:11 To: 'Struts Users Mailing List' Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Hi, I'm trying to iterate through a Boolean Array using logic:iterate and then display these as check boxes. This works fine, but when submitting the form and resending the Boolean Array back to the Action class, only the values that are true are returned. In the struts documentation it says: WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method. But this only implies for a single property. Is there a workaround or a fix for this? My jsp code: logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=flags name=flags value=on checked=checked /logic:equal logic:notEqual name= flag value=true input type=checkbox id=flags name=flags value=on /logic:notEqual /logic:iterate Cheers, Chico. -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked
Hehe. Glad to here you got it going. :-) Speaking of going, Im going home, and taking my telepathic powers with me. (Which Im sure will annoy Mark who's still got the whole day ahead of him yet hehe ;-) -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 20:56 To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Sorted!! Got a String[] (checkboxes), and when form is submitted the positions of the checked checkboxes are sent in this array ... % int i = 0; % logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=checkboxes name=checkboxes value=%=new Integer(i).toString()% checked=checked /logic:equal logic:notEqual name=flag value=true input type=checkbox id=checkboxes name=checkboxes value=%=new Integer(i).toString()% /logic:notEqual % i++; % /logic:iterate Cheers, Chico. Ps. U guys r nutz, leave the telepathic powers at home!! -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: 04 October 2002 13:42 To: Struts Users Mailing List Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Wrote it before I read yours. Just had a beer and a GT so my telepathic powers must have come online as a result ;-) Ahhh... I do so love Fridays. -Original Message- From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 20:21 To: 'Struts Users Mailing List' Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Hey man! RU refactoring my messages? ;-) -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 8:17 AM To: Struts Users Mailing List Subject: RE: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked For multiple, you also must set values back to false in reset() (The question here of course is which checkbox refers to which element. You may need to refactor such that your checkboxes return non boolean values so you can tell which is which at the server end). The reason for this is that the html spec in all its gory... uh I mean glory... has in its infinite wisdom defined that a checkbox ( radio button I think) that has not been ticked will not submit any value to the server. Afaik same is true for SELECT btw (multiple selections where nothing selected) -Original Message- From: Charlesworth, Chico [mailto:[EMAIL PROTECTED]] Sent: Friday, October 04, 2002 19:11 To: 'Struts Users Mailing List' Subject: CheckBox and Boolean[] Array - Incorrect Values Submitted When CheckBox is unchecked Hi, I'm trying to iterate through a Boolean Array using logic:iterate and then display these as check boxes. This works fine, but when submitting the form and resending the Boolean Array back to the Action class, only the values that are true are returned. In the struts documentation it says: WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method. But this only implies for a single property. Is there a workaround or a fix for this? My jsp code: logic:iterate id=flag name=myForm property=flags logic:equal name= flag value=true input type=checkbox id=flags name=flags value=on checked=checked /logic:equal logic:notEqual name= flag value=true input type=checkbox id=flags name=flags value=on /logic:notEqual /logic:iterate Cheers, Chico. -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe
RE: Checkbox in iterate
Hey, You kinda confused me about what your problem was. Could you maybe explain it better if I'm wrong about it? It sounds like you just want to know which rows are checked. You need to specify the 'indexId' attribute in the logic:iterate ... tag to create a variable that stores the index of the iteration. Then you specify the value of the checkbox using this variable. It would look somethink like: logic:iterate id=element name=collectionHolder property=someCollection type=someClass indexId=index html:checkbox property=blah value=%= index.toString() % !-- Some other crap in your iterate tag -- /logic:iterate Does this help you at all? ~ Keith http://www.buffalo.edu/~kkamholz http://www.buffalo.edu/~kkamholz -Original Message- From: Chandra Sekharan Bhaskaran [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 17, 2002 5:04 AM To: [EMAIL PROTECTED] Subject: Checkbox in iterate Hi, I am using checkboxes in iterate tag which iterates over a set of objects of a class Say ABC. In ABC i have one boolean property need to be displayed as checkbox. I am able to display the checkbox box with the value checked / unchecked based on the boolean value set in the class ABC. When i submit the form i have a boolean array variable myCheckBox which gets called by method setMyCheckBox(boolean a[]) . I do not know which check box user had selected because it retruns array of true values if 1,2 check boxes are selected OR 1,3 checkboxes are selected. Any help on this would be appreciated. rgds C.Bhaskaran
RE: Checkbox in iterate
Sorry, I forgot to mention that the corresponding property would be a String[] that will be filled with all the checked indexes. Is this what you're trying to do? ~ Keith http://www.buffalo.edu/~kkamholz -Original Message- From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED]] Sent: Monday, August 19, 2002 9:00 AM To: 'Struts Users Mailing List' Subject: RE: Checkbox in iterate Hey, You kinda confused me about what your problem was. Could you maybe explain it better if I'm wrong about it? It sounds like you just want to know which rows are checked. You need to specify the 'indexId' attribute in the logic:iterate ... tag to create a variable that stores the index of the iteration. Then you specify the value of the checkbox using this variable. It would look somethink like: logic:iterate id=element name=collectionHolder property=someCollection type=someClass indexId=index html:checkbox property=blah value=%= index.toString() % !-- Some other crap in your iterate tag -- /logic:iterate Does this help you at all? ~ Keith http://www.buffalo.edu/~kkamholz http://www.buffalo.edu/~kkamholz -Original Message- From: Chandra Sekharan Bhaskaran [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 17, 2002 5:04 AM To: [EMAIL PROTECTED] Subject: Checkbox in iterate Hi, I am using checkboxes in iterate tag which iterates over a set of objects of a class Say ABC. In ABC i have one boolean property need to be displayed as checkbox. I am able to display the checkbox box with the value checked / unchecked based on the boolean value set in the class ABC. When i submit the form i have a boolean array variable myCheckBox which gets called by method setMyCheckBox(boolean a[]) . I do not know which check box user had selected because it retruns array of true values if 1,2 check boxes are selected OR 1,3 checkboxes are selected. Any help on this would be appreciated. rgds C.Bhaskaran -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Checkbox in iterate
I'm gone trough this problem whith checking the paramaters recieved in the request, againt the array used to iterate. Unchecked checkboxes are not in the request; so I'needed to check any field expected (so many as the length of the collection used for the iteration) , tried to find a parameter corresponding in the request, and if not found (...if(!hParameters.containsKey((Object)new String(field+i)))...), reset the attribute to an unchecked value, so that the attribute reflect the changes made in the form. (I only use the reflection because of my generated bean properties) soth. like that: java.util.Enumeration enum = request.getParameterNames(); while (enum.hasMoreElements()){ String sParamName = (String)enum.nextElement(); String sParamValue = request.getParameter(sParamName); hParameters.put(sParamName,sParamValue); System.out.println(GV:[FieldListAction.perform()] Parameter : +sParamName +=+sParamValue); } listOfFieldsInput = (ArrayList)session.getAttribute (fieldList);//new ArrayList(); // The value of an unchecked checkbox is not set in the bean, because the parameter is not in the request. // We have to do it ourself by comparing the parameter array and the Element array. // Fields not found in the request are set to an unchecked value. /** @todo get the unchecked value from the Element object getUnckeckedValue() or getEmptyRequestParameterValue()*/ try { java.lang.Class c = Class.forName (be.smalsmvm.webapp.dmfa.FieldListActionForm); if (request.getParameterNames()!=null listOfFieldsInput!=null){// ?add other tests to avoid overflow? for ( int i=0; ilistOfFieldsInput.size() ; i++) { Element thisField = (Element)listOfFieldsInput.get(i); if(!hParameters.containsKey((Object)new String(field+i))){ System.out.println(GV:[FieldListAction.perform()] field+i+ (+thisField.getName()+) not found in the request); java.lang.reflect.Method m = c.getMethod(setField+i,new Class[] {Class.forName(java.lang.String)}); Object[] oTemp = new Object[1]; if (thisField.getType().equalsIgnoreCase(checkbox)){ oTemp[0] = new String(false); } else oTemp[0] = new String(null); m.invoke(form,oTemp); } else System.out.println(GV:[FieldListAction.perform()] found field+i+ (+thisField.getName()+) in the request ); } } } catch (Exception e){ if (!(e instanceof ServletException) || (e instanceof IOException)) { System.out.println(GV:[FieldListAction.perform()] Exception :+e.toString()); e.printStackTrace(); } throw new ServletException(e.toString()+:+e.getMessage()); } Does it help? Gilles Vandaele Kamholz, Keith (corp-staff) USXTo:'Struts Users Mailing List' [EMAIL PROTECTED] [EMAIL PROTECTED] cc: 19/08/2002 15:02 Subject: RE: Checkbox in iterate Please respond to Struts Users Mailing List Sorry, I forgot to mention that the corresponding property would be a String[] that will be filled with all the checked indexes. Is this what you're trying to do? ~ Keith http://www.buffalo.edu/~kkamholz -Original Message- From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED]] Sent: Monday, August 19, 2002 9:00 AM To: 'Struts Users Mailing List' Subject: RE: Checkbox in iterate Hey, You kinda confused me about what your problem was. Could you maybe explain it better if I'm wrong about it? It sounds like you just want to know which rows are checked. You need to specify the 'indexId' attribute in the logic:iterate ... tag to create a variable that stores the index of the iteration. Then you specify the value of the checkbox using this variable. It would look somethink like: logic:iterate id=element name=collectionHolder property=someCollection type=someClass
RE: Checkbox in iterate
Hmmm I'm confused, but probably just because I'm new to all this. I just started developing web applications this summer. There is one little trick that I came up with concerning checkboxes. I had problems reseting the boolean values in my bean to false when the user hit the form, so I used a jsp:setProperty .../ after the checkbox tag. This helps the app recognize unchecked boxes nicely and saves some ugly code in the ActionForm. I don't know that this is related to your problem at all, but I thought I'ld mention it because other people might be having this issue. Sorry I'm not more help, perhaps one of the more experienced struts users have some input. ~ Keith http://www.buffalo.edu/~kkamholz -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, August 19, 2002 9:23 AM To: Struts Users Mailing List Subject: RE: Checkbox in iterate I'm gone trough this problem whith checking the paramaters recieved in the request, againt the array used to iterate. Unchecked checkboxes are not in the request; so I'needed to check any field expected (so many as the length of the collection used for the iteration) , tried to find a parameter corresponding in the request, and if not found (...if(!hParameters.containsKey((Object)new String(field+i)))...), reset the attribute to an unchecked value, so that the attribute reflect the changes made in the form. (I only use the reflection because of my generated bean properties) soth. like that: java.util.Enumeration enum = request.getParameterNames(); while (enum.hasMoreElements()){ String sParamName = (String)enum.nextElement(); String sParamValue = request.getParameter(sParamName); hParameters.put(sParamName,sParamValue); System.out.println(GV:[FieldListAction.perform()] Parameter : +sParamName +=+sParamValue); } listOfFieldsInput = (ArrayList)session.getAttribute (fieldList);//new ArrayList(); // The value of an unchecked checkbox is not set in the bean, because the parameter is not in the request. // We have to do it ourself by comparing the parameter array and the Element array. // Fields not found in the request are set to an unchecked value. /** @todo get the unchecked value from the Element object getUnckeckedValue() or getEmptyRequestParameterValue()*/ try { java.lang.Class c = Class.forName (be.smalsmvm.webapp.dmfa.FieldListActionForm); if (request.getParameterNames()!=null listOfFieldsInput!=null){// ?add other tests to avoid overflow? for ( int i=0; ilistOfFieldsInput.size() ; i++) { Element thisField = (Element)listOfFieldsInput.get(i); if(!hParameters.containsKey((Object)new String(field+i))){ System.out.println(GV:[FieldListAction.perform()] field+i+ (+thisField.getName()+) not found in the request); java.lang.reflect.Method m = c.getMethod(setField+i,new Class[] {Class.forName(java.lang.String)}); Object[] oTemp = new Object[1]; if (thisField.getType().equalsIgnoreCase(checkbox)){ oTemp[0] = new String(false); } else oTemp[0] = new String(null); m.invoke(form,oTemp); } else System.out.println(GV:[FieldListAction.perform()] found field+i+ (+thisField.getName()+) in the request ); } } } catch (Exception e){ if (!(e instanceof ServletException) || (e instanceof IOException)) { System.out.println(GV:[FieldListAction.perform()] Exception :+e.toString()); e.printStackTrace(); } throw new ServletException(e.toString()+:+e.getMessage()); } Does it help? Gilles Vandaele Kamholz, Keith (corp-staff) USXTo:'Struts Users Mailing List' [EMAIL PROTECTED] [EMAIL PROTECTED] cc: 19/08/2002 15:02 Subject: RE: Checkbox in iterate Please respond to Struts Users Mailing List Sorry, I forgot to mention that the corresponding property would be a String[] that will be filled with all the checked indexes. Is this what you're trying to do? ~ Keith http://www.buffalo.edu/~kkamholz -Original Message- From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED]] Sent: Monday, August 19, 2002 9:00 AM To: 'Struts Users Mailing List' Subject: RE: Checkbox in iterate Hey, You kinda confused me about what your problem was. Could you maybe explain it better if I'm wrong about it? It sounds like you just want to know which rows are checked. You need to specify the 'indexId' attribute in the logic:iterate ... tag to create a variable
RE: Checkbox Issue
% if ( session.getAttribute(key) == null ) { % input type=checkbox name=variable value=true % } else { % input type=checkbox name=variable value=true checked % } % -Original Message- From: Chandra Gottipati [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 5:49 PM To: Struts Users Mailing List Subject: Checkbox Issue Is there a way to set the check box to checked, before displaying the jsp based on a value retrieved from a session variable. I am setting this session variable before displaying the jsp in the action object. Thanks. Chandra. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.375 / Virus Database: 210 - Release Date: 7/10/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.375 / Virus Database: 210 - Release Date: 7/10/2002 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Checkbox Issue
This begs the question: Why don't you set the check box property itself in your form bean and use html:checkbox rather than setting a session variable to check for? -Original Message- From: Jacob Hookom [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 4:10 PM To: 'Struts Users Mailing List'; 'Chandra Gottipati' Subject: RE: Checkbox Issue % if ( session.getAttribute(key) == null ) { % input type=checkbox name=variable value=true % } else { % input type=checkbox name=variable value=true checked % } % -Original Message- From: Chandra Gottipati [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 5:49 PM To: Struts Users Mailing List Subject: Checkbox Issue Is there a way to set the check box to checked, before displaying the jsp based on a value retrieved from a session variable. I am setting this session variable before displaying the jsp in the action object. Thanks. Chandra. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.375 / Virus Database: 210 - Release Date: 7/10/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.375 / Virus Database: 210 - Release Date: 7/10/2002 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Checkbox Issues
Hi, a bit of peace, please (less than a day and already stressing...). The documentation and the mailing list archives clearly state, that checkboxes must be set to false (if boolean) or space (if string), and nothing else. Obvioulsy this only happens if you are going through an action. hth Alexander -Original Message- From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED]] Sent: Mittwoch, 10. Juli 2002 14:35 To: Struts (E-mail) Subject: FW: Checkbox Issues Hey everyone, I'm reposting my question because it kinda got ignored before. I don't want to be a mooch, but can anyone help me out with this? ~ Keith http://www.buffalo.edu/~kkamholz -Original Message- From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 09, 2002 3:16 PM To: Struts (E-mail) Subject: FW: Checkbox Issues One little addition to my question... I have an html:link to the form JSP to avoid it being validated before being submitted. Do I need to go through an action in order for reset() to be called? ~ Keith http://www.buffalo.edu/~kkamholz -Original Message- From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 09, 2002 3:14 PM To: Struts (E-mail) Subject: Checkbox Issues Hey everyone, I'm having an issue with my checkboxes. I know you're supposed to set the corresponding boolean property to false in the reset method, and I do just that. However, for some reason the checkboxes cannot be unchecked. After they are checked for the first time, the property is always selected. It doesn't seem like a very complex issue, but I don't know what's going on. Can anyone help me out here? Thanks a lot! ~ Keith http://www.buffalo.edu/~kkamholz -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: CheckBox problem in struts..
reset the check box values in the struts form reset method. -Original Message- From: Sachin [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 6:35 PM To: [EMAIL PROTECTED] Subject: CheckBox problem in struts.. Hi Could anyone explain about the checkbox problem in struts if i have a checkbox in a jsp and if i set the value of the bean to yes, true or on, the checkbox will be checked. But if i try to set the value of the checkbox in the bean it is not getting set. if i submit data from checkbox it is not getting reflected when i revisit the page. Thanks Regards Sachin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Checkbox state not changing after checked on
The underlying problem is that the HTML spec tells the browsers to not submit a checkbox if it is not checked. (Or any other blank control for that matter.) There's not a lot we can do about that =:o( What happens with a box that starts out checked, is that when it is unchecked, nothing is submitted. If the box represents a persistent state, it just stays checked, since nothing turned it off. Some times a radio button is a better way to go, since something will always be submitted. The reset method grew out of a need to set the checkboxes to a known state, to get around this quirk of HTML. The alternative is to scan the request for the missing checkboxes, and set them as expected if they are missing. -- Ted Husted, Husted dot Com, Fairport NY US -- Developing Java Web Applications with Struts -- Tel: +1 585 737-3463 -- Web: http://husted.com/about/services Chris Means wrote: I'm having a problem with setting check box states on my form. I have a checkbox on my form, it's supposed to be checked if muting is occurring, and not checked otherwise. The user just needs to click the checkbox to change/toggle the state. However, I only seem to get an Action setting if the checkbox is not checked...any ideas what I'm doing wrong? Shouldn't the property be set regardless of the state of the object? My JSP: html:checkbox property=mute onclick=this.form.submit () /Mute My FormBean: public void setMute (boolean newMute) { mute = newMute ; action = mute ; } My ActionForm: ControlPanelForm cp = (ControlPanelForm) form ; String action = cp.getAction () ; System.out.println (Action: + action) ; if (mute.equals (action)) api.mute () ; status.refresh () ; cp.setMute (status.isMuted ()) ; return (mapping.findForward (success)); TIA. -Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Checkbox state not changing after checked on
Thanks Ted. So if I want to keep the checkbox metaphor (rather than use a radio button, which might confuse the UI), I should use an image of a checkbox (in either of it's states). Yes? Is there an obvious way to derive a mapping between the Form bean and the image on the JSP? Thanks for your help. -Chris -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 23, 2002 4:32 PM To: Struts Users Mailing List Subject: Re: Checkbox state not changing after checked on The underlying problem is that the HTML spec tells the browsers to not submit a checkbox if it is not checked. (Or any other blank control for that matter.) There's not a lot we can do about that =:o( What happens with a box that starts out checked, is that when it is unchecked, nothing is submitted. If the box represents a persistent state, it just stays checked, since nothing turned it off. Some times a radio button is a better way to go, since something will always be submitted. The reset method grew out of a need to set the checkboxes to a known state, to get around this quirk of HTML. The alternative is to scan the request for the missing checkboxes, and set them as expected if they are missing. -- Ted Husted, Husted dot Com, Fairport NY US -- Developing Java Web Applications with Struts -- Tel: +1 585 737-3463 -- Web: http://husted.com/about/services Chris Means wrote: I'm having a problem with setting check box states on my form. I have a checkbox on my form, it's supposed to be checked if muting is occurring, and not checked otherwise. The user just needs to click the checkbox to change/toggle the state. However, I only seem to get an Action setting if the checkbox is not checked...any ideas what I'm doing wrong? Shouldn't the property be set regardless of the state of the object? My JSP: html:checkbox property=mute onclick=this.form.submit () /Mute My FormBean: public void setMute (boolean newMute) { mute = newMute ; action = mute ; } My ActionForm: ControlPanelForm cp = (ControlPanelForm) form ; String action = cp.getAction () ; System.out.println (Action: + action) ; if (mute.equals (action)) api.mute () ; status.refresh () ; cp.setMute (status.isMuted ()) ; return (mapping.findForward (success)); TIA. -Chris -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: checkbox
http://jakarta.apache.org/struts/struts-html.html#checkbox WARNING: In order to correctly recognize unchecked checkboxes, the ActionForm bean associated with this form must include a statement setting the corresponding boolean property to false in the reset() method. Serge A. Redchuk wrote: Hello struts-user, I'm newbie in Struts and encountered a problem when tried to get boolean value of checkbox state from my form bean. I always have 'true', even if I unchecked my checkbox on form. In JSP I wrote: Published: html:checkbox property=published / In Action that must handle the form data: ... ef.getPublished() - ever true ! ... What have I done in wrong way ? -- Best regards, Serge mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: checkbox
Check the archives -- this question has been answered many many times before on this list. Short answer: use the reset() method of your form. hth, tomK -Original Message- From: Serge A. Redchuk [mailto:[EMAIL PROTECTED]] Sent: dinsdag 15 januari 2002 13:21 To: Struts Users Mailing List Subject: checkbox Hello struts-user, I'm newbie in Struts and encountered a problem when tried to get boolean value of checkbox state from my form bean. I always have 'true', even if I unchecked my checkbox on form. In JSP I wrote: Published: html:checkbox property=published / In Action that must handle the form data: ... ef.getPublished() - ever true ! ... What have I done in wrong way ? -- Best regards, Serge mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:struts-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: checkbox
Stefan, I've done something similar. My solution (which may not be ideal) was as follows: define an ArrayList property (activitiesToDelete) in the Form bean to which you are submitting this form. Then use a cell inside your iterator like this: td html:multibox property=activitiesToDelete bean:write name=aktivitaet property=aktivitaetname/ /html:multibox /td In the Action class to which you are submitting, you can then get a list of the activities you want to delete like this, String[] toDelete = request.getParameterValues(activitiesToDelete); Perhaps there's a more elegant way to do this, but when I needed to do it I didn't find one that was clearly explained in either the documentation or the mailing list. -- Rohan. On Thu, 2 Aug 2001, Stefan Faist wrote: Hello All, I have the fallowing iteration: logic:iterate id=aktivitaet name=projektForm property=aktivitaeten tr tdnobrbean:write name=aktivitaet property=aktivitaetname//nobr/td tdnobrbean:write name=aktivitaet property=beschreibung//nobr/td // Here I want to have a checkbox. With this checkbox I want to select which aktivitaet I want to delete. // But how can I access to these checkboxes? /tr /logic:iterate I hope you understand what I want. Have someone a solution for my Problem. Best regards, Stefan
Re: Checkbox problem still not fixed :(
Hi! I had a similar problem and solved it by changing the attribute scope in my action in the struts-config.xml file to request instead of session. /Linnéa - Original Message - From: Joel Vogt To: [EMAIL PROTECTED] Sent: Thursday, June 28, 2001 10:04 AM Subject: Checkbox problem still not fixed :( Hi everyone. I've tried just about everything in the mail archive but can't get check/multi boxes to perform how I want to. I use an iterate tag over a collection, basically on my jsp page I have as follows form blah hidden name="pk" blah checkbox property="member" /form In my form bean I have an array pk[] and another member[]. In the reset method I do: for(int i = 0;imember.length;i++) member[i] = "false"; When I check the values off the form in my action class, i still only get the values set to true. I need a long list, true, false, true, true etc for all the values. Sorry to be a pain but can someone give me some sort of 'exact' steps to solve the problem? I haven't been able to piece together all the help on the mail archive. Thanks, Joel [EMAIL PROTECTED]
Re: Checkbox problem still not fixed :(
Hi all, I've worked on it a bit more and come up with these steps to make it work. I use a multibox instead of a checkbox like this on my form: html:multibox name="model" property="member" value="yes"/ I then also include with this a hidden field html:hidden name="model" property="member" value="no"/ The form bean remains the same. In my action class, I can then get the required values by looping like this int j = 0; for (int i = 0; imember.length;i++) { if (member[j].equals("yes")) { // This person is a member so do required events; j+=1; } else// this person is marked to not be a member j+=1; } This works because if the multibox was checked to true, there will be two values for each user, a true for the multibox and then the no from the hidden field. If the multibox is not checked then we only get one entry, a no from the hidden field. To me this is a bit ineligant. Sure it works, but... Any other solutions? Btw Thanks to all the people offering help on this, it seems struts has a good community going. Joel. - Original Message - From: Joel Vogt To: [EMAIL PROTECTED] Sent: Thursday, June 28, 2001 10:04 AM Subject: Checkbox problem still not fixed :( Hi everyone. I've tried just about everything in the mail archive but can't get check/multi boxes to perform how I want to. I use an iterate tag over a collection, basically on my jsp page I have as follows form blah hidden name="pk" blah checkbox property="member" /form In my form bean I have an array pk[] and another member[]. In the reset method I do: for(int i = 0;imember.length;i++) member[i] = "false"; When I check the values off the form in my action class, i still only get the values set to true. I need a long list, true, false, true, true etc for all the values. Sorry to be a pain but can someone give me some sort of 'exact' steps to solve the problem? I haven't been able to piece together all the help on the mail archive. Thanks, Joel [EMAIL PROTECTED]
RE: Checkbox Arrays
yes please,, please share -Original Message- From: Jeff Trent [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 9:44 PM To: [EMAIL PROTECTED] Subject: Re: Checkbox Arrays I don't know if this is the right thread. But I just got multibox working in my app (including preservation of checkbox entries between forwards). Let me share with you what I have to see if this helps: in Jsp: (cleanSolutionAreaTypes in an Application-scoped Vector) tr td align=left Solutions Area* /td td align=left logic:iterate id=solutionAreaType name=cleanSolutionAreaTypes html:multibox property=solutionAreaTypes bean:write name=solutionAreaType property=id/ /html:multibox bean:write name=solutionAreaType property=name/br /logic:iterate /td /tr in Form: protected String[] solutionAreaTypes = new String[0]; public String[] getSolutionAreaTypes() { return solutionAreaTypes; } public void setSolutionAreaTypes(String[] solutionAreaTypes) { this.solutionAreaTypes = solutionAreaTypes; } What was causing me some exceptions was this. I originally used another application-scoped vector called solutionAreaTypes for other purposes (like drop-down lists). That Vector contains an entry that has a null ID value (eg. name = --specify-- value=). This was causing Struts to throw a non-intuitive exception. I then created another Vector without this entry in it and everything seems to work fine now. Of course I've only gotten it to work about 15 minutes ago so I'll let you know later if it really works ;-) - jeff - Original Message - From: Peter Alfors [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 10, 2001 2:01 PM Subject: Re: Checkbox Arrays Try pulling the bean value out into a script variable. Taglibs cannot be nested within another taglib as an attribute. Tony Karas wrote: Yeah - I'm looking at that. My problem now is how to get the value for each checkbox. My bean has an id property - so I have tried this kind of thing: logic:iterate id=retailer name=retailerForm property=retailers tr tdhtml:checkbox name=retailer property=delete value=bean:write name=retailer property=id///td tdbean:write name=retailer property=id//td tdhtml:text name=retailer property=name//td /tr /logic:iterate But it doesn't like having the bean:write embedded there. Am I missing something obvious? Many thanks Tony From: Peter Alfors [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Checkbox Arrays Date: Thu, 10 May 2001 11:09:18 -0500 Im not sure how the ActionForm changes things, but without an actionform your could do this Each checkbox can have the same name, but a different value. When the form is submitted, the checkboxes that have been checked are in the request. You can use the request.getParameterValues(checkBoxName) to retrieve a string array of the values for the checked boxes. HTH, Pete Tony Karas wrote: Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony peter.alfors.vcf _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
RE: Checkbox Arrays
Ah sorry Hal - thanks for your perseverance - I was assuming, mistakenly, that multibox was something else. I'll take a look at this - cheers. Tony From: Deadman, Hal [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: RE: Checkbox Arrays Date: Thu, 10 May 2001 12:20:58 -0400 I posted this same response to your Posting Collections question yesterday. Here it is again. If you use the html:multibox, you can get back an array of key values instead of an array of booleans. They key values can be Longs, Strings, whatever, as long as it uniquely identifies the row that you want to know was checked. If you haven't used multibox, it generates an html checkbox. The array that will be set in your form will only contain the key values for the rows that were checked. Here is the post from yesterday: I think I am doing the same thing that you want to do using the html:multibox. When the form is submitted you get an array of the ids that are checked and then you can go delete them. in the jsp form (where restaurant id is a key for the item being deleted): logic:iterate id=restaurant name=favoriterestaurants ... html:multibox property=favoriteRestaurantRemoveList bean:write property=restaurantId name=restaurant/ /html:multibox ... /logic:iterate in the form class: private Long favoriteRestaurantRemoveList[] = new Long[0]; public Long[] getFavoriteRestaurantRemoveList() { return (this.favoriteRestaurantRemoveList); } public void setFavoriteRestaurantRemoveList(Long favoriteRestaurantRemoveList[]) { this.favoriteRestaurantRemoveList = favoriteRestaurantRemoveList; } I am not sure if initializing the array to new Long[0] is necessary, probably not. -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 11:52 AM To: Struts User Subject: Checkbox Arrays Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
RE: Checkbox Arrays
I am amazed (and pleased) at your perseverance :-) From: Deadman, Hal [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: RE: Checkbox Arrays Date: Thu, 10 May 2001 13:35:12 -0400 Don't use the html:checkbox, use html:multibox and use bean:write in the body of the tag. An html:multibox resolves to an HTML checkbox. Hal -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 12:44 PM To: [EMAIL PROTECTED] Subject: Re: Checkbox Arrays Yeah - I'm looking at that. My problem now is how to get the value for each checkbox. My bean has an id property - so I have tried this kind of thing: logic:iterate id=retailer name=retailerForm property=retailers tr tdhtml:checkbox name=retailer property=delete value=bean:write name=retailer property=id///td tdbean:write name=retailer property=id//td tdhtml:text name=retailer property=name//td /tr /logic:iterate But it doesn't like having the bean:write embedded there. Am I missing something obvious? Many thanks Tony From: Peter Alfors [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Checkbox Arrays Date: Thu, 10 May 2001 11:09:18 -0500 Im not sure how the ActionForm changes things, but without an actionform your could do this Each checkbox can have the same name, but a different value. When the form is submitted, the checkboxes that have been checked are in the request. You can use the request.getParameterValues(checkBoxName) to retrieve a string array of the values for the checked boxes. HTH, Pete Tony Karas wrote: Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony peter.alfors.vcf __ ___ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
RE: Checkbox Arrays - Internationalising them?!
Hal, thanks for your input on multi-box - they are working great! BUT...I need to get the bean:write internationalized - does anyone know if this is possible? ie I want to do a bean:message on the output from a bean:write... I think this qu has been asked before, but I looked through the archives and couldn't find it... Thanks, Dave Deadman, Hal [EMAIL PROTECTED] on 05/10/2001 12:20:58 PM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: RE: Checkbox Arrays I posted this same response to your Posting Collections question yesterday. Here it is again. If you use the html:multibox, you can get back an array of key values instead of an array of booleans. They key values can be Longs, Strings, whatever, as long as it uniquely identifies the row that you want to know was checked. If you haven't used multibox, it generates an html checkbox. The array that will be set in your form will only contain the key values for the rows that were checked. Here is the post from yesterday: I think I am doing the same thing that you want to do using the html:multibox. When the form is submitted you get an array of the ids that are checked and then you can go delete them. in the jsp form (where restaurant id is a key for the item being deleted): logic:iterate id=restaurant name=favoriterestaurants ... html:multibox property=favoriteRestaurantRemoveList bean:write property=restaurantId name=restaurant/ /html:multibox ... /logic:iterate in the form class: private Long favoriteRestaurantRemoveList[] = new Long[0]; public Long[] getFavoriteRestaurantRemoveList() { return (this.favoriteRestaurantRemoveList); } public void setFavoriteRestaurantRemoveList(Long favoriteRestaurantRemoveList[]) { this.favoriteRestaurantRemoveList = favoriteRestaurantRemoveList; } I am not sure if initializing the array to new Long[0] is necessary, probably not. -Original Message- From: Tony Karas [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 11:52 AM To: Struts User Subject: Checkbox Arrays Can anyone help with this? I have an array of checkboxes in my ActionForm represented by boolean[] delete; and I have a setter function public void setDelete( boolean[] values ) { delete = values; } The problem is that I have only checkboxes that are checked get sent back - so if one checkbox is checked all I get is an array of length 1. Therefore, it is not possible for me to determine which checkbox has been checked. In the documentation it tells me to use reset() in ActionForm to initialise the values - but this will only work with single checkboxes and not arrays. I think I'm stuck. Is there anyway I can determine which checkbox has been checked - maybe I can get the value to differ for each checkbox. Will look in to that. Cheers Tony