Friday, March 25, 2005

Toward Spyce components

Making progress towards WebObjects/Tapestry/ASP.NET/JSF-style reusable components. As a first step, I've checked in code to svn trunk allowing the defining of handlers to run on form submissions. Working example:
[[\
def __init__(self):
   self.i = int(request.getpost1('i', 0))

def plusone(self):
   self.i += 1

def plustwo(self):
   self.i += 2

]]

<f:form>
   [[= self.i ]]
   <f:hidden name="i" value="=self.i">
  
   <f:submit handler="self.plusone" value="Add one">
  
   <f:submit handler="self.plustwo" value="Add two">
</f:form>

No comments: