> _x_requested_with? Just a thought, because "ajax" is so... well, lame.

Don't mind.

> Curious, though. Why do you need to know when the request came from xhr
> or "async" upload form?

My templates behave differently depending on which way they were
requested. If requested in "vanilla" way, they should serve complete
HTML markup. If requested via AJAX\c\c\c\c:) _x_requested_with, they
should serve just bare contents. That is evident part.

Now quirky one. I load a bare form into jquery-ui dialog() and setup
the form be ajaxSubmit()ted. User submits the form and if the request
was OK, controller serves an empty string and I close the dialog. If
request is not OK, controller serves the content (with errors) of
validating form, I see the answer is not an empty string and reload
that content back to the dialog for further editing. This method
degrades gracefully for javascript-less clients to just plain pages
(of complete HTML markup). So to know how the form was submitted is
critical here. This can be easily done analysing request.is_xhr
property.

This technique has been working well until the forms start to contain
upload fields. I pull the initial content of the form into the dialog
well, but upon receiving the request, the controller goes to wrong
branch (since request.is_xhr is False) and serves complete markup
instead of empty string.

I'm pretty sure people exist facing the same problem. Thus the post.

--
Vladimir

-- 
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