On 24.02.2009, at 09:25, Benjamin Börngen-Schmidt wrote:

Hello List,

normally I have my froms in the input template, display it and submit the form's data to the action and so on. But now I came to a point in my project, where it would be helpful to dynamicly create forms ie. taking in accout the credentials of a user etc. My current Plan how to implement this is, that I'll have a main and widget actions which return on a read request the input template with the fields. So far so good. Let's also assume that the main action and view knows which widgets need to be called.

Now when i post the Form it will be submitted to the main action, which of course does not know about the the parameters of the widget actions thus can not validate them.

True. You're on the right track so far - you could either use slots to assemble the form, or make some kind of custom form builder helper that does the job for you.


So i somehow have to register the validators of widgets or would it be enough to somehow run those widget actions and they then validate the params from the global requestdata?

No, that doesn't work. Each container gets an isolated copy of the global request data; things you validate in one will not be validated in the other.

What you need to do instead is set up validators manually. The best place to do that is AgaviAction::registerValidators(). You can read your form schema and register validators accordingly there.


Also on the view part how would i add the widget's input fields to the main view? I think using a slot would be the best way here.

Yes. As I said above, slots would work. I do think, however, that some kind of form builder might be better.

Hope that helps,

David

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to