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, 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="mycheck">check 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]>
>
>


--
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]>

Reply via email to