Re: Spyce 2.2 - Highligthing form field on error

"Jonathan Ellis" <[email protected]> Thu, 22 Feb 2007 08:18:20 -0800
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
Currently there is no support for that.  It's possible to add but it
would be a little more cumbersome, since you'd need to tell the
exception what form element to render it with, as well as the existing
name-for-display.

-Jonathan

On Thu, 22 Feb 2007 09:00:06 +0800, "Mohd Kamal Bin Mustafa"
<[email protected]> said:
> Hi, first time testing spyce though I've followed it's development
> since pre 2.0. Testing the example in
> http://spyce.sourceforge.net/docs/doc-tag_handlers.html, it works as
> expected except that it only print the validation error on top,
> mentioning the form element that failed. What if I want to highlight
> every elements that got error, let say set the field border to red ?
> Does it easily doable in spyce ?
> 
> The code from example:-
> 
> [[!
> def calculate(self, api, x):
>     from spyceException import HandlerError
>     try:
>         x = float(x)
>     except ValueError:
>         raise HandlerError('Value', 'Please input a number')
>     if x < 0:
>         raise HandlerError('Value', 'Cannot take the square root of
> negative numbers!')
>     self.result = x ** 0.5
> ]]
> 
> <spy:parent title="Active Handler Validation" />
> <f:form>
>     <f:text name="x" default="-1" label="Value:" />
>     <f:submit handler="self.calculate" value="Square root" />
> </f:form>
> 
> <p>
> Result: [[= hasattr(self, 'result') and self.result or '(no result yet)'
> ]]
> </p>
> 
> thanks.
> 
> -- 
> kamal, www.k4ml.com
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Spyce-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/spyce-users

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV