From: Keats <ke...@xa...> - 2004-03-08 23:04:34
|
I've been playing around with some new stuff for WM and I thought I'd solicit some feedback: 1) CookieTool added the ability to set attributes by adding a setNew() method, so now you can say: #set $Cookie.New.Dohicky = "My little dohicky." #set $aCookie.Domain=".acme.com" #set $aCookie.Path="/" #set $aCookie.MaxAge=365*24*60*60 $Cookie.add($aCookie) I also created a wrapper for the Cookie that does stuff like automagically URL encode/decode the value if necessary. 2) FormTool Added the ability to set default values for all form elements and/or for each form element, eg, $Form.DefaultValue = null $Form.Name.Default = "Guest" (The default DefaultValue is now the empty string.) I deprecated "getPossibleForm" and added a new version called "getIgnoreCase", so: $Form.IgnoreCase.NAME, will retrieve an element called "name", "Name", "NAME" etc. (The first one it finds.) I also added isExists(), so the following works regardless of the default values: #if ($Form.Exists.Name){ ... 3) #try directive Simplified version of the Java construct. #try without #catch works kind of like the old #silent directive. If you specify #catch you get a local $ERROR variable: #try { #set $Customer.Category = $cat } #catch { #set $Customer.Category="INVALID" } [Note: you pretty much need to use the CrankyEEH with this.] I remember Eric saying he did this a while ago, but then Brian talked him out of it. I'd like to hear the reasoning. I find it quite useful for validation and debugging. Let me know what y'all think. Keats |