Grails data-aware tags coming to core soon…

Posted by: on Apr 14, 2008 | 4 Comments

Following from the update of the ModelTagLib (which I mustn’t forget was derived from an original ModelTagLib somebody posted on grails.org a long time ago) I posted on grails.org, there will be some new developments.

I’m going to refactor the taglib bearing in mind some comments from Graeme and some cleaning up I’ve wanted to do, and add some new features.

Then it should become part of Grails core in 1.1 as the "bean" taglib. We should even be able to refactor Grails scaffolding to use the tag and save a shedload of code. Of course we’ll need to write a whole bunch of unit tests for the tags. Any volunteers? (Lazy? No I’m busy… and… and… it’s better if the author of the tests isn’t the author of the code – right?)

 

 

4 Comments

  1. Marcel Overdijk
    April 15, 2008

    Marc,

    I never used your ModelTagLib but it sounds interesting. As it will generate labels, also please think about internationalization support.

    Cheers,
    Marcel

    Reply
  2. Marc Palmer
    April 15, 2008

    Marcel… what do you take me for?! :)

    It already supports it using message ndles of course! You can even customize the label template / position relative to fields in case it is culturally important for it not to be on the left.

    Reply
  3. kris helenek
    April 18, 2008

    Hi Marc,
    Just so i understand your ModelTagLib correctly, if my controller returned a model with just a user object, would my tag look like this?

    Would it make sense for the above code to produce an input with a name “user.firstName”, so you don’t have to create an object wrapper like the form object in your example (am I correct in assuming its a single obj containing your model?)

    Also, since many forms are based off of one bean, have you considered expanding the form tag to include a “default” bean, eg:
    or

    then nice concise tags:

    and you can override it like:

    Is there a better place to discuss stuff like this (mailing lists?) Anyway, interested in hearing more about the new features and the direction (is javascript validation in the pipeline, for example?)

    Reply
  4. Marc Palmer
    April 21, 2008

    Sorry Kris your html got munged by the blog.

    It uses a field name compatible with grails binding. We can add in an attribute to allow you to relate it to a specific prefix so that you can have multiple command objects binding.

    However note that the propertyName supports dot notation for nested properties.

    We will be adding a “smart” tag that will auto sense the default type of control to render for a given property, and also one to render all the properties of a bean using default controls.

    Mailing lists – the grails user list is very active, and the best place!

    Reply

Leave a Reply