AW: Single Checkbox Required
hi sam first off, javascript is not really fun, but here goes. your form should have the same name as the formbean you associate with it. you can check this in the html code generated from your jsp. the html:form tag does not supply an attribute for setting/overriding the name of the form (correct me if i'm wrong). furthermore, if you don't want to use the document.forms[...] syntax, you can use things like document.getElementsByName, document.getElementById etc. You could even get all elements in the document, filter out the checkboxes and modify/check attributes like that. you can find a nice explanation of document.forms[] vs. document.getElementsByName when you google for selfhtml just make sure that you are working with a browser that gives you nice error messages while debugging your javascript - like mozilla. andreas -Ursprungliche Nachricht- Von: as as [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 17. Marz 2004 19:27 An: Struts Users Mailing List Betreff: RE: Single Checkbox Required Hi, Interesting... yourForm- where do we mention this in the struts's html:form tag Thanks! Sam (I had similar error where my form on submission would say .length is null...was probably not able to invoke checkbox.length on the form already as struts form is generated only after hitting the server but we may need javascript validation much before that-on client side... please...correct me if i am wrong. Thanks my code snipet below: html:form action=edit name=displayForm type=com.model.DisplayForm table border=0 width=100% input type=checkbox name=edit_all value=Check All onClick=check(this.form.list)/th .. ... logic:iterate id=driver name=drivers input type=checkbox value=list name=delete_bean:write name=book property=ISBN / ... ... SCRIPT LANGUAGE=JavaScript var checkflag = false; function check(field) { if (checkflag == false) { for (i = 0; i field.length; i++) { field[i].checked = true;} checkflag = true; return Uncheck All; } else { for (i = 0; i field.length; i++) { field[i].checked = false; } checkflag = false; return Check All; } } Brendan Richards [EMAIL PROTECTED] wrote: Sorry - didn't realise you were using javascript validation (should have read your post more carefully). You could add your own client side code: function checkTheBox() { if (!document.forms['yourForm'].myCheckbox.checked) { alert(you must check the box to proceed); return false; } else { return true; } } -Original Message- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 17:14 To: Struts Users Mailing List Subject: RE: Single Checkbox Required But, when I mark it required in my validator.xml, it doesn't work. The javascript that is generated (validateRequired) does not apply to fields of type checkbox. I suppose I could modify the javascript, but I want both server side and client-side validation. -M -Original Message- From: Brendan Richards [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:52 AM To: Struts Users Mailing List Subject: RE: Single Checkbox Required What makes a checkbox unusual is that it only submits a value when checked - when unchecked nothing is submitted. You should therefore be able to validate that it's been checked with a standard required validator. -Original Message- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 16:26 To: [EMAIL PROTECTED] Subject: Single Checkbox Required I have searched the archive of the list and I came up empty. I want to use validator.xml to indicate that a single checkbox must be checked 'true' on my form. Has anyone had success simply indicating a boolean field to be required? I've noticed that in the client-side javascript that is generated, validateRequired does not look at fields of type 'checkbox'. I have read that commons-validator added this functionality at some point in the past, but has it not made it into the Struts validtion package? Thanks, Michael - 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] Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: Single Checkbox Required
Andreas, Thanks for the reply.I will try this and post back my results! -Sam Andreas Solarik [EMAIL PROTECTED] wrote: hi sam first off, javascript is not really fun, but here goes. your form should have the same name as the formbean you associate with it. you can check this in the html code generated from your jsp. the html:form tag does not supply an attribute for setting/overriding the name of the form (correct me if i'm wrong). furthermore, if you don't want to use the document.forms[...] syntax, you can use things like document.getElementsByName, document.getElementById etc. You could even get all elements in the document, filter out the checkboxes and modify/check attributes like that. you can find a nice explanation of document.forms[] vs. document.getElementsByName when you google for selfhtml just make sure that you are working with a browser that gives you nice error messages while debugging your javascript - like mozilla. andreas -Ursprungliche Nachricht- Von: as as [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 17. Marz 2004 19:27 An: Struts Users Mailing List Betreff: RE: Single Checkbox Required Hi, Interesting... yourForm- where do we mention this in the struts's tag Thanks! Sam (I had similar error where my form on submission would say .length is null...was probably not able to invoke checkbox.length on the form already as struts form is generated only after hitting the server but we may need javascript validation much before that-on client side... please...correct me if i am wrong. Thanks my code snipet below: [input] onClick=check(this.form.list) .. ... [input] property=ISBN / ... ... var checkflag = false; function check(field) { if (checkflag == false) { for (i = 0; i field[i].checked = true;} checkflag = true; return Uncheck All; } else { for (i = 0; i field[i].checked = false; } checkflag = false; return Check All; } } Brendan Richards wrote: Sorry - didn't realise you were using javascript validation (should have read your post more carefully). You could add your own client side code: function checkTheBox() { if (!document.forms['yourForm'].myCheckbox.checked) { alert(you must check the box to proceed); return false; } else { return true; } } -Original Message- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 17:14 To: Struts Users Mailing List Subject: RE: Single Checkbox Required But, when I mark it required in my validator.xml, it doesn't work. The javascript that is generated (validateRequired) does not apply to fields of type checkbox. I suppose I could modify the javascript, but I want both server side and client-side validation. -M -Original Message- From: Brendan Richards [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:52 AM To: Struts Users Mailing List Subject: RE: Single Checkbox Required What makes a checkbox unusual is that it only submits a value when checked - when unchecked nothing is submitted. You should therefore be able to validate that it's been checked with a standard required validator. -Original Message- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 16:26 To: [EMAIL PROTECTED] Subject: Single Checkbox Required I have searched the archive of the list and I came up empty. I want to use validator.xml to indicate that a single checkbox must be checked 'true' on my form. Has anyone had success simply indicating a boolean field to be required? I've noticed that in the client-side javascript that is generated, validateRequired does not look at fields of type 'checkbox'. I have read that commons-validator added this functionality at some point in the past, but has it not made it into the Struts validtion package? Thanks, Michael - 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] Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam
Single Checkbox Required
I have searched the archive of the list and I came up empty. I want to use validator.xml to indicate that a single checkbox must be checked 'true' on my form. Has anyone had success simply indicating a boolean field to be required? I've noticed that in the client-side javascript that is generated, validateRequired does not look at fields of type 'checkbox'. I have read that commons-validator added this functionality at some point in the past, but has it not made it into the Struts validtion package? Thanks, Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Single Checkbox Required
What makes a checkbox unusual is that it only submits a value when checked - when unchecked nothing is submitted. You should therefore be able to validate that it's been checked with a standard required validator. -Original Message- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 16:26 To: [EMAIL PROTECTED] Subject: Single Checkbox Required I have searched the archive of the list and I came up empty. I want to use validator.xml to indicate that a single checkbox must be checked 'true' on my form. Has anyone had success simply indicating a boolean field to be required? I've noticed that in the client-side javascript that is generated, validateRequired does not look at fields of type 'checkbox'. I have read that commons-validator added this functionality at some point in the past, but has it not made it into the Struts validtion package? Thanks, Michael - 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: Single Checkbox Required
But, when I mark it required in my validator.xml, it doesn't work. The javascript that is generated (validateRequired) does not apply to fields of type checkbox. I suppose I could modify the javascript, but I want both server side and client-side validation. -M -Original Message- From: Brendan Richards [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:52 AM To: Struts Users Mailing List Subject: RE: Single Checkbox Required What makes a checkbox unusual is that it only submits a value when checked - when unchecked nothing is submitted. You should therefore be able to validate that it's been checked with a standard required validator. -Original Message- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 16:26 To: [EMAIL PROTECTED] Subject: Single Checkbox Required I have searched the archive of the list and I came up empty. I want to use validator.xml to indicate that a single checkbox must be checked 'true' on my form. Has anyone had success simply indicating a boolean field to be required? I've noticed that in the client-side javascript that is generated, validateRequired does not look at fields of type 'checkbox'. I have read that commons-validator added this functionality at some point in the past, but has it not made it into the Struts validtion package? Thanks, Michael - 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: Single Checkbox Required
Sorry - didn't realise you were using javascript validation (should have read your post more carefully). You could add your own client side code: script function checkTheBox() { if (!document.forms['yourForm'].myCheckbox.checked) { alert(you must check the box to proceed); return false; } else { return true; } } /script html:form action=/yourAction.do onsubmit=return checkTheBox(); html:checkbox property=myCheckbox value=true / /html:form -Original Message- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 17:14 To: Struts Users Mailing List Subject: RE: Single Checkbox Required But, when I mark it required in my validator.xml, it doesn't work. The javascript that is generated (validateRequired) does not apply to fields of type checkbox. I suppose I could modify the javascript, but I want both server side and client-side validation. -M -Original Message- From: Brendan Richards [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:52 AM To: Struts Users Mailing List Subject: RE: Single Checkbox Required What makes a checkbox unusual is that it only submits a value when checked - when unchecked nothing is submitted. You should therefore be able to validate that it's been checked with a standard required validator. -Original Message- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 16:26 To: [EMAIL PROTECTED] Subject: Single Checkbox Required I have searched the archive of the list and I came up empty. I want to use validator.xml to indicate that a single checkbox must be checked 'true' on my form. Has anyone had success simply indicating a boolean field to be required? I've noticed that in the client-side javascript that is generated, validateRequired does not look at fields of type 'checkbox'. I have read that commons-validator added this functionality at some point in the past, but has it not made it into the Struts validtion package? Thanks, Michael - 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: Single Checkbox Required
Hi, Interesting... yourForm- where do we mention this in the struts's html:form tag Thanks! Sam (I had similar error where my form on submission would say .length is null...was probably not able to invoke checkbox.length on the form already as struts form is generated only after hitting the server but we may need javascript validation much before that-on client side... please...correct me if i am wrong. Thanks my code snipet below: html:form action=edit name=displayForm type=com.model.DisplayForm table border=0 width=100% input type=checkbox name=edit_all value=Check All onClick=check(this.form.list)/th .. ... logic:iterate id=driver name=drivers input type=checkbox value=list name=delete_bean:write name=book property=ISBN / ... ... SCRIPT LANGUAGE=JavaScript var checkflag = false; function check(field) { if (checkflag == false) { for (i = 0; i field.length; i++) { field[i].checked = true;} checkflag = true; return Uncheck All; } else { for (i = 0; i field.length; i++) { field[i].checked = false; } checkflag = false; return Check All; } } Brendan Richards [EMAIL PROTECTED] wrote: Sorry - didn't realise you were using javascript validation (should have read your post more carefully). You could add your own client side code: function checkTheBox() { if (!document.forms['yourForm'].myCheckbox.checked) { alert(you must check the box to proceed); return false; } else { return true; } } -Original Message- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 17:14 To: Struts Users Mailing List Subject: RE: Single Checkbox Required But, when I mark it required in my validator.xml, it doesn't work. The javascript that is generated (validateRequired) does not apply to fields of type checkbox. I suppose I could modify the javascript, but I want both server side and client-side validation. -M -Original Message- From: Brendan Richards [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:52 AM To: Struts Users Mailing List Subject: RE: Single Checkbox Required What makes a checkbox unusual is that it only submits a value when checked - when unchecked nothing is submitted. You should therefore be able to validate that it's been checked with a standard required validator. -Original Message- From: Morowitz, Michael [mailto:[EMAIL PROTECTED] Sent: 17 March 2004 16:26 To: [EMAIL PROTECTED] Subject: Single Checkbox Required I have searched the archive of the list and I came up empty. I want to use validator.xml to indicate that a single checkbox must be checked 'true' on my form. Has anyone had success simply indicating a boolean field to be required? I've noticed that in the client-side javascript that is generated, validateRequired does not look at fields of type 'checkbox'. I have read that commons-validator added this functionality at some point in the past, but has it not made it into the Struts validtion package? Thanks, Michael - 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] Do you Yahoo!? Yahoo! Mail - More reliable, more storage, less spam
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]
Checkbox not checked
(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? -- 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]
how to send checkbox value?
hi all i have a prob in sending checkbox value. i like to send check box value of a page to another page when a link is clicked which does not go thru any form.its a struts environment sathish __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to send checkbox value?
From: Sathish Babu K R [mailto:[EMAIL PROTECTED] i like to send check box value of a page to another page when a link is clicked which does not go thru any form.its a struts environment You can send parameters on the URL of the link, no need to have a form. Or you can have a form and use JavaScript to set a value and submit the form when a link is clicked. -- 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: how to send checkbox value?
Hi, How about for an list of checkboxes and we want to send the values of checked parameters-could we do it as part of the URL... Thanks! -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 9:37 AM To: Struts Users Mailing List Subject: RE: how to send checkbox value? From: Sathish Babu K R [mailto:[EMAIL PROTECTED] i like to send check box value of a page to another page when a link is clicked which does not go thru any form.its a struts environment You can send parameters on the URL of the link, no need to have a form. Or you can have a form and use JavaScript to set a value and submit the form when a link is clicked. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to send checkbox value?
hi all any no of checkboxes,fine. but how to know the box is checked r not and then send in url id u r able to find value of chekbox then u can better put in session r pass as hidden sathish __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to send checkbox value?
Have a hidden field that is the actual name of your field, use some jsp code fo set the value of the checkbox at load time based on the value of the hidden field, and use JavaScript to set the hidden field when the checkbox is changed. I have done this in non-Struts apps and expect to be using it very soon in a Struts app. saF -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 11:37 AM To: Struts Users Mailing List Subject: RE: how to send checkbox value? From: Sathish Babu K R [mailto:[EMAIL PROTECTED] i like to send check box value of a page to another page when a link is clicked which does not go thru any form.its a struts environment You can send parameters on the URL of the link, no need to have a form. Or you can have a form and use JavaScript to set a value and submit the form when a link is clicked. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to send checkbox value?
Could you enlcose the sampleThanks! -Original Message- From: Ferguson, Scott [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 9:46 AM To: Struts Users Mailing List Subject: RE: how to send checkbox value? Have a hidden field that is the actual name of your field, use some jsp code fo set the value of the checkbox at load time based on the value of the hidden field, and use JavaScript to set the hidden field when the checkbox is changed. I have done this in non-Struts apps and expect to be using it very soon in a Struts app. saF -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 11:37 AM To: Struts Users Mailing List Subject: RE: how to send checkbox value? From: Sathish Babu K R [mailto:[EMAIL PROTECTED] i like to send check box value of a page to another page when a link is clicked which does not go thru any form.its a struts environment You can send parameters on the URL of the link, no need to have a form. Or you can have a form and use JavaScript to set a value and submit the form when a link is clicked. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to send checkbox value?
hi yep an eg will do finethat should do as, get the value of checkbox stored in a variable whether it is checked r not.. sathish __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to send checkbox value?
Stolen from an old project... script function clicked_yn(hidden, option) { var temp = option.value; if (option.checked) { hidden.value = Y; } else { hidden.value = N; } } /script % String val = ; String hasFieldName = ; if(bean.getFieldName() != null bean.getFieldName().equalsIgnoreCase(y)) { hasFieldName = checked; } else { bean.setFieldName(N); } % : : INPUT type=checkbox onclick=clicked_yn(fieldName, fieldNameBox); name=fieldNameBox %=hasFieldName %/ INPUT type=hidden name=fieldName value=%=bean.getFieldName()%/ : : Note that the value of the field represented visually by the checkbox should only have Y or N as values. See if that helps saF -Original Message- From: Samyukta Akunuru [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 11:47 AM To: Struts Users Mailing List Subject: RE: how to send checkbox value? Could you enlcose the sampleThanks! -Original Message- From: Ferguson, Scott [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 9:46 AM To: Struts Users Mailing List Subject: RE: how to send checkbox value? Have a hidden field that is the actual name of your field, use some jsp code fo set the value of the checkbox at load time based on the value of the hidden field, and use JavaScript to set the hidden field when the checkbox is changed. I have done this in non-Struts apps and expect to be using it very soon in a Struts app. saF -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 11:37 AM To: Struts Users Mailing List Subject: RE: how to send checkbox value? From: Sathish Babu K R [mailto:[EMAIL PROTECTED] i like to send check box value of a page to another page when a link is clicked which does not go thru any form.its a struts environment You can send parameters on the URL of the link, no need to have a form. Or you can have a form and use JavaScript to set a value and submit the form when a link is clicked. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 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: how to send checkbox value?
hi scott thanx for code...it will work for modify flow but how abt setup flow? sathish __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to send checkbox value?
Thanks Scott,willl try mine with this sample -Original Message- From: Ferguson, Scott [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 9:58 AM To: Struts Users Mailing List Subject: RE: how to send checkbox value? Stolen from an old project... script function clicked_yn(hidden, option) { var temp = option.value; if (option.checked) { hidden.value = Y; } else { hidden.value = N; } } /script % String val = ; String hasFieldName = ; if(bean.getFieldName() != null bean.getFieldName().equalsIgnoreCase(y)) { hasFieldName = checked; } else { bean.setFieldName(N); } % : : INPUT type=checkbox onclick=clicked_yn(fieldName, fieldNameBox); name=fieldNameBox %=hasFieldName %/ INPUT type=hidden name=fieldName value=%=bean.getFieldName()%/ : : Note that the value of the field represented visually by the checkbox should only have Y or N as values. See if that helps saF -Original Message- From: Samyukta Akunuru [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 11:47 AM To: Struts Users Mailing List Subject: RE: how to send checkbox value? Could you enlcose the sampleThanks! -Original Message- From: Ferguson, Scott [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 9:46 AM To: Struts Users Mailing List Subject: RE: how to send checkbox value? Have a hidden field that is the actual name of your field, use some jsp code fo set the value of the checkbox at load time based on the value of the hidden field, and use JavaScript to set the hidden field when the checkbox is changed. I have done this in non-Struts apps and expect to be using it very soon in a Struts app. saF -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 11:37 AM To: Struts Users Mailing List Subject: RE: how to send checkbox value? From: Sathish Babu K R [mailto:[EMAIL PROTECTED] i like to send check box value of a page to another page when a link is clicked which does not go thru any form.its a struts environment You can send parameters on the URL of the link, no need to have a form. Or you can have a form and use JavaScript to set a value and submit the form when a link is clicked. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 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: how to send checkbox value?
We've implemented the same solution in our project with this tag. Hope can help you. Cheers. Guillermo. package ar.com.eds.x71.framework.ui.taglibs.struts.html; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.BaseFieldTag; import org.apache.struts.util.RequestUtils; import org.apache.struts.util.ResponseUtils; /** * CheckBox, que tiene un hidden asociado para que mande siempre valor, esté o no checkeado. [EMAIL PROTECTED] Guillermo Meyer **/ public class CheckBoxTag extends BaseFieldTag { /** * Genera el checkBox * */ private String arrayIndex=null; public int doStartTag() throws JspException { //esto crea el hidden StringBuffer results = new StringBuffer(input type=\hidden\ name=\); results.append(property); results.append(\); results.append( value=\); Object valor=null; if (value != null) { valor=value; results.append(valor); } else { valor = RequestUtils.lookup(pageContext, name, property, null); if (valor == null) valor = false; results.append(valor.toString()); } results.append(\); // Create an appropriate input element based on our parameters results.append(input type=\checkbox\); results.append( name=\); results.append(this.property); results.append(_chk\); String valor2 = valor.toString(); if (valor2.equalsIgnoreCase(true) || valor2.equalsIgnoreCase(yes) || valor2.equalsIgnoreCase(on)) results.append( checked); results.append(prepareEventHandlers()); results.append(prepareStyles()); results.append(); ResponseUtils.write(pageContext, results.toString()); return (EVAL_PAGE); } protected String getJSOnClick() { StringBuffer sb = new StringBuffer(); sb.append(if(this.checked) this.form.elements['); sb.append(this.property); sb.append(']); if(this.getArrayIndex()!=null) { sb.append([); sb.append(this.getArrayIndex()); sb.append(]); } sb.append(.value='true'; else this.form.elements['); sb.append(this.property); sb.append(']); if(this.getArrayIndex()!=null) { sb.append([); sb.append(this.getArrayIndex()); sb.append(]); } sb.append(.value='false';); return sb.toString(); } /** * Prepares the event handlers for inclusion in the component's HTML tag. * @return The prepared String for inclusion in the HTML tag. */ protected String prepareEventHandlers() { StringBuffer handlers = new StringBuffer(); prepareMouseEvents(handlers); prepareKeyEvents(handlers); prepareFocusEvents(handlers); return handlers.toString(); } // Private Methods /** * Prepares the mouse event handlers, appending them to the the given * StringBuffer. * @param handlers The StringBuffer that output will be appended to. */ private void prepareMouseEvents(StringBuffer handlers) { handlers.append( onclick=\); handlers.append(this.getJSOnClick()); if (this.getOnclick()!= null) { handlers.append(this.getOnclick()); handlers.append(\); } handlers.append(;\); if (this.getOndblclick() != null) { handlers.append( ondblclick=\); handlers.append(this.getOndblclick()); handlers.append(\); } if (this.getOnmouseover() != null) { handlers.append( onmouseover=\); handlers.append(this.getOnmouseover()); handlers.append(\); } if (this.getOnmouseout() != null) { handlers.append( onmouseout=\); handlers.append(this.getOnmouseout()); handlers.append(\); } if (this.getOnmousemove() != null) { handlers.append( onmousemove=\); handlers.append(this.getOnmousemove()); handlers.append(\); } if (this.getOnmousedown() != null) { handlers.append( onmousedown=\); handlers.append(this.getOnmousedown()); handlers.append
RE: how to send checkbox value?
The jsp code in the middle should handle the setting of the checkbox value at load time. The JavaScript code at the start handles the value after the page has been loaded. saF -Original Message- From: Sathish Babu K R [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 12:02 PM To: Struts Users Mailing List Subject: RE: how to send checkbox value? hi scott thanx for code...it will work for modify flow but how abt setup flow? sathish __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - 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]
Getting the CheckBox Collection Value in FormBean Class
Hi All, If any body know how to get the solution for getting the check box collection value in the form bean class. If so mail your ideas... Thanx, Ram - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting the CheckBox Collection Value in FormBean Class
Do you mean that you want to store checkbox values in a form bean? if so... You can set up an empty String array in your form bean like this: String[] checkboxes = new String[]{}; and then in your jsp page you can set the property of a checkbox to this array, like: html:checkbox name=FormName property=checkboxes value=???/ when the page is submitted, the checked box values are stored in the array - you can then use them how you wish in your action. Note though that you have to set the value of the checkbox if you are going to have anything submitted to the array in the form. HTH claire :) - Original Message - From: Ramachandran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 02, 2004 9:38 AM Subject: Getting the CheckBox Collection Value in FormBean Class Hi All, If any body know how to get the solution for getting the check box collection value in the form bean class. If so mail your ideas... Thanx, Ram - 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: Getting the CheckBox Collection Value in FormBean Class
Yes Claire, I am doing like that only.This is my jsp,contains the code. I am nested inside the iteration. FORM BEAN public String[] getDeletereqs() { return this.deletereqs; } public void setDeletereqs(String[] deletereqs) { this.deletereqs=deletereqs; } JSP logic:iterate id=allrc name=allreqcand tr align=left td html:checkbox name=allrc property=deletereqs value=check / /td /tr /logic:iterate Then in the action, i want to check what r all the check boxes checked. How can i do that one. Shall i use the request.getParametervalues(); Any othet option u know, how to perform in action. Mail your opinion. -Original Message- From: Claire Wall [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 3:21 PM To: Struts Users Mailing List Subject: Re: Getting the CheckBox Collection Value in FormBean Class Do you mean that you want to store checkbox values in a form bean? if so... You can set up an empty String array in your form bean like this: String[] checkboxes = new String[]{}; and then in your jsp page you can set the property of a checkbox to this array, like: html:checkbox name=FormName property=checkboxes value=???/ when the page is submitted, the checked box values are stored in the array - you can then use them how you wish in your action. Note though that you have to set the value of the checkbox if you are going to have anything submitted to the array in the form. HTH claire :) - Original Message - From: Ramachandran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 02, 2004 9:38 AM Subject: Getting the CheckBox Collection Value in FormBean Class Hi All, If any body know how to get the solution for getting the check box collection value in the form bean class. If so mail your ideas... Thanx, Ram - 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: Getting the CheckBox Collection Value in FormBean Class
What is 'allreqcand'? I'm assuming that this is the name of your form bean. When the form is submitted, whatever is the value of the check box will be stored in the array (and only the checked ones will be submitted). So in the example you gave, the values that will be stored in the array will be the string 'check', which isnt very helpful. You should be able to determine which boxes were checked by iterating through the array in your action like so: for(int i = 0; i myform.getDeletereqs().length; i++) { //log the values of the checkboxes so you can see if its working. } the most important thing first is to check that something is being submitted to the array when boxes are selected. If you log the values to the log file by looping through the array in your action then you can see what's going on. The next step is to get something useful to be submitted to the array (values of the checkboxes). - Original Message - From: Ramachandran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 02, 2004 10:11 AM Subject: RE: Getting the CheckBox Collection Value in FormBean Class Yes Claire, I am doing like that only.This is my jsp,contains the code. I am nested inside the iteration. FORM BEAN public String[] getDeletereqs() { return this.deletereqs; } public void setDeletereqs(String[] deletereqs) { this.deletereqs=deletereqs; } JSP logic:iterate id=allrc name=allreqcand tr align=left td html:checkbox name=allrc property=deletereqs value=check / /td /tr /logic:iterate Then in the action, i want to check what r all the check boxes checked. How can i do that one. Shall i use the request.getParametervalues(); Any othet option u know, how to perform in action. Mail your opinion. -Original Message- From: Claire Wall [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 3:21 PM To: Struts Users Mailing List Subject: Re: Getting the CheckBox Collection Value in FormBean Class Do you mean that you want to store checkbox values in a form bean? if so... You can set up an empty String array in your form bean like this: String[] checkboxes = new String[]{}; and then in your jsp page you can set the property of a checkbox to this array, like: html:checkbox name=FormName property=checkboxes value=???/ when the page is submitted, the checked box values are stored in the array - you can then use them how you wish in your action. Note though that you have to set the value of the checkbox if you are going to have anything submitted to the array in the form. HTH claire :) - Original Message - From: Ramachandran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 02, 2004 9:38 AM Subject: Getting the CheckBox Collection Value in FormBean Class Hi All, If any body know how to get the solution for getting the check box collection value in the form bean class. If so mail your ideas... Thanx, Ram - 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: Getting the CheckBox Collection Value in FormBean Class
Ramachandran, The following is what we use. Read html:multibox doc. logic:iterate id=item property=deletereqs name=form tr bgcolor=#EEF1F7 class=text_bold height=20 td html:multibox property=selectedDeletereqs bean:write name=item/ /html:multibox /td td bean:write name=item/ /td /tr /logic:iterate In your form. private String[] selectedDeletereqs; private String[] deletereqs; public String[] getDeletereqs() { return this.deletereqs; } public void setDeletereqs(String[] deletereqs) { this.deletereqs=deletereqs; } public String[] getSelectedDeletereqs() { return this.selectedDeletereqs; } public void setSelectedDeletereqs(String[] selectedDeletereqs) { this.selectedDeletereqs= selectedDeletereqs; } Mohan -Original Message- From: Ramachandran [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 3:42 PM To: Struts Users Mailing List Subject: RE: Getting the CheckBox Collection Value in FormBean Class Yes Claire, I am doing like that only.This is my jsp,contains the code. I am nested inside the iteration. FORM BEAN public String[] getDeletereqs() { return this.deletereqs; } public void setDeletereqs(String[] deletereqs) { this.deletereqs=deletereqs; } JSP logic:iterate id=allrc name=allreqcand tr align=left td html:checkbox name=allrc property=deletereqs value=check / /td /tr /logic:iterate Then in the action, i want to check what r all the check boxes checked. How can i do that one. Shall i use the request.getParametervalues(); Any othet option u know, how to perform in action. Mail your opinion. -Original Message- From: Claire Wall [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 3:21 PM To: Struts Users Mailing List Subject: Re: Getting the CheckBox Collection Value in FormBean Class Do you mean that you want to store checkbox values in a form bean? if so... You can set up an empty String array in your form bean like this: String[] checkboxes = new String[]{}; and then in your jsp page you can set the property of a checkbox to this array, like: html:checkbox name=FormName property=checkboxes value=???/ when the page is submitted, the checked box values are stored in the array - you can then use them how you wish in your action. Note though that you have to set the value of the checkbox if you are going to have anything submitted to the array in the form. HTH claire :) - Original Message - From: Ramachandran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 02, 2004 9:38 AM Subject: Getting the CheckBox Collection Value in FormBean Class Hi All, If any body know how to get the solution for getting the check box collection value in the form bean class. If so mail your ideas... Thanx, Ram - 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]
CheckBox Collection Value in FormBean Class
Hi All, I am having list of check boxes in a page. My Scenario is, if i checked a check box, then if i click the submit button, it should delete. Then how can i relate the check box selection to the record which is to be deleted I am listing the records in JSP using logic:iterate. Inside the iteration for dsipalying check boxes, i inserted tdhtml:checkbox name= value= property=/ But how can i relate selection with the records to be deleted Like what we done in yahoo and rediff... Check BoxReq Id Company Name Contact Name 1 x y 2 h g - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
indexed checkbox and set method
I want to use a form that looks like this : form input type=checkbox name=indexProp[1] value=value1/ input type=checkbox name=indexProp[1] value=value2/ input type=checkbox name=indexProp[2] value=value1/ input type=checkbox name=indexProp[2] value=value2/ .. /form I made my form bean with this get : public class AddRACIForm extends ActionForm { private List prop = new ArrayList(); .. public void setIndexProp(int key, Object myobject) { this.prop.set(key, myobject); } } But if I check both boxes value1 and value2 for, say, indexProp[1], the Object myobject I get in setIndexProp() is the String value1 only (and never value2). How can I do to get an array of string[] in my action form, instead of a string ? Thanks in advance, Emmanuel --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004
Checkbox problem
Hi Group, I am using Struts 1.1 version. I have a page in which i display a set of checkboxes(10 checkboxes to be specific). All the checkboxes have the same name and have different values. I have an ActionForm for this. In the ActionForm, i have a String[] checkBoxArr to represent these checkboxes. I have a condition that i have to check one particular checkbox out of the ten. Some said to set this in the constructor. Please suggest a way for doing this. Many Thanks, Janarthan S - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!
checkbox taglib problem
Hi all, how can I set value to the formbean for non checked checkbox (I use checkbox taglib from struts)? If in HTML form is checkbox unchecked, this value is not sent, but I don't want to have in my formbean value null, but default value. Thanx miro
checkbox - simple question
Hello, The value of a checkbox is added to the sessionScope. How can i print checked box 1 and not checked box1 using the logic taglib ? Thanks
RE: Boolean checkbox in session form
In my particular case (not saying its the general case) I was having a DispatchAction in a wizard navigation, going forwards and backwards, and a form in session. In one page, I turn the checkbox on, and then, when I wanted to turn it off (for, example, if turning it on was wrong and in this wizard you want to correct this) the off was never sent. And if in the reset y have to turn it off I would set it to false when I shouldnt (very very complicated). So that's why I made this tag extension. I map this property to a boolean one. I'm attaching the code just in case anyone is interested. Have a nice year! Guillermo. -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED] Sent: Lunes, 29 de Diciembre de 2003 07:13 p.m. To: Struts Users Mailing List Subject: RE: Boolean checkbox in session form Quoting Tim Lucia [EMAIL PROTECTED]: Care to share? This would be a very, very useful extension. Is there any plan(s) for future Struts release(s) to support some attribute of this sort? Something like forceFalse='true' or forceValue='true'. Tim Guillermo is trying work too hard. The standard approach to dealing with boolean form bean properties (presented by a checkbox) is to set the boolean property to false in the reset method of your form bean, which is called every time the form is submitted. If the user checked the box, then the property will be set to true in processPopulate(). Now, if you want to reset the property again before forwarding back to the same page again (so that it's always rendered as unchecked when the page is displayed), just have your Action set the boolean property to false. That is what controls how the checkbox is rendered -- in EXACTLY the same way that an Action can preconfigure any other form field by setting the corresponding form bean property before fowarding to the page. Craig McClanahan -Original Message- From: Guillermo Meyer [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 4:40 PM To: 'Struts Users Mailing List' Subject: RE: Boolean checkbox in session form To solve this problem, i created a new taglib for checkbox (extending BaseFieldTag), that creates a hidden input with a value of true|false and an auxiliary checkbox (named as propertyName + _chk) with a javascript handler that checks on checkbox value to set true or false to the hidden field, so always is posted a true or a false value from UI and set to the appropiate form attribute, and this way you can avoid reseting value in reset form. -Original Message- From: Franck [mailto:[EMAIL PROTECTED] Sent: Lunes, 29 de Diciembre de 2003 06:13 p.m. To: 'Struts Users Mailing List' Subject: Boolean checkbox in session form Hi, I'm becoming mad ... Explain : to handle ActionForm boolean properties with HTML checkbox, we need To initialize the property as false in the reset() method of the ActionForm .. Ok Now, if the Action form is defined in the session scope in the struts-config file The first time the action is called, the bean is put in session scope. The next time (eg submit of another form on the same page), the bean is readed from session scope (RequestProcessor.processActionForm) ... ok After that, the reset() method is called (RequestProcessor.processPopulate) So it's impossible to keep the boolean property as true How can I store the form bean in the session scope with a true boolean property ? Or maybe is there a way to not initialize the boolean properties as false (and update them with checkboxes ) Is my problem understandable ?? Thanks ... Franck Lefebure equipe web http://www.orangecaraibe.com collaborateur http://www.synaxis-partner.com mailto:[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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] CheckBoxTag.zip Description: Zip compressed data - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Q] Assign value to checkbox html tag?
I'm using Struts 1.1. I have an html tag such as: input type=checkbox name=reminders How can I assign a CHECKED/not-Checked based on some OTHER object in my page? As it is here, it uses the reminders attribute of my form. So I guess my question is, how can I set that attribute just before I call the tag? __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
checkbox validation required
Hello! I'm trying to validate a form in which there are two checkboxes. the validation must succeed if at least one of them is checked (i.e. fails if none of them is checked). I know validwhen would be the solution, but I have to use Struts 1.2's requiredif. field property=field1 depends=requiredif varvar-namefield[0]/var-namevar-valuefield2/var-value/var varvar-namefieldTest[0]/var-namevar-valueEQUAL/var-value/var varvar-namefieldValue[0]/var-namevar-valuefalse/var-value/var /field field property=field2 depends=requiredif varvar-namefield[0]/var-namevar-valuefield1/var-value/var varvar-namefieldTest[0]/var-namevar-valueEQUAL/var-value/var varvar-namefieldValue[0]/var-namevar-valuefalse/var-value/var /field field1 and field2 are two checkboxes. (two booleans in the validatorForm) I suppose that what I really need is a maskif rule ;-) has anyone an idea? Thanks, and happy New Year ! Caroline
Boolean checkbox in session form
Hi, I'm becoming mad ... Explain : to handle ActionForm boolean properties with HTML checkbox, we need To initialize the property as false in the reset() method of the ActionForm .. Ok Now, if the Action form is defined in the session scope in the struts-config file The first time the action is called, the bean is put in session scope. The next time (eg submit of another form on the same page), the bean is readed from session scope (RequestProcessor.processActionForm) ... ok After that, the reset() method is called (RequestProcessor.processPopulate) So it's impossible to keep the boolean property as true How can I store the form bean in the session scope with a true boolean property ? Or maybe is there a way to not initialize the boolean properties as false (and update them with checkboxes ) Is my problem understandable ?? Thanks ... Franck Lefebure equipe web http://www.orangecaraibe.com collaborateur http://www.synaxis-partner.com mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Boolean checkbox in session form
To solve this problem, i created a new taglib for checkbox (extending BaseFieldTag), that creates a hidden input with a value of true|false and an auxiliary checkbox (named as propertyName + _chk) with a javascript handler that checks on checkbox value to set true or false to the hidden field, so always is posted a true or a false value from UI and set to the appropiate form attribute, and this way you can avoid reseting value in reset form. -Original Message- From: Franck [mailto:[EMAIL PROTECTED] Sent: Lunes, 29 de Diciembre de 2003 06:13 p.m. To: 'Struts Users Mailing List' Subject: Boolean checkbox in session form Hi, I'm becoming mad ... Explain : to handle ActionForm boolean properties with HTML checkbox, we need To initialize the property as false in the reset() method of the ActionForm .. Ok Now, if the Action form is defined in the session scope in the struts-config file The first time the action is called, the bean is put in session scope. The next time (eg submit of another form on the same page), the bean is readed from session scope (RequestProcessor.processActionForm) ... ok After that, the reset() method is called (RequestProcessor.processPopulate) So it's impossible to keep the boolean property as true How can I store the form bean in the session scope with a true boolean property ? Or maybe is there a way to not initialize the boolean properties as false (and update them with checkboxes ) Is my problem understandable ?? Thanks ... Franck Lefebure equipe web http://www.orangecaraibe.com collaborateur http://www.synaxis-partner.com mailto:[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: Boolean checkbox in session form
Care to share? This would be a very, very useful extension. Is there any plan(s) for future Struts release(s) to support some attribute of this sort? Something like forceFalse='true' or forceValue='true'. Tim -Original Message- From: Guillermo Meyer [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 4:40 PM To: 'Struts Users Mailing List' Subject: RE: Boolean checkbox in session form To solve this problem, i created a new taglib for checkbox (extending BaseFieldTag), that creates a hidden input with a value of true|false and an auxiliary checkbox (named as propertyName + _chk) with a javascript handler that checks on checkbox value to set true or false to the hidden field, so always is posted a true or a false value from UI and set to the appropiate form attribute, and this way you can avoid reseting value in reset form. -Original Message- From: Franck [mailto:[EMAIL PROTECTED] Sent: Lunes, 29 de Diciembre de 2003 06:13 p.m. To: 'Struts Users Mailing List' Subject: Boolean checkbox in session form Hi, I'm becoming mad ... Explain : to handle ActionForm boolean properties with HTML checkbox, we need To initialize the property as false in the reset() method of the ActionForm .. Ok Now, if the Action form is defined in the session scope in the struts-config file The first time the action is called, the bean is put in session scope. The next time (eg submit of another form on the same page), the bean is readed from session scope (RequestProcessor.processActionForm) ... ok After that, the reset() method is called (RequestProcessor.processPopulate) So it's impossible to keep the boolean property as true How can I store the form bean in the session scope with a true boolean property ? Or maybe is there a way to not initialize the boolean properties as false (and update them with checkboxes ) Is my problem understandable ?? Thanks ... Franck Lefebure equipe web http://www.orangecaraibe.com collaborateur http://www.synaxis-partner.com mailto:[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: Boolean checkbox in session form
Quoting Tim Lucia [EMAIL PROTECTED]: Care to share? This would be a very, very useful extension. Is there any plan(s) for future Struts release(s) to support some attribute of this sort? Something like forceFalse='true' or forceValue='true'. Tim Guillermo is trying work too hard. The standard approach to dealing with boolean form bean properties (presented by a checkbox) is to set the boolean property to false in the reset method of your form bean, which is called every time the form is submitted. If the user checked the box, then the property will be set to true in processPopulate(). Now, if you want to reset the property again before forwarding back to the same page again (so that it's always rendered as unchecked when the page is displayed), just have your Action set the boolean property to false. That is what controls how the checkbox is rendered -- in EXACTLY the same way that an Action can preconfigure any other form field by setting the corresponding form bean property before fowarding to the page. Craig McClanahan -Original Message- From: Guillermo Meyer [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 4:40 PM To: 'Struts Users Mailing List' Subject: RE: Boolean checkbox in session form To solve this problem, i created a new taglib for checkbox (extending BaseFieldTag), that creates a hidden input with a value of true|false and an auxiliary checkbox (named as propertyName + _chk) with a javascript handler that checks on checkbox value to set true or false to the hidden field, so always is posted a true or a false value from UI and set to the appropiate form attribute, and this way you can avoid reseting value in reset form. -Original Message- From: Franck [mailto:[EMAIL PROTECTED] Sent: Lunes, 29 de Diciembre de 2003 06:13 p.m. To: 'Struts Users Mailing List' Subject: Boolean checkbox in session form Hi, I'm becoming mad ... Explain : to handle ActionForm boolean properties with HTML checkbox, we need To initialize the property as false in the reset() method of the ActionForm .. Ok Now, if the Action form is defined in the session scope in the struts-config file The first time the action is called, the bean is put in session scope. The next time (eg submit of another form on the same page), the bean is readed from session scope (RequestProcessor.processActionForm) ... ok After that, the reset() method is called (RequestProcessor.processPopulate) So it's impossible to keep the boolean property as true How can I store the form bean in the session scope with a true boolean property ? Or maybe is there a way to not initialize the boolean properties as false (and update them with checkboxes ) Is my problem understandable ?? Thanks ... Franck Lefebure equipe web http://www.orangecaraibe.com collaborateur http://www.synaxis-partner.com mailto:[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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
checkbox value from getter in collection of value object
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]
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]
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]
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]
iterate and checkbox (getting frustated)
Hello i have a little problem with the iterate tag and checkbox i have a collection of some beans: private aBean{ String id; //+ getter and Setter } The collection is in another bean private colBean{ Hashtable col; //+ getter and setter } the bean is posted in the session under scopeVar Now i want to iiterate over the collection and show every aBean in the jsp page like follows works logic-el:iterate collection=${scopeVar.col} id=thebean indexId=index c:out value=${thebean.id}/ /logic-el:iterate now i want to show it as an checkbox and save the values in a formBean private formBean extends ActionForm{ private String selection; //+Getter and Setter } but how do i do this? following doesnt work logic-el:iterate collection=${scopeVar.col} id=thebean indexId=index html-el:checkbox name=selection property=id indexed=true/ c:out value=${thebean.id}/ /logic-el:iterate can anyone help me please? Thx for any help Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem in javascript for select enabled/disabled by checkbox in a list with in logic iterate
Hi All, Please help me on select enabled/disabled by checkbox in a list with in logic iterate I am not able to pass the index for disableing select box basing on check box enale/disable please look at the code part onclick=this.form.subscriptions['%=index %'].selectedWalletItemId.disabled=this.checked?false:true; in the following code. I tried it different ways ...but no success. Other wise also if I want to use simple onclick= sumbit(), to do something action class and refresh, I do not know how to pass the index or other parameters through Any amount of help is really appreciated as this is code in production. Thank you -Udaya Allu logic:iterate name=safeRenewForm property=subscriptions id=subscriptions indexId=index td html:select name=subscriptions property=selectedWalletItemId indexed=true onchange=alert(this.name); html:option value=Select Credit CardSelect Credit Card/html:option logic:iterate id=idx name=safeRenewForm property=walletItems indexId=index bean:define id=blah name=idx property=walletItemID/ html:option value=%= + blah % bbean:write name=idx property=tender.cardType.cardName//b -bean:write name=idx property=tender.last4Digits/nbsp; bean:write name=idx property=tender.expMonth //bean:write name=idx property=tender.expYear/ /html:option /logic:iterate /html:select /td td align=centerhtml:checkbox name=subscriptions property=statusEnabled indexed=true onclick=this.form.subscriptions['%=index %'].selectedWalletItemId.disabled=this.checked?false:true;//td logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem in javascript for select enabled/disabled by checkbox in a list with in logic iterate
Well, sorry but you can't use the disabled property for one of a select element's options, you can use it for the whole select. F. - Original Message - From: Udaya Allu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 11, 2003 5:17 PM Subject: problem in javascript for select enabled/disabled by checkbox in a list with in logic iterate Hi All, Please help me on select enabled/disabled by checkbox in a list with in logic iterate I am not able to pass the index for disableing select box basing on check box enale/disable please look at the code part onclick=this.form.subscriptions['%=index %'].selectedWalletItemId.disabled=this.checked?false:true; in the following code. I tried it different ways ...but no success. Other wise also if I want to use simple onclick= sumbit(), to do something action class and refresh, I do not know how to pass the index or other parameters through Any amount of help is really appreciated as this is code in production. Thank you -Udaya Allu logic:iterate name=safeRenewForm property=subscriptions id=subscriptions indexId=index td html:select name=subscriptions property=selectedWalletItemId indexed=true onchange=alert(this.name); html:option value=Select Credit CardSelect Credit Card/html:option logic:iterate id=idx name=safeRenewForm property=walletItems indexId=index bean:define id=blah name=idx property=walletItemID/ html:option value=%= + blah % bbean:write name=idx property=tender.cardType.cardName//b -bean:write name=idx property=tender.last4Digits/nbsp; bean:write name=idx property=tender.expMonth //bean:write name=idx property=tender.expYear/ /html:option /logic:iterate /html:select /td td align=centerhtml:checkbox name=subscriptions property=statusEnabled indexed=true onclick=this.form.subscriptions['%=index %'].selectedWalletItemId.disabled=this.checked?false:true;//td logic:iterate - 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: problem in javascript for select enabled/disabled by checkbox in a list with in logic iterate
HI Firat, I am using it for for the whole select. It is working fine out side logic iterate in normal html select when I tried as follws. But in logic iterate I could not provide reference of name for select like sampleSelect in indexed way like sampleSelectArray[index].sampleSelect dynamically. Thank you for understanding. -Udaya Allu td select name=sampleSelect disabled=true option value=Select Card/option option value=bVisa/b -5678 10/2005/option option value=bAmex/b -6854 12/2005/option option value=bAmex/b -4211 10/2005/option option value=bVisa/b -5678 10/2004/option /select /td td align=centerinput type=checkbox onclick=sampleSelect.disabled=this.checked?false:true/td -Original Message- From: Firat TIRYAKI [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 10:25 AM To: Struts Users Mailing List Subject: Re: problem in javascript for select enabled/disabled by checkbox in a list with in logic iterate Well, sorry but you can't use the disabled property for one of a select element's options, you can use it for the whole select. F. - Original Message - From: Udaya Allu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 11, 2003 5:17 PM Subject: problem in javascript for select enabled/disabled by checkbox in a list with in logic iterate Hi All, Please help me on select enabled/disabled by checkbox in a list with in logic iterate I am not able to pass the index for disableing select box basing on check box enale/disable please look at the code part onclick=this.form.subscriptions['%=index %'].selectedWalletItemId.disabled=this.checked?false:true; in the following code. I tried it different ways ...but no success. Other wise also if I want to use simple onclick= sumbit(), to do something action class and refresh, I do not know how to pass the index or other parameters through Any amount of help is really appreciated as this is code in production. Thank you -Udaya Allu logic:iterate name=safeRenewForm property=subscriptions id=subscriptions indexId=index td html:select name=subscriptions property=selectedWalletItemId indexed=true onchange=alert(this.name); html:option value=Select Credit CardSelect Credit Card/html:option logic:iterate id=idx name=safeRenewForm property=walletItems indexId=index bean:define id=blah name=idx property=walletItemID/ html:option value=%= + blah % bbean:write name=idx property=tender.cardType.cardName//b -bean:write name=idx property=tender.last4Digits/nbsp; bean:write name=idx property=tender.expMonth //bean:write name=idx property=tender.expYear/ /html:option /logic:iterate /html:select /td td align=centerhtml:checkbox name=subscriptions property=statusEnabled indexed=true onclick=this.form.subscriptions['%=index %'].selectedWalletItemId.disabled=this.checked?false:true;//td logic:iterate - 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]
checkbox condition check
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
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]
validatation : the select field and checkbox field origin value lost...
hi, i'am sorry to trouble you if you receive this mail list about struts, i hope you can give me a suggetion. first, i found a question about struts validation . when you submit a form , and the validate method will valiate the form field. if the form element is a text filed, you un-inpute the text filed, you will be noticed that you must fill the text filed,and the other text field you have filled with some data, after the form submit, the other text field 's data still in the text field , but the select field you have choiced before has changed to the default value, it can't remain the value you choiced before. but the text filed can keep the value, what should do to keep the select field 's value to that my selected before the form submit to check the validation. and the checkbox field is the same as select field? i don't know whether you can understand what i said, i don't think i can express my problem to everyone... i hope you can understand it... :) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Antwort: validatation : the select field and checkbox field origin value lost...
If you want to prove the value of a checkbox, you have to check the request. If the request doesn´t contain a value with the name of the checkbox, you have to erase the value of your checkbox-variable in FormBean. Hope to help you, Manuel |-+ | || | || | || | |Ricky | | |[EMAIL PROTECTED] | | |28.11.2003 13:58| | |Bitte antworten an Struts | | |Users Mailing List | |-+ | | | | An: Struts Users Mailing List [EMAIL PROTECTED] | | Kopie: | | Thema: validatation : the select field and checkbox field origin value lost... | | hi, i'am sorry to trouble you if you receive this mail list about struts, i hope you can give me a suggetion. first, i found a question about struts validation . when you submit a form , and the validate method will valiate the form field. if the form element is a text filed, you un-inpute the text filed, you will be noticed that you must fill the text filed,and the other text field you have filled with some data, after the form submit, the other text field 's data still in the text field , but the select field you have choiced before has changed to the default value, it can't remain the value you choiced before. but the text filed can keep the value, what should do to keep the select field 's value to that my selected before the form submit to check the validation. and the checkbox field is the same as select field? i don't know whether you can understand what i said, i don't think i can express my problem to everyone... i hope you can understand it... :) - 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: validatation : the select field and checkbox field origin value lost...
Hi Ricky, After validation, struts will display whatever you specified in the input parameter of your action mapping. If you specify an action (like displayForm.do), then all of the processing that is done in that action will be performed before the page is shown. I suspect this is why the values on the form that were changed have gone back to their defaults. What you probably want to do instead is specify the .jsp page that you would normally forward to upon success (like myForm.jsp). hth, Janice - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: validation : the select field and checkbox field origin value lost...
thanks for helping me.. and then i search a question like this at achieve mailing and it told me use html:option, and i test it, the solution is ok, but, what a pity, i can't use html:option , because.. if i use it...it will show me the exception :equal symbol expected in the jsp page , i use a logic:iterate to add my option element, and can't nested a html:option in it. just like this. logic:iterate name=authors id=author html:option value=bean:write name=author property=author_id /bean:write name=author property=author_name //html:option /logic:iterate if i use that code above , it shows me the exception... so i have to abandon the html:option tag, what a pity... :( i can only use common html syntax option, so my first problem you replied me come out.. and could anyone have a better solution about my case? or i can change the login:iterate to java script as java.util.List to use a loop to get my select option...in fact, i don't want insert a java script in my page, all of my page are using taglib, none java script within my jsp page and what about nested tag... any other better way? - Original Message - From: Janice [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, November 29, 2003 12:15 AM Subject: re: validatation : the select field and checkbox field origin value lost... Hi Ricky, After validation, struts will display whatever you specified in the input parameter of your action mapping. If you specify an action (like displayForm.do), then all of the processing that is done in that action will be performed before the page is shown. I suspect this is why the values on the form that were changed have gone back to their defaults. What you probably want to do instead is specify the .jsp page that you would normally forward to upon success (like myForm.jsp). hth, Janice - 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: validation : the select field and checkbox field origin value lost...
Ricky, it is possible to do what you wish to do by doing the following (example taken from a similiar thing that i did): logic:iterate id=user name=myForm property=users bean:define id=id property=id name=user/ html:option value=%= (String)id %bean:write name=user property=username//html:option /logic:iterate here i am iterating through a list of User objects in my form (my User object is basically a class with the fields 'id' and 'username'). By using bean:define.. you can then use a JSP expression to set the value of the html:option using the id of the bean:define. So in your case it will be something like: logic:iterate name=authors id=author bean:define id=an_author property=author_id name=author/ html:option value=%= (String)an_author % bean:write name=author property=author_name / /html:option /logic:iterate hope this helps claire - Original Message - From: Ricky [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, November 28, 2003 4:37 PM Subject: Re: validation : the select field and checkbox field origin value lost... thanks for helping me.. and then i search a question like this at achieve mailing and it told me use html:option, and i test it, the solution is ok, but, what a pity, i can't use html:option , because.. if i use it...it will show me the exception :equal symbol expected in the jsp page , i use a logic:iterate to add my option element, and can't nested a html:option in it. just like this. logic:iterate name=authors id=author html:option value=bean:write name=author property=author_id /bean:write name=author property=author_name //html:option /logic:iterate if i use that code above , it shows me the exception... so i have to abandon the html:option tag, what a pity... :( i can only use common html syntax option, so my first problem you replied me come out.. and could anyone have a better solution about my case? or i can change the login:iterate to java script as java.util.List to use a loop to get my select option...in fact, i don't want insert a java script in my page, all of my page are using taglib, none java script within my jsp page and what about nested tag... any other better way? - Original Message - From: Janice [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, November 29, 2003 12:15 AM Subject: re: validatation : the select field and checkbox field origin value lost... Hi Ricky, After validation, struts will display whatever you specified in the input parameter of your action mapping. If you specify an action (like displayForm.do), then all of the processing that is done in that action will be performed before the page is shown. I suspect this is why the values on the form that were changed have gone back to their defaults. What you probably want to do instead is specify the .jsp page that you would normally forward to upon success (like myForm.jsp). hth, Janice - 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: validation : the select field and checkbox field origin value lost...
thanks for helping me! i have been solved it.. your idea was very good! before i use %=(String)an_author%, it throws a exception, '[ServletException in:/tiles/admin/selectAuthor.jsp] null' i don't know why, because the author_id data type is a java.lang.Integer... until i changed it to %=an_author.toString()% , now ,it's work... - Original Message - From: Claire Wall [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, November 29, 2003 12:56 AM Subject: Re: validation : the select field and checkbox field origin value lost... Ricky, it is possible to do what you wish to do by doing the following (example taken from a similiar thing that i did): logic:iterate id=user name=myForm property=users bean:define id=id property=id name=user/ html:option value=%= (String)id %bean:write name=user property=username//html:option /logic:iterate here i am iterating through a list of User objects in my form (my User object is basically a class with the fields 'id' and 'username'). By using bean:define.. you can then use a JSP expression to set the value of the html:option using the id of the bean:define. So in your case it will be something like: logic:iterate name=authors id=author bean:define id=an_author property=author_id name=author/ html:option value=%= (String)an_author % bean:write name=author property=author_name / /html:option /logic:iterate hope this helps claire - Original Message - From: Ricky [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, November 28, 2003 4:37 PM Subject: Re: validation : the select field and checkbox field origin value lost... thanks for helping me.. and then i search a question like this at achieve mailing and it told me use html:option, and i test it, the solution is ok, but, what a pity, i can't use html:option , because.. if i use it...it will show me the exception :equal symbol expected in the jsp page , i use a logic:iterate to add my option element, and can't nested a html:option in it. just like this. logic:iterate name=authors id=author html:option value=bean:write name=author property=author_id /bean:write name=author property=author_name //html:option /logic:iterate if i use that code above , it shows me the exception... so i have to abandon the html:option tag, what a pity... :( i can only use common html syntax option, so my first problem you replied me come out.. and could anyone have a better solution about my case? or i can change the login:iterate to java script as java.util.List to use a loop to get my select option...in fact, i don't want insert a java script in my page, all of my page are using taglib, none java script within my jsp page and what about nested tag... any other better way? - Original Message - From: Janice [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, November 29, 2003 12:15 AM Subject: re: validatation : the select field and checkbox field origin value lost... Hi Ricky, After validation, struts will display whatever you specified in the input parameter of your action mapping. If you specify an action (like displayForm.do), then all of the processing that is done in that action will be performed before the page is shown. I suspect this is why the values on the form that were changed have gone back to their defaults. What you probably want to do instead is specify the .jsp page that you would normally forward to upon success (like myForm.jsp). hth, Janice - 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]
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]
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]
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
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]
reacting to changes on the checkbox
I wonder if there is a struts way for reacting to changes on the checkbox and making changes to other controls as a result. What I would like to happen is to disable a submit button when no checkbox is selected, and enable it when only one checkbox is selected, disable it again if more than one checkbox are selected. Can anybody show me a example code? Thanks a bunch! __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to disable submit button when click on checkbox
I have a question regarding checkbox, how can I disable a certain submit button when click on a checkbox? I tried the following but is not working: html:submit property=delete value=Delete/ html:checkbox property=ids value=id onclick=document.formName.delete.disabled=true / Also, is there a way I can count how many checkbox are selected in my jsp code? Please kindly help me. - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
RE: how to disable submit button when click on checkbox
Thanks for the reply. Do you mean change it to onclick=this.form.delete.disabled=true?It's still not working. The checkbox is not even checked when click on it. David Friedman [EMAIL PROTECTED] wrote:Philip, If it is in the same ... form tag, try this javascript: this.form.delete.disabled=true -David -Original Message- From: Philip [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 11:02 PM To: [EMAIL PROTECTED] Subject: how to disable submit button when click on checkbox I have a question regarding checkbox, how can I disable a certain submit button when click on a checkbox? I tried the following but is not working: onclick=document.formName.delete.disabled=true / Also, is there a way I can count how many checkbox are selected in my jsp code? Please kindly help me. - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard
RE: how to disable submit button when click on checkbox
I misread your post. If the checkboxes are in the same form, here is some example javascript code in an HTML page (save it as example.html, check some boxes, then hit submit. Everything you need to know should be in it. The rest is between you and JavaScript. html head titletitle /title /head body script language=javascript function traverse(frm) { var i = frm.length; alert(size: + i + elements); for ( j = 0 ;j i ; j++ ) { if ( frm.elements[j].type == checkbox ) { alert( Analyzing type + frm.elements[j].type + , named + frm.elements[j].name + , value + frm.elements[j].value + , checked + frm.elements[j].checked ); } }; return david.html; } /script form name=david action=example.html onSubmit=traverse(this) input type=checkbox name=id value=11 input type=checkbox name=id value=22 input type=submit name=submit value=submit /form /body /html -Original Message- From: YuenSun Lam [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 11:49 PM To: Struts Users Mailing List Subject: RE: how to disable submit button when click on checkbox Thanks for the reply. Do you mean change it to onclick=this.form.delete.disabled=true?It's still not working. The checkbox is not even checked when click on it. David Friedman [EMAIL PROTECTED] wrote:Philip, If it is in the same ... form tag, try this javascript: this.form.delete.disabled=true -David -Original Message- From: Philip [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 11:02 PM To: [EMAIL PROTECTED] Subject: how to disable submit button when click on checkbox I have a question regarding checkbox, how can I disable a certain submit button when click on a checkbox? I tried the following but is not working: onclick=document.formName.delete.disabled=true / Also, is there a way I can count how many checkbox are selected in my jsp code? Please kindly help me. - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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]
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]
Required checkbox field Validator
Hi, I have a DynaActionForm with a boolean field representing a checkbox field which must be checked before processing the form. I've tried marking him as depending on 'required' but that didn't do it and the server side FieldChecks.validateRequired () of Struts just let it pass. Going into the code I saw that the field already have a value of 'false' thus it passes the check of not being null or blank. Now, I can put the code into my Action or into the derived form class validate() method but I think that was not the idea of having an infrastructure of validations. How can this be done? Have I missed anything? I am using Struts 1.1 (the released version). TIA, Erez - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Required checkbox field Validator
On 10/15/2003 02:23 PM Erez Efrati wrote: I have a DynaActionForm with a boolean field representing a checkbox field which must be checked before processing the form. I've tried marking him as depending on 'required' but that didn't do it and the server side FieldChecks.validateRequired () of Struts just let it pass. Going into the code I saw that the field already have a value of 'false' thus it passes the check of not being null or blank. Now, I can put the code into my Action or into the derived form class validate() method but I think that was not the idea of having an infrastructure of validations. How can this be done? Have I missed anything? This might be a kludge, but have you tried a validate mask = 'true'? Otherwise I think it's not do-able with the standard validations. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Required checkbox field Validator
Do you mean putting a mask with value of 'true'? In that case, I haven't but I will do it. Is it a valid mask value? If this doesn't work I guess I'd have to write one of my own. Erez -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:02 PM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator On 10/15/2003 02:23 PM Erez Efrati wrote: I have a DynaActionForm with a boolean field representing a checkbox field which must be checked before processing the form. I've tried marking him as depending on 'required' but that didn't do it and the server side FieldChecks.validateRequired () of Struts just let it pass. Going into the code I saw that the field already have a value of 'false' thus it passes the check of not being null or blank. Now, I can put the code into my Action or into the derived form class validate() method but I think that was not the idea of having an infrastructure of validations. How can this be done? Have I missed anything? This might be a kludge, but have you tried a validate mask = 'true'? Otherwise I think it's not do-able with the standard validations. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - 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: Required checkbox field Validator
One thing else I don't get is why does the checkups in the client side validations are not done field by field, where on each field run all the checks it depends on? Am I so special and unique to be doing it this way? Erez -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:02 PM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator On 10/15/2003 02:23 PM Erez Efrati wrote: I have a DynaActionForm with a boolean field representing a checkbox field which must be checked before processing the form. I've tried marking him as depending on 'required' but that didn't do it and the server side FieldChecks.validateRequired () of Struts just let it pass. Going into the code I saw that the field already have a value of 'false' thus it passes the check of not being null or blank. Now, I can put the code into my Action or into the derived form class validate() method but I think that was not the idea of having an infrastructure of validations. How can this be done? Have I missed anything? This might be a kludge, but have you tried a validate mask = 'true'? Otherwise I think it's not do-able with the standard validations. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - 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: Required checkbox field Validator
Sorry, no idea! I was just taking a wild guess. I thought a mask was a regular expression. Is that not so? On 10/15/2003 03:14 PM Erez Efrati wrote: Do you mean putting a mask with value of 'true'? In that case, I haven't but I will do it. Is it a valid mask value? If this doesn't work I guess I'd have to write one of my own. Erez -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:02 PM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator On 10/15/2003 02:23 PM Erez Efrati wrote: I have a DynaActionForm with a boolean field representing a checkbox field which must be checked before processing the form. I've tried marking him as depending on 'required' but that didn't do it and the server side FieldChecks.validateRequired () of Struts just let it pass. Going into the code I saw that the field already have a value of 'false' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Required checkbox field Validator
If I think you mean what you mean, I think it's done so that any depends validation that fails returns and no more validations on that field are done. But I've seen all fields getting validated in my client-side stuff. On 10/15/2003 03:19 PM Erez Efrati wrote: One thing else I don't get is why does the checkups in the client side validations are not done field by field, where on each field run all the checks it depends on? Am I so special and unique to be doing it this way? Erez -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:02 PM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator On 10/15/2003 02:23 PM Erez Efrati wrote: I have a DynaActionForm with a boolean field representing a checkbox field which must be checked before processing the form. I've tried marking him as depending on 'required' but that didn't do it and the server side FieldChecks.validateRequired () of Struts just let it pass. Going into the code I saw that the field already have a value of 'false' thus it passes the check of not being null or blank. Now, I can put the code into my Action or into the derived form class validate() method but I think that was not the idea of having an infrastructure of validations. How can this be done? Have I missed anything? This might be a kludge, but have you tried a validate mask = 'true'? Otherwise I think it's not do-able with the standard validations. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Required checkbox field Validator
Please help me in unsubscribing to this list. I have sent multiple request to unsubscribe by sending email to [EMAIL PROTECTED] I get email confirming that I have been unsubscribed successfully but then also I keep getting emails from the user list. Thanks for your help in advance. Prashant Shah 860-547-4947 -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 9:52 AM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator Sorry, no idea! I was just taking a wild guess. I thought a mask was a regular expression. Is that not so? On 10/15/2003 03:14 PM Erez Efrati wrote: Do you mean putting a mask with value of 'true'? In that case, I haven't but I will do it. Is it a valid mask value? If this doesn't work I guess I'd have to write one of my own. Erez -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:02 PM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator On 10/15/2003 02:23 PM Erez Efrati wrote: I have a DynaActionForm with a boolean field representing a checkbox field which must be checked before processing the form. I've tried marking him as depending on 'required' but that didn't do it and the server side FieldChecks.validateRequired () of Struts just let it pass. Going into the code I saw that the field already have a value of 'false' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Required checkbox field Validator
Forgive me for abusing this thread but... by the way how do you insert a '-' and space chars into a validator mask regular expression? Erez -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:55 PM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator If I think you mean what you mean, I think it's done so that any depends validation that fails returns and no more validations on that field are done. But I've seen all fields getting validated in my client-side stuff. On 10/15/2003 03:19 PM Erez Efrati wrote: One thing else I don't get is why does the checkups in the client side validations are not done field by field, where on each field run all the checks it depends on? Am I so special and unique to be doing it this way? Erez -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:02 PM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator On 10/15/2003 02:23 PM Erez Efrati wrote: I have a DynaActionForm with a boolean field representing a checkbox field which must be checked before processing the form. I've tried marking him as depending on 'required' but that didn't do it and the server side FieldChecks.validateRequired () of Struts just let it pass. Going into the code I saw that the field already have a value of 'false' thus it passes the check of not being null or blank. Now, I can put the code into my Action or into the derived form class validate() method but I think that was not the idea of having an infrastructure of validations. How can this be done? Have I missed anything? This might be a kludge, but have you tried a validate mask = 'true'? Otherwise I think it's not do-able with the standard validations. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - 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: Required checkbox field Validator
Sorry, don't know. Someone else will have to answer this. Adam On 10/15/2003 04:04 PM Erez Efrati wrote: Forgive me for abusing this thread but... by the way how do you insert a '-' and space chars into a validator mask regular expression? Erez -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:55 PM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator If I think you mean what you mean, I think it's done so that any depends validation that fails returns and no more validations on that field are done. But I've seen all fields getting validated in my client-side stuff. On 10/15/2003 03:19 PM Erez Efrati wrote: One thing else I don't get is why does the checkups in the client side validations are not done field by field, where on each field run all the checks it depends on? Am I so special and unique to be doing it this way? Erez -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:02 PM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator On 10/15/2003 02:23 PM Erez Efrati wrote: I have a DynaActionForm with a boolean field representing a checkbox field which must be checked before processing the form. I've tried marking him as depending on 'required' but that didn't do it and the server side FieldChecks.validateRequired () of Struts just let it pass. Going into the code I saw that the field already have a value of 'false' thus it passes the check of not being null or blank. Now, I can put the code into my Action or into the derived form class validate() method but I think that was not the idea of having an infrastructure of validations. How can this be done? Have I missed anything? This might be a kludge, but have you tried a validate mask = 'true'? Otherwise I think it's not do-able with the standard validations. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Required checkbox field Validator
Try \- and \s or \s+ for multiple spaces. Saul -Original Message- From: Erez Efrati [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 10:05 AM To: 'Struts Users Mailing List' Subject: RE: Required checkbox field Validator Forgive me for abusing this thread but... by the way how do you insert a '-' and space chars into a validator mask regular expression? Erez -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:55 PM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator If I think you mean what you mean, I think it's done so that any depends validation that fails returns and no more validations on that field are done. But I've seen all fields getting validated in my client-side stuff. On 10/15/2003 03:19 PM Erez Efrati wrote: One thing else I don't get is why does the checkups in the client side validations are not done field by field, where on each field run all the checks it depends on? Am I so special and unique to be doing it this way? Erez -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:02 PM To: Struts Users Mailing List Subject: Re: Required checkbox field Validator On 10/15/2003 02:23 PM Erez Efrati wrote: I have a DynaActionForm with a boolean field representing a checkbox field which must be checked before processing the form. I've tried marking him as depending on 'required' but that didn't do it and the server side FieldChecks.validateRequired () of Struts just let it pass. Going into the code I saw that the field already have a value of 'false' thus it passes the check of not being null or blank. Now, I can put the code into my Action or into the derived form class validate() method but I think that was not the idea of having an infrastructure of validations. How can this be done? Have I missed anything? This might be a kludge, but have you tried a validate mask = 'true'? Otherwise I think it's not do-able with the standard validations. Adam -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - 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]
Help with Tiles matching a checkbox
I am trying to have a Tile replace an html checkbox with an image. But I can't seem to get this to work. tiles:useAttribute id=beanName name=property classname=java.lang.String ignore=true / tiles:importAttribute name=bean / bean:define id=checkbox name=bean property='%= beanName %' type=java.lang.String value= / logic:present name=bean logic:match name=bean property='%= checkbox %' value=on %= checkbox %:::logicmatchhtml:img bundle=IMAGE_RESOURCES_KEY height=15 width=15 srcKey=default.checked / /logic:match logic:notMatch name=bean property='%= checkbox %' value=on %= checkbox %logic:notMatchhtml:img bundle=IMAGE_RESOURCES_KEY height=15 width=15 srcKey=default.unchecked / /logic:notMatch /logic:present logic:present name=bean logic:match name=bean property='%= checkbox %' value=on %= checkbox %:::logicmatchhtml:img bundle=IMAGE_RESOURCES_KEY height=15 width=15 srcKey=default.checked / /logic:match logic:notMatch name=bean property='%= checkbox %' value=on %= checkbox %logic:notMatchhtml:img bundle=IMAGE_RESOURCES_KEY height=15 width=15 srcKey=default.unchecked / /logic:notMatch /logic:present logic:notPresent name=bean logic:notPresenthtml:img bundle=IMAGE_RESOURCES_KEY height=15 width=15 srcKey=default.unchecked / /logic:notPresent --- Thanks Mick Knutson The world is a playground...Play Hard, Play Smart. Visit http://www.YourSoS.com to learn how our Personal Emergency Alert Contact System can help you Play Smart. +00 1 (708) 570-2772 Fax MSN: mickknutson ICQ: 316498480 ICQ URL: http://wwp.icq.com/316498480 ---
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 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: [Question] Checkbox multi select problem.
u can give index for every checkbox and then access the value of the records according to this index. it's simple with html-el:checkbox property=chk[${idx}]... -Original Message- From: Rajesh M Vasudevan [mailto:[EMAIL PROTECTED] Sent: Saturday, September 27, 2003 11:45 PM To: Struts Users Mailing List Subject: Re: [Question] Checkbox multi select problem. Hi, Can you help me with this.. I want to pass the record ids selected by the user using a checkbox, to the Action Bean, when the page is submitted. CheckUnique Rec Ids X1000 X1001 X1002 X1003 The number of rows is dynamic, as it depends on the number of rows retrieved from the database. Please advise how to do this? Thanks very much, Rajesh - 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: [Question] Checkbox multi select problem.
Hi, Can you help me with this.. I want to pass the record ids selected by the user using a checkbox, to the Action Bean, when the page is submitted. CheckUnique Rec Ids X1000 X1001 X1002 X1003 The number of rows is dynamic, as it depends on the number of rows retrieved from the database. Please advise how to do this? Thanks very much, Rajesh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to disable a particular checkbox in html:multibox
Hi All, How can I disable a particular checkbox based on a value in the selected items. Here is my code. logic:iterate id=item name=%=FormName.PROPERTY_NB_ADDITIONAL_ITEM_SUMMARY_FORM% property=itemNames td class=font width=4% html:multibox property=selectedItems disabled=true bean:write name=item/ /html:multibox /td td class=font nowrap width=26%nbsp; bean:write name=item/ /td - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
reloading page from array of checkbox
I'm creating checkboxes like this: html:checkbox property=abc value=xx/html:checkbox html:checkbox property=abc value=yy/html:checkbox html:checkbox property=abc value=zz/html:checkbox I define it in my form (DynaForm) like this: form-property name=abc type=java.lang.String[] / This submits to the server fine, all the checkboxes have their value set in the array. However, when reloading the page with the form in the session, the checkboxes don't get set. All my other controls get set from the values in the form, but struts doesn't understand the array of values to set the checkboxes. Is there some trick to doing this? Am I going to have to give each checkbox its own property to get it to set on page load? I know this would work, but I'd rather keep in array if possible. Darrel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Resetting of Checkbox when using logic:iterate Tag
Hi, I have one issue, that is I have some checkboxes within my logic:iterate, and 1) When the user clicks on the checkbox, the property corresponding to the checkbox is set to 'on'. 2) When the user de-clicks the checkbox(removes the check), the checkbox is still set to 'on', how do we reset the checkbox... My code is as follows: logic:iterate name=WorkQueueForm property=workQueueArrList indexId=clmIdx id=indexBean type=com.tgt.dist.icl.formbeans.WorkQueueBean html:select name=indexBean property=updtClaimStatus indexed=true html:option value=nbsp;/html:option html:option value=PP/html:option html:option value=WW/html:option html:option value=AA/html:option html:option value=MM/html:option html:option value=CC/html:option /html:select html:checkbox name=indexBean property=updtClaimPriority indexed=true/html:checkbox /logic:iterate WorkQueueForm is the Form Bean workQueueArrList is a property of the WorkQueue Form Bean which contains WorkQueue Beans. I would be obliged if you could let us know how to reset the checkbox, when the user Deselects the checkbox, the checkbox property in the WorkQeue Bean should be reset to null. Thanks, Raghu -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 10:45 AM To: Struts Users Mailing List Subject: Re: struts test info http://strutstestcase.sourceforge.net/ -Dan - Original Message - From: ronanoc [EMAIL PROTECTED] To: Struts List [EMAIL PROTECTED] Sent: Friday, August 22, 2003 6:13 AM Subject: struts test info Can anyone point me in the direction of good examples and info about using/writing Struts tests other than the documentation that comes with Struts test it self...? Thanks in advance. Ron. Always ready to Discotogogo - 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: Resetting of Checkbox when using logic:iterate Tag
Are you using the reset() method of your ActionForm to set the checkbox to null or false? http://jakarta.apache.org/struts/faqs/newbie.html#checkbox Susan Bradeen On 08/22/2003 12:32:17 PM Raghu.Ramakrishnan wrote: Hi, I have one issue, that is I have some checkboxes within my logic:iterate, and 1) When the user clicks on the checkbox, the property corresponding to the checkbox is set to 'on'. 2) When the user de-clicks the checkbox(removes the check), the checkbox is still set to 'on', how do we reset the checkbox... My code is as follows: logic:iterate name=WorkQueueForm property=workQueueArrList indexId=clmIdx id=indexBean type=com.tgt.dist.icl.formbeans.WorkQueueBean html:select name=indexBean property=updtClaimStatus indexed=true html:option value=nbsp;/html:option html:option value=PP/html:option html:option value=WW/html:option html:option value=AA/html:option html:option value=MM/html:option html:option value=CC/html:option /html:select html:checkbox name=indexBean property=updtClaimPriority indexed=true/html:checkbox /logic:iterate WorkQueueForm is the Form Bean workQueueArrList is a property of the WorkQueue Form Bean which contains WorkQueue Beans. I would be obliged if you could let us know how to reset the checkbox, when the user Deselects the checkbox, the checkbox property in the WorkQeue Bean should be reset to null. Thanks, Raghu -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 10:45 AM To: Struts Users Mailing List Subject: Re: struts test info http://strutstestcase.sourceforge.net/ -Dan - Original Message - From: ronanoc [EMAIL PROTECTED] To: Struts List [EMAIL PROTECTED] Sent: Friday, August 22, 2003 6:13 AM Subject: struts test info Can anyone point me in the direction of good examples and info about using/writing Struts tests other than the documentation that comes with Struts test it self...? Thanks in advance. Ron. Always ready to Discotogogo - 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: Resetting of Checkbox when using logic:iterate Tag
Hi Susan, In my application, I do not have to reset the entire form, as I do an update and return to the same page... The user should be able to see the checkboxes that he set or disabled. Do you have any ideas??? One idea given to me was to read the request parameters and then set the checkboxes according... Plss let me know if you know of anything else... Thanks, Raghu -Original Message- From: Susan Bradeen [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 2:00 PM To: Struts Users Mailing List Subject: Re: Resetting of Checkbox when using logic:iterate Tag Are you using the reset() method of your ActionForm to set the checkbox to null or false? http://jakarta.apache.org/struts/faqs/newbie.html#checkbox Susan Bradeen On 08/22/2003 12:32:17 PM Raghu.Ramakrishnan wrote: Hi, I have one issue, that is I have some checkboxes within my logic:iterate, and 1) When the user clicks on the checkbox, the property corresponding to the checkbox is set to 'on'. 2) When the user de-clicks the checkbox(removes the check), the checkbox is still set to 'on', how do we reset the checkbox... My code is as follows: logic:iterate name=WorkQueueForm property=workQueueArrList indexId=clmIdx id=indexBean type=com.tgt.dist.icl.formbeans.WorkQueueBean html:select name=indexBean property=updtClaimStatus indexed=true html:option value=nbsp;/html:option html:option value=PP/html:option html:option value=WW/html:option html:option value=AA/html:option html:option value=MM/html:option html:option value=CC/html:option /html:select html:checkbox name=indexBean property=updtClaimPriority indexed=true/html:checkbox /logic:iterate WorkQueueForm is the Form Bean workQueueArrList is a property of the WorkQueue Form Bean which contains WorkQueue Beans. I would be obliged if you could let us know how to reset the checkbox, when the user Deselects the checkbox, the checkbox property in the WorkQeue Bean should be reset to null. Thanks, Raghu -Original Message- From: Dan Tran [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 10:45 AM To: Struts Users Mailing List Subject: Re: struts test info http://strutstestcase.sourceforge.net/ -Dan - Original Message - From: ronanoc [EMAIL PROTECTED] To: Struts List [EMAIL PROTECTED] Sent: Friday, August 22, 2003 6:13 AM Subject: struts test info Can anyone point me in the direction of good examples and info about using/writing Struts tests other than the documentation that comes with Struts test it self...? Thanks in advance. Ron. Always ready to Discotogogo - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: single checkbox - still use html:multibox?
Oh I meant taglib api ref, not the javadoc ref. here is the link: http://jakarta.apache.org/struts/userGuide/struts-html.html#checkbox The detail warning msg: 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. -Original Message- From: David Thielen [mailto:[EMAIL PROTECTED] Sent: August 7, 2003 12:26 PM To: 'Struts Users Mailing List' Subject: Re: single checkbox - still use html:multibox? Thanks - the book I have didn't list it so of course I assumed it didn't exist. Any idea what the something special is? The javadocs don't list anything. thanks - dave - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, August 07, 2003 12:19 PM Subject: RE: single checkbox - still use html:multibox? Um, html:checkbox ? Please read the api carefully if you want to use this tag. There is something you have to do in your form's reset()... -Original Message- From: David Thielen [mailto:[EMAIL PROTECTED] Sent: August 7, 2003 11:33 AM To: Struts-Users Subject: single checkbox - still use html:multibox? Hi; If I have a single checkbox on my page, should I still use multibox? And if not, what do I use? thanks - dave - 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]
Validador - Validating an Array... form checkbox property
Hi! I have de following form-beaN: form-bean name=PlacesManageForm type=com.esegur.sims.util.struts.form.BasicDynaValidatorForm form-property name=manageAction type=java.lang.Integer/ form-property name=places type=java.lang.Integer[]/ /form-bean And the respective validation: form name=PlacesManageForm field property=manageAction depends=required,integer arg0 key=place.manageAction/ /field field property=places depends=required,integer arg0 key=place.placesToManage/ /field /form The action to this form is: action path=/planning/places/manage type=com.esegur.sims.web.PlacesManageAction scope=request name=PlacesManageForm input=site.planning.places.manage.form validate=true forward name=goAction path=/planning/places/creation/ /action The property places correspond to a group of checkboxes at html. Even I have any or none checkboxe checked, the validator says the given data for this form isn't correct. When I think it shoulf be correct. Can it be any problem with the fact I have java.lang.Integer[]? Does any one have some example of some similar situation that can give me as help? Thanks. -- José Tomás LINK Consulting SA - http://www.link.pt Av. Duque de Avila 23 5º Dto. - 1000-138 Lisboa Telf: (+351) 213 100 095 Fax: (+351) 213 100 079 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
single checkbox - still use html:multibox?
Hi; If I have a single checkbox on my page, should I still use multibox? And if not, what do I use? thanks - dave
Re: single checkbox - still use html:multibox?
thank you very very much - dave - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, August 07, 2003 12:43 PM Subject: RE: single checkbox - still use html:multibox? Oh I meant taglib api ref, not the javadoc ref. here is the link: http://jakarta.apache.org/struts/userGuide/struts-html.html#checkbox The detail warning msg: 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. -Original Message- From: David Thielen [mailto:[EMAIL PROTECTED] Sent: August 7, 2003 12:26 PM To: 'Struts Users Mailing List' Subject: Re: single checkbox - still use html:multibox? Thanks - the book I have didn't list it so of course I assumed it didn't exist. Any idea what the something special is? The javadocs don't list anything. thanks - dave - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, August 07, 2003 12:19 PM Subject: RE: single checkbox - still use html:multibox? Um, html:checkbox ? Please read the api carefully if you want to use this tag. There is something you have to do in your form's reset()... -Original Message- From: David Thielen [mailto:[EMAIL PROTECTED] Sent: August 7, 2003 11:33 AM To: Struts-Users Subject: single checkbox - still use html:multibox? Hi; If I have a single checkbox on my page, should I still use multibox? And if not, what do I use? thanks - dave - 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: single checkbox - still use html:multibox?
Thanks - the book I have didn't list it so of course I assumed it didn't exist. Any idea what the something special is? The javadocs don't list anything. thanks - dave - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, August 07, 2003 12:19 PM Subject: RE: single checkbox - still use html:multibox? Um, html:checkbox ? Please read the api carefully if you want to use this tag. There is something you have to do in your form's reset()... -Original Message- From: David Thielen [mailto:[EMAIL PROTECTED] Sent: August 7, 2003 11:33 AM To: Struts-Users Subject: single checkbox - still use html:multibox? Hi; If I have a single checkbox on my page, should I still use multibox? And if not, what do I use? thanks - dave - 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: single checkbox - still use html:multibox?
Um, html:checkbox ? Please read the api carefully if you want to use this tag. There is something you have to do in your form's reset()... -Original Message- From: David Thielen [mailto:[EMAIL PROTECTED] Sent: August 7, 2003 11:33 AM To: Struts-Users Subject: single checkbox - still use html:multibox? Hi; If I have a single checkbox on my page, should I still use multibox? And if not, what do I use? thanks - dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FormPropertyConfig - reseting session scoped DynaActionForms checkbox properties
Must reset checkbox properties to zero length in reset method as stated in the docs. If I have a session scoped DAF, then I can't just call initialize(). So I need to access this FormPropertyConfig object in my reset method to set the array to zero length for specific cases and only when zero boxes are selected. However I cannot detect zero boxes because Struts has prevented zero being selected!! How can I do this please? -- Mike W - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FormPropertyConfig - reseting session scoped DynaActionForms checkbox properties
Must reset checkbox properties to zero length in reset method as stated in the docs. If I have a session scoped DAF, then I can't just call initialize(). So I need to access this FormPropertyConfig object in my reset method to set the array to zero length for specific cases and only when zero boxes are selected. However I cannot detect zero boxes because Struts has prevented zero being selected!! How can I do this please? -- Mike W - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]