Tagged: mvc Toggle Comment Threads | Keyboard Shortcuts

  • Joe 15:01 on March 6, 2009 Permalink
    Tags: declarative, model, , mvc, , , xforms   

    MozCamp – XForms and Declarative Applications 

    Steven Pemberton, author of the ABC programmin...

    Steven PembertonImage via Wikipedia

    XForms and Declarative Applications” – Steven Pemberton

    HTML Forms are a great success, the basis of the e-commerce revolution etc. but unanticipated at the time.

    After more than a decade of experience time to move on, move away from the misconception of HTML as a presentation language. More abstraction is needed for advanced purposes. Compare presentational HTML to the Zen Garden approach of basic HTML and rich CSS.


    • Ease of authoring
    • Good user experience
    • Ease of changing
    • Device independence (mobile platforms anyone?)
    • Accessibility
    • i18n
    • Validation

    The essence of XForms

    Complete separation of Date from Content: Instances and Controls

    The instance specifies the values being collected. Datatypes specify client side validation and constraints for values entered, even more complex logic like state is only required if county equals USA. Submission actions define the target for the data and what should be done with the result. Together this forms the model, the datasheet.

    Abstract or intent-based controls. These are bound to the data (values). Syntax is simply binding an input control to a data item, by which the input knows what data type should be expected and the correct control is chosen. E.g. input for birthdate, whre birthdata is of type date, renders a calendar input popup.

    The default XForms give you a toolbox which is very similar to a spreadsheet, no programming needed for common use cases. The actual XForms definition consist of standard XML and the data / values are transferred as XML as well.

    Any XML data can be bound to a control, so there’s nothing which prevents editing a xhtml document (as instance) by using XForms syntax. Any page element can be bound by using XPath. Only restrictions: the page must be well-formed xhtml and the server must accept PUT or POST in order to update the page.

    Other nice features include:

    • i18n for all form elemens, including labels.
    • auto-complete on form fields (demoed with live google translate per word, as you type.
    • live search: flickr images
    • geo-location as pair of lat/long or a map, bound to the same resource and so updating each other on change.

    Implementations vary from plugins (for msie) and native (mozilla). Big vendors use XForms as part of their CMS and Application servers already. Most of this is not user visible, you just experience a rich user interface in the browser.

    As a proof of concept, someone built a google-maps like application entirely in XForms which needed 25k of XForms data, compared to over 200k Javascript for Google Maps. Experience learns that one order of magnitude more code takes 34 times as much of effort (time, costs, bugs).

    Current browser support is still limited, but the ubiquity-xforms library aims at extending existing Ajax libraries to add XForms support for a broad range of browsers.

    Reblog this post [with Zemanta]
  • Joe 12:19 on February 26, 2008 Permalink
    Tags: , finderQuery, mvc, Nigel McNie, pagination, patch,   

    Using pagination with CakePHP’s finderQuery SQL 

    Cakephp 1.2

    Update February 2009: this article is now about a year old and deals with an early beta versions of CakePHP 1.2. In the mean time, CakePHP 1.2 has been released with many improvements and great documentation. Please don’t use this patch, use this instead. I’ll leave the article below for reference.

    Cakephp lets you define various kinds of associations between models. The principle is really simple, just define arrays like $hasMany in your main model, where associations with other models are defined.

    For most purposes this does the trick, most associations are made by convention, but you can override these as well for e.g. database (foreign-) keys.

    From there on, you can use all cake built-in functionality to retrieve model data. One such feature is auto pagination, where the page size is set through the value of the limit field in the model’s definition.

    If you’re crafting something really complex, you can define your own SQL query in the finderQuery field. This is very nice, but the trade-of is that the other fields are ignored in the query. And if fields limit and offset are ignored, you no longer get auto pagination.

    The patch below fixes this for the current development tree of CakePHP 1.2 (revision 6461).
    (More …)

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc

Twitter links powered by Tweet This v1.8.3, a WordPress plugin for Twitter.