---------- Forwarded message ----------
From: Robin Bryce <[EMAIL PROTECTED]>
Date: 14-Feb-2007 12:42
Subject: Re: ToscaWidgets & JavaScript form.submit()
To: Alberto Valverde <[EMAIL PROTECTED]>


Ah, thank you very much for that lucid explanation!

On 14/02/07, Alberto Valverde <[EMAIL PROTECTED]> wrote:
>
> On Feb 12, 2007, at 1:34 PM, [EMAIL PROTECTED] wrote:
>
> > Why can't the user be allowed to decide what the submit id and
> > attribute name is ? Or am I missing something obvious ?
>
> The id and name are calculated taking into account their position in
> the tree in order for FormFields to create names that will be decoded
> by FE's variable_decode into a nested structure (take a look at the
> values the sample form at toscawidgets.widgets.forms.samples produces
> when submitted).
>
> You can, however, easily override them when displaying a (input) widget:
>
>  >>> TextField('foo').display()
> '<input type="text" name="foo" class="textfield" id="foo">'
>
>  >>> TextField('foo').display(id='bar', name='zoo')
> '<input type="text" name="zoo" class="textfield" id="bar">'
>
> Overriding the name is generally not a good idea because the
> validator that will validate the form will expect the former name.
> Overriding the id is sometimes very useful when displaying the same
> widget instance various times in the same page in order to avoid DOM
> id conflicts.
>
> Alberto
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to