Ticket #82 (new defect)

Opened 2 years ago

Last modified 2 years ago

Forms do not submit

Reported by: colin Assigned to: somebody
Priority: highest Milestone:
Component: form-renderer Version:
Severity: blocker Keywords:
Cc: colin@thusa.co.za

Description

I posted this long ago. It was closed as "unreproducible". I'd have pasted reproduction code if this Trac wasn't entirely broken, as it wouldn't let me reply.

With *latest* *nevow* *subversion* *release*.

class DefaultPage(rend.Page, formal.ResourceMixin):
    addSlash = True
    def __init__(self, avatarId = None, db = None, *a, **k):
        rend.Page.__init__(self, *a, **k)
        formal.ResourceMixin.__init__(self, *a, **k)
<etc...>

class addPage(Page):
    def __init__(self, domain = None *a, **ka):
        PageHelpers.DefaultPage.__init__(self, avatarId, db, *a, **ka)
        # <etc...>

    def childFactory(self, ctx, seg):
        # child factory is overridden
        if not self.domain:
            return addPage(seg)

    def form_addForm(self, data):
        form = formal.Form()
        FormDefs.userForm(form) # Adds some fields, not part of reproduction requirement
        form.addAction(self.submitForm)
        return form

    def submitForm(self, ctx, form, data): # This is never called
        print "what the hell???"

In the same instance, if the previous older versions of Forms are used, there is no problem.

In the resulting code the method points to post back to the page URL itself, I suspect FORMS_KEY is not being inserted correctly into that URL - or there is some kind of confusion over how the form post is being intercepted.

Either way - Formal is totally useless in this condition.

In case this idiotic trac instance breaks again, I've cc'd myself.

Change History

11/07/06 00:23:54 changed by mg

The code you posted was not especially useful - i.e. it doesn't actually make sense in a few places - but I suspect the problem is the order of DefaultPage?'s base classes. ResourceMixin? relies on its renderHTTP() method getting called first (or at all, in fact) to spot a POST'd request.

Try this instead:

class DefaultPage(formal.ResourceMixin, rend.Page):
    ...

Hope that helps. If not, please post a complete, minimal, failing example.