RE: set a html:checkbox checked
Sorry, if i use this i get an NoSuchMethod Error. But, even it schould work, how could i set the value other than on true or false _AND_ the checkbox checked? in html like this input type=checkbox value=99 checked thx in advance -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Montag, 25. November 2002 19:52 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked I think you should set the property of the form in an action, that will forward to your JSP. In this action, set the property corresponding to your check box at true: MyForm myForm = (MyForm) form; if (tablecolumn.value == 1) { myForm.setCheckboxProperty = true; } Then, the check box corresponding to CheckBoxProperty will be checked on the JSP. Hope it helps Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, November 25, 2002 5:44 PM Subject: RE: set a html:checkbox checked The poblem is not to post back, the problem ist to populate the checkbox checked. I would like to set the checked attribut dynamically. something like : if tablecolumn.value == 1 then checkbox = checked any idea thx georg M. Don't use the struts tag. The struts checkbox tag assumes all checkboxes are off. Use something like input type='checkbox' name='yourbeanproperty' checked As long as you use the name which corresponds to the form bean property struts will correctly link the data back to your form. Hope this helps. Edgar -Original Message- From: Mouratidis, Georg [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 11:25 AM To: 'Struts Users Mailing List'; '[EMAIL PROTECTED]' Subject: RE: set a html:checkbox checked Hi, Oliver did you get any response. i'm looking for the same. could you send me your solution please? thx Georg M. -Original Message- From: Oliver Kersten [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 21. November 2002 17:34 To: [EMAIL PROTECTED] Subject: set a html:checkbox checked Hi, how can I set a checkbox checked during creation in the JSP. In HTML I would do it like this: input type=checkbox name=mycheck checked But I can't find that for the struts tag: html:checkbox property=mycheckcheck it/html:ckeckbox And can I use the value true to set a checkbox checked. I get only a true from my bean and not a checked or something else. ciao Oliver. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: set a html:checkbox checked
Hi Georg, If you wish to utilize String value other than true, yes, or on..., you can use the html:multibox tag. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:25 AM Subject: RE: set a html:checkbox checked Sorry, if i use this i get an NoSuchMethod Error. But, even it schould work, how could i set the value other than on true or false _AND_ the checkbox checked? in html like this input type=checkbox value=99 checked thx in advance -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Montag, 25. November 2002 19:52 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked I think you should set the property of the form in an action, that will forward to your JSP. In this action, set the property corresponding to your check box at true: MyForm myForm = (MyForm) form; if (tablecolumn.value == 1) { myForm.setCheckboxProperty = true; } Then, the check box corresponding to CheckBoxProperty will be checked on the JSP. Hope it helps Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, November 25, 2002 5:44 PM Subject: RE: set a html:checkbox checked The poblem is not to post back, the problem ist to populate the checkbox checked. I would like to set the checked attribut dynamically. something like : if tablecolumn.value == 1 then checkbox = checked any idea thx georg M. Don't use the struts tag. The struts checkbox tag assumes all checkboxes are off. Use something like input type='checkbox' name='yourbeanproperty' checked As long as you use the name which corresponds to the form bean property struts will correctly link the data back to your form. Hope this helps. Edgar -Original Message- From: Mouratidis, Georg [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 11:25 AM To: 'Struts Users Mailing List'; '[EMAIL PROTECTED]' Subject: RE: set a html:checkbox checked Hi, Oliver did you get any response. i'm looking for the same. could you send me your solution please? thx Georg M. -Original Message- From: Oliver Kersten [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 21. November 2002 17:34 To: [EMAIL PROTECTED] Subject: set a html:checkbox checked Hi, how can I set a checkbox checked during creation in the JSP. In HTML I would do it like this: input type=checkbox name=mycheck checked But I can't find that for the struts tag: html:checkbox property=mycheckcheck it/html:ckeckbox And can I use the value true to set a checkbox checked. I get only a true from my bean and not a checked or something else. ciao Oliver. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: set a html:checkbox checked
Thank all the people for response. i have done it this way: logic:notEqual name=CatalogProfileDataForm property=catalogBuyerIDType value= var catalogBuyerIDType = bean:write name=CatalogProfileDataForm property=catalogBuyerIDType/ ; for(var loop=0;loop self.document.forms[ catalogprofiledataForm ].elements[ catalogBuyerIDType ].length; loop++ ) { if ( self.document.forms[catalogprofiledataForm].elements[catalogBuyerIDType][loop].value == catalogBuyerIDType ) { self.document.forms[ catalogprofiledataForm ].elements[ catalogBuyerIDType ][ loop ].checked = true ; break; } } /logic:notEqual But in my opinion MVC seems to be not well implementet in STRUTS. Because i have controller logic in my preantation layer (View). Georg -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 26. November 2002 11:48 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked Hi Georg, If you wish to utilize String value other than true, yes, or on..., you can use the html:multibox tag. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:25 AM Subject: RE: set a html:checkbox checked Sorry, if i use this i get an NoSuchMethod Error. But, even it schould work, how could i set the value other than on true or false _AND_ the checkbox checked? in html like this input type=checkbox value=99 checked thx in advance -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Montag, 25. November 2002 19:52 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked I think you should set the property of the form in an action, that will forward to your JSP. In this action, set the property corresponding to your check box at true: MyForm myForm = (MyForm) form; if (tablecolumn.value == 1) { myForm.setCheckboxProperty = true; } Then, the check box corresponding to CheckBoxProperty will be checked on the JSP. Hope it helps Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, November 25, 2002 5:44 PM Subject: RE: set a html:checkbox checked The poblem is not to post back, the problem ist to populate the checkbox checked. I would like to set the checked attribut dynamically. something like : if tablecolumn.value == 1 then checkbox = checked any idea thx georg M. Don't use the struts tag. The struts checkbox tag assumes all checkboxes are off. Use something like input type='checkbox' name='yourbeanproperty' checked As long as you use the name which corresponds to the form bean property struts will correctly link the data back to your form. Hope this helps. Edgar -Original Message- From: Mouratidis, Georg [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 11:25 AM To: 'Struts Users Mailing List'; '[EMAIL PROTECTED]' Subject: RE: set a html:checkbox checked Hi, Oliver did you get any response. i'm looking for the same. could you send me your solution please? thx Georg M. -Original Message- From: Oliver Kersten [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 21. November 2002 17:34 To: [EMAIL PROTECTED] Subject: set a html:checkbox checked Hi, how can I set a checkbox checked during creation in the JSP. In HTML I would do it like this: input type=checkbox name=mycheck checked But I can't find that for the struts tag: html:checkbox property=mycheckcheck it/html:ckeckbox And can I use the value true to set a checkbox checked. I get only a true from my bean and not a checked or something else. ciao Oliver. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: set a html:checkbox checked
As I said, I think the html:multibox tag should be an alternative to your javascript initialization: If I anderstand, you have some checkboxes catalogBuyerIDType whith different values, and you want check one on your JSP (corresponding to the property catalogBuyerIDType of the CatalogProfileDataForm). The catalogBuyerIDType should be an array of String: you just need to put the values corresponding to the checkboxes you need to check in your JSP: for example, if you want to check only the property corresponding to the 99 value: your initialization action should do this: ... CatalogProfileDataForm catalogProfileDataForm = (CatalogProfileDataForm) form; // array containing the initial values String[] foo = new String[1]; foo[0] = 99; catalogProfileDataForm.setCatalogBuyerIDType(foo); ... In your jsp, put your multibox like this: html:multibox property=catalogBuyerIDType value=98/ html:multibox property=catalogBuyerIDType value=99/ ... Only those that are contained in the array (corresponding to the property catalogBuyerIDType) will be checked in the JSP, and after submission of the form, the array will contain all the values that corresponds to the checked select boxes. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 12:00 PM Subject: RE: set a html:checkbox checked Thank all the people for response. i have done it this way: logic:notEqual name=CatalogProfileDataForm property=catalogBuyerIDType value= var catalogBuyerIDType = bean:write name=CatalogProfileDataForm property=catalogBuyerIDType/ ; for(var loop=0;loop self.document.forms[ catalogprofiledataForm ].elements[ catalogBuyerIDType ].length; loop++ ) { if ( self.document.forms[catalogprofiledataForm].elements[catalogBuyerIDType] [loop].value == catalogBuyerIDType ) { self.document.forms[ catalogprofiledataForm ].elements[ catalogBuyerIDType ][ loop ].checked = true ; break; } } /logic:notEqual But in my opinion MVC seems to be not well implementet in STRUTS. Because i have controller logic in my preantation layer (View). Georg -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 26. November 2002 11:48 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked Hi Georg, If you wish to utilize String value other than true, yes, or on..., you can use the html:multibox tag. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:25 AM Subject: RE: set a html:checkbox checked Sorry, if i use this i get an NoSuchMethod Error. But, even it schould work, how could i set the value other than on true or false _AND_ the checkbox checked? in html like this input type=checkbox value=99 checked thx in advance -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Montag, 25. November 2002 19:52 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked I think you should set the property of the form in an action, that will forward to your JSP. In this action, set the property corresponding to your check box at true: MyForm myForm = (MyForm) form; if (tablecolumn.value == 1) { myForm.setCheckboxProperty = true; } Then, the check box corresponding to CheckBoxProperty will be checked on the JSP. Hope it helps Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, November 25, 2002 5:44 PM Subject: RE: set a html:checkbox checked The poblem is not to post back, the problem ist to populate the checkbox checked. I would like to set the checked attribut dynamically. something like : if tablecolumn.value == 1 then checkbox = checked any idea thx georg M. Don't use the struts tag. The struts checkbox tag assumes all checkboxes are off. Use something like input type='checkbox' name='yourbeanproperty' checked As long as you use the name which corresponds to the form bean property struts will correctly link the data back to your form. Hope this helps. Edgar -Original Message- From: Mouratidis, Georg [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 11:25 AM To: 'Struts Users Mailing List'; '[EMAIL PROTECTED]' Subject: RE: set a html:checkbox checked Hi, Oliver did you get any response. i'm looking for the same. could you send me your solution please? thx Georg M. -Original Message- From: Oliver Kersten [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 21. November 2002 17:34 To: [EMAIL PROTECTED] Subject: set a html:checkbox checked
RE: set a html:checkbox checked
Hallo Patrice, thank you,thank you,thank you,thank you,thank you,thank you,thank you for the solution. this works excellent. But, is there somethink like html:multibox for the html:radio tag. Because html:multibox seems to create only checkbox-inputs. again thx alot -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 26. November 2002 12:27 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked As I said, I think the html:multibox tag should be an alternative to your javascript initialization: If I anderstand, you have some checkboxes catalogBuyerIDType whith different values, and you want check one on your JSP (corresponding to the property catalogBuyerIDType of the CatalogProfileDataForm). The catalogBuyerIDType should be an array of String: you just need to put the values corresponding to the checkboxes you need to check in your JSP: for example, if you want to check only the property corresponding to the 99 value: your initialization action should do this: ... CatalogProfileDataForm catalogProfileDataForm = (CatalogProfileDataForm) form; // array containing the initial values String[] foo = new String[1]; foo[0] = 99; catalogProfileDataForm.setCatalogBuyerIDType(foo); ... In your jsp, put your multibox like this: html:multibox property=catalogBuyerIDType value=98/ html:multibox property=catalogBuyerIDType value=99/ ... Only those that are contained in the array (corresponding to the property catalogBuyerIDType) will be checked in the JSP, and after submission of the form, the array will contain all the values that corresponds to the checked select boxes. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 12:00 PM Subject: RE: set a html:checkbox checked Thank all the people for response. i have done it this way: logic:notEqual name=CatalogProfileDataForm property=catalogBuyerIDType value= var catalogBuyerIDType = bean:write name=CatalogProfileDataForm property=catalogBuyerIDType/ ; for(var loop=0;loop self.document.forms[ catalogprofiledataForm ].elements[ catalogBuyerIDType ].length; loop++ ) { if ( self.document.forms[catalogprofiledataForm].elements[catalogBuyerIDType] [loop].value == catalogBuyerIDType ) { self.document.forms[ catalogprofiledataForm ].elements[ catalogBuyerIDType ][ loop ].checked = true ; break; } } /logic:notEqual But in my opinion MVC seems to be not well implementet in STRUTS. Because i have controller logic in my preantation layer (View). Georg -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 26. November 2002 11:48 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked Hi Georg, If you wish to utilize String value other than true, yes, or on..., you can use the html:multibox tag. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:25 AM Subject: RE: set a html:checkbox checked Sorry, if i use this i get an NoSuchMethod Error. But, even it schould work, how could i set the value other than on true or false _AND_ the checkbox checked? in html like this input type=checkbox value=99 checked thx in advance -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Montag, 25. November 2002 19:52 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked I think you should set the property of the form in an action, that will forward to your JSP. In this action, set the property corresponding to your check box at true: MyForm myForm = (MyForm) form; if (tablecolumn.value == 1) { myForm.setCheckboxProperty = true; } Then, the check box corresponding to CheckBoxProperty will be checked on the JSP. Hope it helps Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, November 25, 2002 5:44 PM Subject: RE: set a html:checkbox checked The poblem is not to post back, the problem ist to populate the checkbox checked. I would like to set the checked attribut dynamically. something like : if tablecolumn.value == 1 then checkbox = checked any idea thx georg M. Don't use the struts tag. The struts checkbox tag assumes all checkboxes are off. Use something like input type='checkbox' name='yourbeanproperty' checked As long as you use the name which corresponds to the form bean property struts will correctly link the data back to your form. Hope this helps. Edgar -Original Message- From: Mouratidis, Georg [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25
Re: set a html:checkbox checked
If only one catalogBuyerIDType can be selected, the easiest way is to use radio buttons instead of check boxes. In your form, the attribute corresponding to the radio buttons can be a simple String (and not an array of Strings) because only one value can be selected at once. So, in your initialization action: ... CatalogProfileDataForm catalogProfileDataForm = (CatalogProfileDataForm) form; catalogProfileDataForm.setCatalogBuyerIDType(99); ... and in your JSP: html:radio property=catalogBuyerIDType value=98/ html:radio property=catalogBuyerIDType value=99/ The radio button with value=99 will be selected into the JSP, and after submission of the form, the property catalogBuyerIDType will contain the value that corresponds to the selected radio button. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 1:28 PM Subject: RE: set a html:checkbox checked Hallo Patrice, thank you,thank you,thank you,thank you,thank you,thank you,thank you for the solution. this works excellent. But, is there somethink like html:multibox for the html:radio tag. Because html:multibox seems to create only checkbox-inputs. again thx alot -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 26. November 2002 12:27 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked As I said, I think the html:multibox tag should be an alternative to your javascript initialization: If I anderstand, you have some checkboxes catalogBuyerIDType whith different values, and you want check one on your JSP (corresponding to the property catalogBuyerIDType of the CatalogProfileDataForm). The catalogBuyerIDType should be an array of String: you just need to put the values corresponding to the checkboxes you need to check in your JSP: for example, if you want to check only the property corresponding to the 99 value: your initialization action should do this: ... CatalogProfileDataForm catalogProfileDataForm = (CatalogProfileDataForm) form; // array containing the initial values String[] foo = new String[1]; foo[0] = 99; catalogProfileDataForm.setCatalogBuyerIDType(foo); ... In your jsp, put your multibox like this: html:multibox property=catalogBuyerIDType value=98/ html:multibox property=catalogBuyerIDType value=99/ ... Only those that are contained in the array (corresponding to the property catalogBuyerIDType) will be checked in the JSP, and after submission of the form, the array will contain all the values that corresponds to the checked select boxes. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 12:00 PM Subject: RE: set a html:checkbox checked Thank all the people for response. i have done it this way: logic:notEqual name=CatalogProfileDataForm property=catalogBuyerIDType value= var catalogBuyerIDType = bean:write name=CatalogProfileDataForm property=catalogBuyerIDType/ ; for(var loop=0;loop self.document.forms[ catalogprofiledataForm ].elements[ catalogBuyerIDType ].length; loop++ ) { if ( self.document.forms[catalogprofiledataForm].elements[catalogBuyerIDType] [loop].value == catalogBuyerIDType ) { self.document.forms[ catalogprofiledataForm ].elements[ catalogBuyerIDType ][ loop ].checked = true ; break; } } /logic:notEqual But in my opinion MVC seems to be not well implementet in STRUTS. Because i have controller logic in my preantation layer (View). Georg -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 26. November 2002 11:48 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked Hi Georg, If you wish to utilize String value other than true, yes, or on..., you can use the html:multibox tag. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:25 AM Subject: RE: set a html:checkbox checked Sorry, if i use this i get an NoSuchMethod Error. But, even it schould work, how could i set the value other than on true or false _AND_ the checkbox checked? in html like this input type=checkbox value=99 checked thx in advance -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Montag, 25. November 2002 19:52 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked I think you should set the property of the form in an action, that will forward to your JSP. In this action, set the property corresponding to your check box at true: MyForm myForm = (MyForm) form; if (tablecolumn.value == 1
RE: set a html:checkbox checked
thx a lot Georg -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 26. November 2002 14:07 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked If only one catalogBuyerIDType can be selected, the easiest way is to use radio buttons instead of check boxes. In your form, the attribute corresponding to the radio buttons can be a simple String (and not an array of Strings) because only one value can be selected at once. So, in your initialization action: ... CatalogProfileDataForm catalogProfileDataForm = (CatalogProfileDataForm) form; catalogProfileDataForm.setCatalogBuyerIDType(99); ... and in your JSP: html:radio property=catalogBuyerIDType value=98/ html:radio property=catalogBuyerIDType value=99/ The radio button with value=99 will be selected into the JSP, and after submission of the form, the property catalogBuyerIDType will contain the value that corresponds to the selected radio button. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 1:28 PM Subject: RE: set a html:checkbox checked Hallo Patrice, thank you,thank you,thank you,thank you,thank you,thank you,thank you for the solution. this works excellent. But, is there somethink like html:multibox for the html:radio tag. Because html:multibox seems to create only checkbox-inputs. again thx alot -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 26. November 2002 12:27 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked As I said, I think the html:multibox tag should be an alternative to your javascript initialization: If I anderstand, you have some checkboxes catalogBuyerIDType whith different values, and you want check one on your JSP (corresponding to the property catalogBuyerIDType of the CatalogProfileDataForm). The catalogBuyerIDType should be an array of String: you just need to put the values corresponding to the checkboxes you need to check in your JSP: for example, if you want to check only the property corresponding to the 99 value: your initialization action should do this: ... CatalogProfileDataForm catalogProfileDataForm = (CatalogProfileDataForm) form; // array containing the initial values String[] foo = new String[1]; foo[0] = 99; catalogProfileDataForm.setCatalogBuyerIDType(foo); ... In your jsp, put your multibox like this: html:multibox property=catalogBuyerIDType value=98/ html:multibox property=catalogBuyerIDType value=99/ ... Only those that are contained in the array (corresponding to the property catalogBuyerIDType) will be checked in the JSP, and after submission of the form, the array will contain all the values that corresponds to the checked select boxes. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 12:00 PM Subject: RE: set a html:checkbox checked Thank all the people for response. i have done it this way: logic:notEqual name=CatalogProfileDataForm property=catalogBuyerIDType value= var catalogBuyerIDType = bean:write name=CatalogProfileDataForm property=catalogBuyerIDType/ ; for(var loop=0;loop self.document.forms[ catalogprofiledataForm ].elements[ catalogBuyerIDType ].length; loop++ ) { if ( self.document.forms[catalogprofiledataForm].elements[catalogBuyerIDType] [loop].value == catalogBuyerIDType ) { self.document.forms[ catalogprofiledataForm ].elements[ catalogBuyerIDType ][ loop ].checked = true ; break; } } /logic:notEqual But in my opinion MVC seems to be not well implementet in STRUTS. Because i have controller logic in my preantation layer (View). Georg -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 26. November 2002 11:48 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked Hi Georg, If you wish to utilize String value other than true, yes, or on..., you can use the html:multibox tag. Best regards Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 9:25 AM Subject: RE: set a html:checkbox checked Sorry, if i use this i get an NoSuchMethod Error. But, even it schould work, how could i set the value other than on true or false _AND_ the checkbox checked? in html like this input type=checkbox value=99 checked thx in advance -Original Message- From: Patrice [mailto:[EMAIL PROTECTED]] Sent: Montag, 25. November 2002 19:52 To: Struts Users Mailing List Subject: Re: set a html:checkbox checked I think you should set the property of the form
RE: set a html:checkbox checked
Hi, Oliver did you get any response. i'm looking for the same. could you send me your solution please? thx Georg M. -Original Message- From: Oliver Kersten [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 21. November 2002 17:34 To: [EMAIL PROTECTED] Subject: set a html:checkbox checked Hi, how can I set a checkbox checked during creation in the JSP. In HTML I would do it like this: input type=checkbox name=mycheck checked But I can't find that for the struts tag: html:checkbox property=mycheckcheck it/html:ckeckbox And can I use the value true to set a checkbox checked. I get only a true from my bean and not a checked or something else. ciao Oliver. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: set a html:checkbox checked
In your Action class which forwards to the JSP, you have to have code which sets the property associated with the checkbox to either true, yes, on, or the value set in the value attribute. -Original Message- From: Mouratidis, Georg [mailto:[EMAIL PROTECTED]] Hi, Oliver did you get any response. i'm looking for the same. could you send me your solution please? thx Georg M. -Original Message- From: Oliver Kersten [mailto:[EMAIL PROTECTED]] Hi, how can I set a checkbox checked during creation in the JSP. In HTML I would do it like this: input type=checkbox name=mycheck checked But I can't find that for the struts tag: html:checkbox property=mycheckcheck it/html:ckeckbox And can I use the value true to set a checkbox checked. I get only a true from my bean and not a checked or something else. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: set a html:checkbox checked
any examples please. i do not understand how to do it. thx -Original Message- From: Karr, David [mailto:[EMAIL PROTECTED]] Sent: Montag, 25. November 2002 17:34 To: Struts Users Mailing List Subject: RE: set a html:checkbox checked In your Action class which forwards to the JSP, you have to have code which sets the property associated with the checkbox to either true, yes, on, or the value set in the value attribute. -Original Message- From: Mouratidis, Georg [mailto:[EMAIL PROTECTED]] Hi, Oliver did you get any response. i'm looking for the same. could you send me your solution please? thx Georg M. -Original Message- From: Oliver Kersten [mailto:[EMAIL PROTECTED]] Hi, how can I set a checkbox checked during creation in the JSP. In HTML I would do it like this: input type=checkbox name=mycheck checked But I can't find that for the struts tag: html:checkbox property=mycheckcheck it/html:ckeckbox And can I use the value true to set a checkbox checked. I get only a true from my bean and not a checked or something else. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: set a html:checkbox checked
Don't use the struts tag. The struts checkbox tag assumes all checkboxes are off. Use something like input type='checkbox' name='yourbeanproperty' checked As long as you use the name which corresponds to the form bean property struts will correctly link the data back to your form. Hope this helps. Edgar -Original Message- From: Mouratidis, Georg [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 11:25 AM To: 'Struts Users Mailing List'; '[EMAIL PROTECTED]' Subject: RE: set a html:checkbox checked Hi, Oliver did you get any response. i'm looking for the same. could you send me your solution please? thx Georg M. -Original Message- From: Oliver Kersten [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 21. November 2002 17:34 To: [EMAIL PROTECTED] Subject: set a html:checkbox checked Hi, how can I set a checkbox checked during creation in the JSP. In HTML I would do it like this: input type=checkbox name=mycheck checked But I can't find that for the struts tag: html:checkbox property=mycheckcheck it/html:ckeckbox And can I use the value true to set a checkbox checked. I get only a true from my bean and not a checked or something else. ciao Oliver. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: set a html:checkbox checked
I believe the value attribute in the case of the textbox is the 'text' returned by a 'checked' checkbox, not the boolean value of the checkbox. Edgar -Original Message- From: Karr, David [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 11:34 AM To: 'Struts Users Mailing List' Subject: RE: set a html:checkbox checked In your Action class which forwards to the JSP, you have to have code which sets the property associated with the checkbox to either true, yes, on, or the value set in the value attribute. -Original Message- From: Mouratidis, Georg [mailto:[EMAIL PROTECTED]] Hi, Oliver did you get any response. i'm looking for the same. could you send me your solution please? thx Georg M. -Original Message- From: Oliver Kersten [mailto:[EMAIL PROTECTED]] Hi, how can I set a checkbox checked during creation in the JSP. In HTML I would do it like this: input type=checkbox name=mycheck checked But I can't find that for the struts tag: html:checkbox property=mycheckcheck it/html:ckeckbox And can I use the value true to set a checkbox checked. I get only a true from my bean and not a checked or something else. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: set a html:checkbox checked
The poblem is not to post back, the problem ist to populate the checkbox checked. I would like to set the checked attribut dynamically. something like : if tablecolumn.value == 1 then checkbox = checked any idea thx georg M. Don't use the struts tag. The struts checkbox tag assumes all checkboxes are off. Use something like input type='checkbox' name='yourbeanproperty' checked As long as you use the name which corresponds to the form bean property struts will correctly link the data back to your form. Hope this helps. Edgar -Original Message- From: Mouratidis, Georg [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 11:25 AM To: 'Struts Users Mailing List'; '[EMAIL PROTECTED]' Subject: RE: set a html:checkbox checked Hi, Oliver did you get any response. i'm looking for the same. could you send me your solution please? thx Georg M. -Original Message- From: Oliver Kersten [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 21. November 2002 17:34 To: [EMAIL PROTECTED] Subject: set a html:checkbox checked Hi, how can I set a checkbox checked during creation in the JSP. In HTML I would do it like this: input type=checkbox name=mycheck checked But I can't find that for the struts tag: html:checkbox property=mycheckcheck it/html:ckeckbox And can I use the value true to set a checkbox checked. I get only a true from my bean and not a checked or something else. ciao Oliver. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: set a html:checkbox checked
I think you should set the property of the form in an action, that will forward to your JSP. In this action, set the property corresponding to your check box at true: MyForm myForm = (MyForm) form; if (tablecolumn.value == 1) { myForm.setCheckboxProperty = true; } Then, the check box corresponding to CheckBoxProperty will be checked on the JSP. Hope it helps Patrice - Original Message - From: Mouratidis, Georg [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, November 25, 2002 5:44 PM Subject: RE: set a html:checkbox checked The poblem is not to post back, the problem ist to populate the checkbox checked. I would like to set the checked attribut dynamically. something like : if tablecolumn.value == 1 then checkbox = checked any idea thx georg M. Don't use the struts tag. The struts checkbox tag assumes all checkboxes are off. Use something like input type='checkbox' name='yourbeanproperty' checked As long as you use the name which corresponds to the form bean property struts will correctly link the data back to your form. Hope this helps. Edgar -Original Message- From: Mouratidis, Georg [mailto:[EMAIL PROTECTED]] Sent: Monday, November 25, 2002 11:25 AM To: 'Struts Users Mailing List'; '[EMAIL PROTECTED]' Subject: RE: set a html:checkbox checked Hi, Oliver did you get any response. i'm looking for the same. could you send me your solution please? thx Georg M. -Original Message- From: Oliver Kersten [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 21. November 2002 17:34 To: [EMAIL PROTECTED] Subject: set a html:checkbox checked Hi, how can I set a checkbox checked during creation in the JSP. In HTML I would do it like this: input type=checkbox name=mycheck checked But I can't find that for the struts tag: html:checkbox property=mycheckcheck it/html:ckeckbox And can I use the value true to set a checkbox checked. I get only a true from my bean and not a checked or something else. ciao Oliver. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]