You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by James Bullen <ja...@columbiadkv.com> on 2002/05/02 00:23:04 UTC
accessing column metadata in templates
i want to use column metadata in my templates. a simple case is setting
the maxlength attribute in an input element in a form.
eg.
in the sample app schema:
<column name="TITLE" size="255" type="VARCHAR"/>
defines the Title column for the Rdf object and says it has a size of
255. it seems reasonable to want to access that metadata in a form to
set maxlength. i couldn't see any examples of this, nor any discussion
in the archive. you can use intake to define a maxlength but this is
done server-side (requiring a roundtrip to enforce), and duplicates the
definition.
so i want another approach. i tried putting a TableMap in the context in
Form.java
TableMap tabmap = RdfPeer.getTableMap();
context.put("tabmap", tabmap);
(which required making getTableMap public - the first hint i was heading
in the wrong direction ;)
then, in theory, in Form.vm i could say something like:
#set ( $col = $tabmap.getColumn("TITLE") )
<input name="title" maxlength="$col.getSize()" value="$entry.Title">
unfortunately getSize() always returns 0 ... i haven't investigated this
further because i feel like i'm off track.
does anyone have a good way to do this? it feels like the sort of ground
that should be well-trodden ...
any help appreciated.
cheers,
james
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>