On Thursday 18 September 2008 16:21:28 Diez B. Roggisch wrote:
> Hi,
>
> I'm having a TableForm that works nice and smooth - until I embed it into
> another widget .
>
> Then the form-fields get names like this:
>
> <formname>.<fieldname>
>
> However, I don't want the <formname> to be there. I thought that
> "strip_name" was the attribute to set for this. However, when I
>
>  - set it only on the Form (the most logical option I personally think),
> nothing happens at all.
>
>  - set it on the respective form-fields, I end up with the name
> being "<formname> alone.... not much sense in that.
>
>  - set it on both, the same as in the last version happens.
>
> I declare my form like this:
>
> class InvitationForm(AjaxForm):
>
>     action = "invite"
>     ajax_form_name = "foobarbaz"
>
>     strip_name = True
>
>     class fields(WidgetsList):
>
>         document = HiddenField(
>             validator=ModelValidator(Document, not_empty=True),
>             strip_name = True
>             )
>         message = TextArea(
>             strip_name = True
>             )
>         emails = EmailCompletionField(
>             validator=SplitValidator(
>             Email(),
>             separator=" ",
>             not_empty=True
>             ),
>             callback=url("/users/email_autocomplete"),
>             callback_parameter="email",
>             strip_name = True
>             )
>         submit = AbletonButton(default="Invite")
>
> AjaxForm is a direct subclass of TableForm, and only pulls in some JS.
>
> Any suggestions what's going on here?
>
> Oh, btw, I had to patch generate_schema in tw/forms/core.py, because
> otherwise TW would try & merge my field-validators with a schema - yet they
> aren't schemas semselves.

Ok, I found the solution - instead of giving strip_name on the class-level, I 
have to pass it to the form-constructor.

I can live with this - however, I was under the assumption that TW makes it 
possible that one can declare these things on the class declaration. Is that 
a bug or just a misconception on my side?

Diez

--~--~---------~--~----~------------~-------~--~----~
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