Topic: Using code generation and Javascript to create custom forms.

I looked through the API for a way to create/fill default form values, but I found form_for to be to static for my needs.  I want a form with hidden user_id fields based on a surfer clicking on a person in her buddylist.  I generate the javascript links with link_to_function which makes a call to fill_form, with the appropriate arguments.  I use form_for to create a template form on the page.

To visualize this, imagine links like:

<a onclick="fill_form(form.id, (user_id : bob.uid))">Bob</a>
<a onclick="fill_form(form.id, (user_id : jane.uid))">Jane</a>
<a onclick="fill_form(form.id, (user_id : moe.uid))">Moe</a>

fill_form takes a form_id and a hash of fields and values to fill.


I think this is a clean and reusable solution.  Let me know what you guys think, especially if there's a better way to do this.  I'll post again when I implement this to see if it's a good idea.

Because it's what code craves.