Christoph Haas wrote:
>> It would require some extra infrastructure, but it also seems like you 
>> should be able to accept the form data and run validators on it, then 
>> return error messages in json, if you want incremental error messages. 
>> Some sort of infrastructure for Javascript validation using FormEncode 
>> schemas would be good, with or without extjs.
> 
> Can you imagine how one can use formencode validation to validate an
> ExtJS form? I'm not that far actually in my test application so I'm not
> sure whether they run a POST or serialize the fields in a GET request.
> But if I could continue to use my schemas in ExtJS context with little
> pain that'll be great.

Well, if they do a complete POST or submit a JSON request, it doesn't 
matter too much I think.

You'd get the values in some way (json decode or request.params), and 
then do:

try:
     result = schema(ignore_key_missing=True).to_python(fields)
     errors = None
except Invalid, e:
     errors = e.unpack_errors()
return Response(simplejson.dumps(errors))


-- 
Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to