You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Connor <mc...@baan.com> on 2002/07/12 15:56:39 UTC

FW: Really dynamic forms (regex)

I have not been able to find a way to provide this functionality.  Olivier
is more concerned with how to declare the fields that will be returned as
opposed to how to present them on the form.  You have to declare the fields
in the struts-config file to work with the DynaActionForm.  You could of
course do it the old fashioned way and just pull it out of the request but I
assume you're using the new validator and want to take advantage of
enforcing types.  From posts I've seen in the past, there is no way out of
the box to do this.

It would be cool if you could declare your parameter names using regular
expressions so you could say something like

<form-property name="PassengerFName\d+" type="java.lang.String"/>
<form-property name="PassengerLName\d+" type="java.lang.String"/>
<form-property name="PassengerMName\d+" type="java.lang.String"/>

So that you could have numbered parameters with the same root name and
validation could be done across all entries.

Anyone have any ideas?

Michael Connor

-----Original Message-----
From: Jon.Ridgway [mailto:Jon.Ridgway@upco.co.uk]
Sent: Friday, July 12, 2002 5:59 AM
To: 'Struts Users Mailing List'
Subject: RE: Really dynamic forms


Hi Olivier

In your case you could have an action create and populate an ArrayList with
empty passenger objects, add the list to a form, put the form into scope and
forward to a jsp. Then in the jsp iterate over the list displaying input
fields for each passenger object...easy...ish...

Jon Ridgway


-----Original Message-----
From: olschmeltzer@airfrance.fr [mailto:olschmeltzer@airfrance.fr] 
Sent: 11 July 2002 16:40
To: struts-user@jakarta.apache.org
Subject: Really dynamic forms

Hi !

Contrary to DynaActionForm which are rather declarative forms than dynamic
forms, I have a need for building forms that are parametric. For instance,
the Internet user specifies the number of elements he requires, and the
system builds dynamically a JSP form containing as many fields as the given
number. For instance, for a trip, he gives the number of passengers (let's
say 3) and the next form he sees contains 3 fields named for instance
passengerName1, passengerName2 and passengerName3.
Since I don't know how many fields there will be, how can I design an
ActionForm handling this ? If I were to use a DynaActionForm, I would
nonetheless be compelled to specify the fields in the struts-config.xml
file.
Hope this makes sense.
Thanks for your help.

Olivier Schmeltzer




----------------

Les donnees et renseignements contenus dans ce message sont personnels,
confidentiels et secrets. Ce message est adresse a l'individu ou l'entite
dont les coordonnees figurent ci-dessus. Si vous n'etes pas le bon
destinataire, nous vous demandons de ne pas lire, copier, utiliser ou
divulguer cette communication. Nous vous prions de notifier cette erreur a
l'expediteur et d'effacer immediatement cette communication de votre
systeme.

The information contained in this message is privileged, confidential, and
protected from disclosure. This message is intended for the individual or
entity adressed herein. If you are not the intended recipient, please do not
read, copy, use or disclose this communication to others ;also please notify
the sender by replying to this message, and then delete it from your system.


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


The contents of this email are intended only for the named addressees and
may contain confidential and/or privileged material. If received in error
please contact UPCO on +44 (0) 113 201 0600 and then delete the entire
e-mail from your system. Unauthorised review, distribution, disclosure or
other use of this information could constitute a breach of confidence. Your
co-operation in this matter is greatly appreciated.