[Html-widget] Re: repeatable element

Mario Minati mario.minati at googlemail.com
Tue Mar 20 18:45:36 GMT 2007


Am Dienstag 20 März 2007 18:28 schrieb Carl Franks:
> On 20/03/07, Mario Minati <mario.minati at googlemail.com> wrote:
> > PS:
> > The formfu validation works fine and I think I'm gone start with
> > the 'repeatable' stuff in this week. would you prefer a different name
> > for it.
>
> I've brought this back to the html-widget list, so as to not annoy
> anyone on the cat list.
>
> I had a go at the repeatable element last week, and got it working,
> but came up against a show-stopper. I didn't have the time to bring it
> to the list for further discussion.
>
> Basically, it works fine with javascript, but not the non-JS version.
>
> For the non-JS version to work, the 'Add Another X' button needs to be
> a submit button - a plain 'button' won't submit the form, even with
> type="submit" set.

Is this browser specific?

> However, for most form layouts, this means the 'Add Another X' button
> will be *before* the "main" form submit button in the markup.

Can we circumvent this with css (but without absolute positioning), eventually 
add the button with css 
class:after { content:"<button type='submit'>"; } ?
> So, if the user clicks one of the buttons it works fine, but if the
> user presses 'enter', the browser would submit the form using the
> first submit button found in the markup - which for us is the wrong
> button.
> I've tried giving the 'Add Another X' button a higher 'tabindex' value
> than the main submit button, but it makes no difference when 'enter'
> is pressed.

What happens when we have multiple forms with the same id?
Probably nothing usefull.
A form inside a form is against the standard.

But what about creating an iframe that contains the 'Add Another X' buttons?
The only problem is: this hack needs lots of coding as we have to process the 
formdata much more than once and there would be many roundtrips that the 
application need to take care of.
So not a way I would like to go.

My last idea:
What about falling back into a mode where we don't provide a submit-button at 
all ;-).
I mean no button with type=submit, only with value=submit? That would break
the enter=default submission of form experience but might give us the 
opportunity to offer repeatable functionallity without js.

>
> Any ideas?
> If it's not possible to get it working for non-JS, we'd have to make
> sure that non-JS users don't see the extra button at all, so as not to
> confuse.

We can create them with JS.

Greets,
Mario



More information about the Html-widget mailing list