Re: Highly dynamic forms

2005-06-08 Thread Stéphane Zuckerman

[EMAIL PROTECTED] a écrit :

http://wiki.apache.org/struts/StrutsCatalogLazyList
Look at the section: Hand Cranking lazy List in the ActionForm.
This is possible with the version you are currently using.


Actually, the LazyValidatorForm class only exists since struts 1.2.6, 
that is why I was asking for a solution under Struts 1.2.4.


Moreover, the use I have of LazyList is so small that I don't think that 
upgrading my version of commons-collection just for this one piece of 
code is relevant... I have my own LazyList implementation, which is 
doing what I am expecting of it. When we need a more complete/complex 
use of lazy objects, I'll upgrade. :-)


That doesn't solve my problem, though. I do have radio buttons working 
from a lazy list, something like

[ [value, [radio1,radio2,radio3]], [value, [radio1,radio2]] ]
In the end then, I manage to get the attribute value from a radio input, 
but when I try with checkboxes, I fail to retrieve the String[] 
object... Well, I'll manage, eventually.


--
Stéphane Zuckerman

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Highly dynamic forms

2005-06-08 Thread gdeschen
The section I was refering you to is the Hand Cranking the lazy List in 
the Action Form.
This is a small section squeezed in between lazy list information.
This does not require any other class but the ActionForm.
All that is needed is to add code to grow the list and to get the proper 
objects back.

- Glenn




Stéphane Zuckerman [EMAIL PROTECTED] 
08/06/2005 12:09 PM
Please respond to
Struts Users Mailing List user@struts.apache.org


To
Struts Users Mailing List user@struts.apache.org
cc

Subject
Re: Highly dynamic forms






[EMAIL PROTECTED] a écrit :
 http://wiki.apache.org/struts/StrutsCatalogLazyList
 Look at the section: Hand Cranking lazy List in the ActionForm.
 This is possible with the version you are currently using.

Actually, the LazyValidatorForm class only exists since struts 1.2.6, 
that is why I was asking for a solution under Struts 1.2.4.

Moreover, the use I have of LazyList is so small that I don't think that 
upgrading my version of commons-collection just for this one piece of 
code is relevant... I have my own LazyList implementation, which is 
doing what I am expecting of it. When we need a more complete/complex 
use of lazy objects, I'll upgrade. :-)

That doesn't solve my problem, though. I do have radio buttons working 
from a lazy list, something like
[ [value, [radio1,radio2,radio3]], [value, [radio1,radio2]] ]
In the end then, I manage to get the attribute value from a radio input, 
but when I try with checkboxes, I fail to retrieve the String[] 
object... Well, I'll manage, eventually.

-- 
Stéphane Zuckerman

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





Re: Highly dynamic forms

2005-06-07 Thread Martin Gainty

Stephane
Did you look at LazyList?
http://wiki.apache.org/struts/StrutsCatalogLazyList
Martin-
- Original Message - 
From: Stéphane Zuckerman [EMAIL PROTECTED]

To: Struts Users Mailing List user@struts.apache.org
Sent: Tuesday, June 07, 2005 9:53 AM
Subject: Highly dynamic forms



Hello,

Here's the question for the short version (below you'll find some 
lengthier explanations ...) :


I'd like to render a list of groups of radio buttons. Said list has a 
variable length. So my data structure looks like :


[ [radio1,radio2,radio3], [radio1,radio2,radio3,radio4], ...]

I am currently using Struts 1.2.4. Is there a way of rendering these 
groups of radio buttons without upgrading my version of Struts ?




For the detailed explanation :

I'm trying to render a form with fields which aren't defined by advance. 
More precisely, I have a List (an ArrayList) of custom objects, which are 
described like this :


public class MyField {
private String type, group;
private Object data;
// then the accessors follow ...
}

The type attribute contains which kind of field is to be rendered 
(radio, text, checkbox, etc.). The group attribute enables me to know 
which information is answered. For example :


I have two objects that are to be filled by the user, a text field, and a 
radio field. So my list of MyField objects will look something like :


[ {radio, g1, (ArrayList object)}, {text, , (String object)} ]

Now, what I need is to not only render the radio buttons part (which I 
eventually managed), but also to get a way to have the submission succeed 
! :-)


Here is a very small example of JSP code :

html:form action=/indices
  logic:iterate id=liste name=indicesForm property=liste
  indexId=i
logic:iterate id=item name=liste indexId=j
  html:radio property=liste[${i}] value=${item.value}/
  ${item.label}br/
/logic:iterate
  /logic:iterate
  html:submit/
/html:form

I voluntarily didn't use indexed properties, since I have to play with 
inner and outer loops' indexes. Although the form is rendered the right 
way, I can't submit info with it, I get an error that says :


java.lang.NullPointerException: No indexed value for 'liste[2]'

Since I use a List object, I suppose this isn't very surprising after all.

But then, what's the best way of doing that kind of stuff ?
--
Stéphane Zuckerman

-
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: Highly dynamic forms

2005-06-07 Thread Stéphane Zuckerman

Martin Gainty a écrit :

Stephane
Did you look at LazyList?
http://wiki.apache.org/struts/StrutsCatalogLazyList



I did, and that's why I asked if there was a solution without using a 
version of struts  1.2.4 . :-) I don't think my colleagues would like 
it if I were to change the version of the libraries we have been using
for months now. Of course, if there is no other easy way, I'll update 
the libs, and that'll be it.


Here's the question for the short version (below you'll find some 
lengthier explanations ...) :


I'd like to render a list of groups of radio buttons. Said list has a 
variable length. So my data structure looks like :


[ [radio1,radio2,radio3], [radio1,radio2,radio3,radio4], ...]

I am currently using Struts 1.2.4. Is there a way of rendering these 
groups of radio buttons without upgrading my version of Struts ?




--
Stéphane Zuckerman

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Highly dynamic forms

2005-06-07 Thread gdeschen
http://wiki.apache.org/struts/StrutsCatalogLazyList
Look at the section: Hand Cranking lazy List in the ActionForm.
This is possible with the version you are currently using.

HTH,
- Glenn




Stéphane Zuckerman [EMAIL PROTECTED] 
07/06/2005 12:28 PM
Please respond to
Struts Users Mailing List user@struts.apache.org


To
Struts Users Mailing List user@struts.apache.org
cc

Subject
Re: Highly dynamic forms






Martin Gainty a écrit :
 Stephane
 Did you look at LazyList?
 http://wiki.apache.org/struts/StrutsCatalogLazyList


I did, and that's why I asked if there was a solution without using a 
version of struts  1.2.4 . :-) I don't think my colleagues would like 
it if I were to change the version of the libraries we have been using
for months now. Of course, if there is no other easy way, I'll update 
the libs, and that'll be it.

 Here's the question for the short version (below you'll find some 
 lengthier explanations ...) :

 I'd like to render a list of groups of radio buttons. Said list has a 
 variable length. So my data structure looks like :

 [ [radio1,radio2,radio3], [radio1,radio2,radio3,radio4], ...]

 I am currently using Struts 1.2.4. Is there a way of rendering these 
 groups of radio buttons without upgrading my version of Struts ?


-- 
Stéphane Zuckerman

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]