On Feb 24, 8:25 am, "Scott L. Burson" <[email protected]> wrote: > On Thu, Feb 23, 2012 at 4:06 PM, Adam White <[email protected]>wrote: > > > Hi guys, > > > I'm trying to define a "PHONE" presentation, to store phone numbers as > > a string, but display them is Australian format. > > I've defined the classes & methods below - but in a gridedit, none of > > this seems to be working. > > i.e. phone numbers are displayed without formatting, parser is not > > called, error message on invalid input defaults to the standard > > message "Please enter a value", and so forth. > > > Any ideas what I'm missing? > > I haven't checked your code, but I notice you haven't said anything about > your view declaration. To tell Weblocks to use a custom presentation and > parser you normally say things like > > (defview foo-table-view (:type table) > ... > (phone :present-as phone) > ...) > > (defview foo-form-view (:type table) > ... > (phone :present-as phone :parse-as phone) > ...) > > Then you supply those view names when creating the widget.
Boomshakalak! >From examples cribbed on the 'net (e.g. Sohail's blog, and a few others), I had thought the presentation was cribbed from the :type of the slot. That appeared to be the purpose of the weblocks:typespec->view-field-presentation method > Does that help, or did you already know this? Nope, I'd thought the :present-as slot option was for making <select> widgets and the like. Thanks Scott, that sounds like the solution. Adam -- You received this message because you are subscribed to the Google Groups "weblocks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/weblocks?hl=en.
