|
From: Eric N. <eri...@gm...> - 2005-11-09 13:49:59
|
Hi,
I'm trying to use htmlfill to do some form filling and error display.
It works fine when I only have different forms on the page, but if I
use a repeated form it does not work that well.
Contrived example: I have a list of employee in a table and each row
of the table let me edit a last name:
<tr>
<td>employee number</td>
<td>first</td>
<td>last</td>
<td>edit</td>
</tr>
<tr>
<td>34</td>
<td>joe</td>
<td>anonymous</td>
<td><form>
<input type="hidden" name="emp_id" value="34">
<input type="text" name="lastName" value="anonymous">
<form:error name="emp_id">
<form:error name="lastName">
<input type="submit" value="set_last_name">
</form></td>
</tr>
<tr>
...
</tr>
Everything works fine on the request side, I receive all my data,
parse it with a schema with the emp_id and the lastname, known which
employee to update using its id and everybody is happy. But of
course, when regenerating the page on error with htmlfill everything
goes wrong as there is more than one input field for each name and
errors all over the place.
I'm trying to setup a pattern to deal with this, involving both the
response side (where the form is generated from a template) and the
request side (where the form data is parsed and understood). I'd like
to avoid giving every single input element a different name as this
makes the form generation and interpretation harder to manage. A
solution like giving the form a name and telling htmlfill to only
muck with this part of the page would work for example.
Any ideas are welcome. How do you deal with such a page in your
applications?
Thanks,
-- Eric
|