Ian Bicking Wrote :
>>
Hmm... if the form is submitted successfully, then getForm won't render
a form, but will pass control to a method you defined in your formDef.
That might be it...?
<<
I don't think so. My formDef is :
formDef = FormDefinition('Login', 'writeForm',
[Field.TextField('userid',
maxLength=40,description='User ID'),
Field.PasswordField('password', size=10,
maxLength=20),
Field.SubmitButton('submit', description='Login',
methodToInvoke='login'),
],
formValidators=[ValidateForm()])
my (cut down) login method :
def login(self, fields):
self.write("You are logged in!")
when I do a successful login (which passes the validators) I get the form
content I expect with "You are logged in" written to the output above it
which is what I expect.
If the validation *fails* then I don't get *anything* from getForm() in my
output (no form at all) unless I do :
> def getContent(self):
> x = self.getForm()
> #
> #getForm() will return None on a POST so..
> #
> if not x: x = self.writeForm()
> return x
In which case I get the form in my output along with the standard validation
failure messages.
Its strange but I do at least have something working now.
- Ian Sparks.
-----Original Message-----
From: Ian Bicking [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 7:55 PM
To: Ian Sparks
Cc: 'Aaron Held'; Webware-Discuss "(E-mail)
Subject: RE: [Webware-discuss] FunFormKit : 2nd Attempt.
Hmm... if the form is submitted successfully, then getForm won't render
a form, but will pass control to a method you defined in your formDef.
That might be it...?
On Wed, 2002-04-03 at 16:18, Ian Sparks wrote:
> Thanks Aaron. I'm getting somewhere. Your suggestion works for me on a
HTTP
> GET. To make it work on a POST too I did :
>
> class Login(eSitePage, FormServlet):
> def __init__(self):
> FormServlet.__init__(self, 'getForm', [formDef])
> eSitePage.__init__(self)
>
> def writeForm(self):
> return self.renderableForm().htFormTable(bgcolor="#ddddff")
>
> def login(self, fields):
> self.write("You are logged in!")
>
> def getContent(self):
> x = self.getForm()
> #
> #getForm() will return None on a POST so..
> #
> if not x: x = self.writeForm()
> return x
>
> This not responding to a POST is strange.
>
> Note that I'm passing 'getForm' to the form servlet so I can do other
things
> in getContent as well as fetch the form (perhaps that is part of my
> problem?)
>
> Thanks for helping me out on this one!
>
> - Ian Sparks.
>
>
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss