Say I am building a blogging platform, and I want to allow users to be
able to add an avatar without leaving the page, when they’re writing a
post. I need the avatar information to be included in the form for the
post. So for example, after a user adds a new avatar while writing a
new blog post, it would be available to be selected as the avatar to be
used for that post. What is the best way to go about this?
As I understand it, W3C standards don’t allow forms within forms. So I
have to find some way of adding the avatar without using a form within
the form I’m using for the blog posting. But then, I need the avatar
information to be within the post form.
I could do the avatar information using AJAX and a hyperlink, but if I
use GET, then I am violating the principle that GET operations shouldn’t
modify anything, and even if I specify :post => true for the link_to
function, this will still fail if the user’s browser doesn’t support
So it seems like I can either create the form upon user action and
destroy it before the submit the blog post form… or I can create the
avatar form outside of the blog post form and have it modify a set of
form elements within the blog post form.
These last two options seem pretty messy… esp. the second because I’d
still want the avatar form to appear to be within the blog post form.
Am I missing something? I feel like I’m having a lot of trouble with a
seemingly trivial task here.