On 10.03.2011, at 14:22, Lukas Kahwe Smith wrote:

> Aloha,
> 
> Thomas asked me about form handling in the ViewBundle, bit largely this is a 
> more general question.
> 
> 1) rendering the form
> My vision which I briefly discussed with Bernhard back when he was in Zurich 
> is that when rendering a form in a non HTML format, we would return something 
> to describe the API that the form is essentially exposing. For SOAP this 
> would be WSDL, not sure if there is something similar for JSON based API's. 
> It would include both the supported "field" and associated validation rules.

for json http://json-schema.org/ seems to be what we would want.

then again imho this is mostly candy on top, well for WSDL/SOAP it would be 
kind of cool especially since WSDL is so painful to deal with. however the 
below pieces are the more important ones.

> ViewBundle specific comment:
> The Serializer component supports Normalizers which could be used here to 
> serialize the form instance into the above format.
> 
> 2) error handling
> Then when the for is submitted. Its validated as usually, but on validation 
> error it would just return the errors.

here we again would need to find a sensible format. again for the ViewBundle 
the "angle" would be a Normalizer that sees that the form has run errors set 
and in this case it would just serialize the errors (maybe optionally also the 
API aka 1)).

> 3) processing
> When the form is valid it would execute the normal logic. Now instead of 
> redirecting one would likely want to either just return "OK" or immediately 
> "forward" instead of doing a redirect.
> 
> ViewBundle specific comment:
> In the ViewBundle its possible to redirect to an url or to a route. In the 
> later case we could add an option that determines for which formats to 
> actually redirect, for which to just return "OK" and for which to instead 
> forward.

one thing to note in general, i am not sure if there is unnecessary overhead 
which we could reduce in the form layer when rendering non HTML output. that 
might be another thing to explore. the new API still binds the request IIRC, so 
the form should be aware of the request format automatically.

regards,
Lukas Kahwe Smith
[email protected]



-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to