def __init__(self, control, statuslist): super(StatusForm, self).__init__('POST', '') self.setAttribute('id','sf') self.controller = control self.statuslist = statuslist self.textarea = TextArea().setAttribute("placeholder", "What's up?") self.submit = SubmitButton("Honk!") self.add(self.textarea, self.submit) self.onSubmit(self.submit_status)
class StatusForm(Form): def __init__(self, control, statuslist): super(StatusForm, self).__init__('POST', '') self.setAttribute('id','sf') self.controller = control self.statuslist = statuslist self.textarea = TextArea().setAttribute("placeholder", "What's up?") self.submit = SubmitButton("Honk!") self.add(self.textarea, self.submit) self.onSubmit(self.submit_status) def submit_status(self): self.controller.submit_status(self.textarea.getValue(), self.sucessful, self.fail) return False; def sucessful(self,response): print "Submission successful" self.textarea.setValue("") def fail(self, status): print "Submission failed"