As near as I can tell, Rose::HTML::Form (and probably
Rose::HTMLx::Form) is meant to be adjusted in its presentation
solely by CSS and/or Javascript. It is not possible to mark this
up semantically in HTML (or XHTML)?
As I feel semantic markup for what I am doing it worth the effort,
I am using Rose::HTML::Form::Field for things, and then using the
->html output to insert into strings or directly into Mojolicious
(epl) forms. It's entirely possible I am missing something, user
interfaces are not something I am good at (differential equations
are much easier). Am I correctly interpretting what the
Rose::HTML namespace provides?
Thanks.
Gord
Each Rose::HTML::Object-derived object can return its own markup by
calling one of the html/xhtml methods. Methods are available for
parts of the object's markup (e.g., the label, the error, the field
itself) or for the whole field, label and all. Example method names:
html(), html_field(), html_label(), html_error(), etc. To change the
markup, you can subclass the field and override one or more of these
methods. Making a "private library" may help you do this by providing
subclasses for any new/overridden methods:
http://search.cpan.org/dist/Rose-HTML-Objects/lib/Rose/HTML/Objects.pm#PRIVATE_LIBRARIES
> As I feel semantic markup for what I am doing it worth the effort,
> I am using Rose::HTML::Form::Field for things, and then using the
> ->html output to insert into strings or directly into Mojolicious
> (epl) forms.
You're not really expected to call html() on a Rose::HTML::Form
object, since how a form is arranged varies so widely. Instead,
you're expected to call $form->start_html, then call
$form->field('foo')->html() (or html_label(), html_field(),
html_error(), etc.) and so on for each field, inserting them into your
template where you want them to go.
-John
Also, if you do have a very consistent way that you want forms rendered,
you can certainly add a method to your Rose::HTML::Form subclass to
render the form in that specific way. Another approach is to stash the
form rending logic in a TT BLOCK, whatever your templating engine of
choices version of BLOCK is.
Adam