[Html-widget] Re: repeatable element
Brian Kirkbride
brian.kirkbride at deeperbydesign.com
Tue Mar 20 18:57:34 GMT 2007
Carl Franks wrote:
> Can anyone spell "hack"?
> ;)
>
> I've managed to get it working for both JS and non-JS - but it ain't
> pretty!
>
> I had to add yet another button, before the 'Add Another X' button.
> This one is set to type="image", with the src pointing to a 1x1
> transparent png, so it's almost invisible.
> It has style="display: none" so it really is invisible for everyone
> with CSS switched on.
> And it has tabindex="-1" so it never receives focus.
>
> Now, if a user presses 'enter' anywhere in the form, this button is
> instead submitted.
> The only problem is that a name/value isn't returned for this new
> button - so you have to set indicator() to some hidden field that you
> know will always be there.
> Luckily, the repeatable implementation uses a hidden 'count' field,
> which is always true. Though I admit, it's not that nice to have to
> refer to that in your form definition.
>
> Mario, if I get some time tomorrow to clean this all up, I will.
> Otherwise I'll just tarball it up and post it to the list.
>
> Carl
>
Have you tested this on Safari? At last check, it doesn't include form elements
with "display: none" in the POST values.
- Brian
More information about the Html-widget
mailing list