HTML Helpers defaults

I was really happy when I found out you guys had an equivalent to cfwheels’ form helpers.

However there is one feature I can’t figure out. In wheels I can go to settings.cfm and add:

set(functionName=“textField”, labelClass=“control-label”, prependToLabel=’

’, appendToLabel=’
’, append="
", labelPlacement=“before”);

What this does is prevent me from having to set these fields every time I use the textfield tag, it just assumes what I set it to in the settings file, I can even override the default if I want.

How do I set defaults for html.textfield and others?

I haven’t used the HTML Helper a ton so Luis can correct me if I’m wrong, but I don’t think we have a way to save a reusable “template” of how an element should be rendered. I can think of some interesting ways to do that, perhaps with providing closures or something to build an HTMl block with DSL or something. Nonetheless, can you put in a ticket so we can discuss. We’d love input and pull requests on the matter :slight_smile:

https://ortussolutions.atlassian.net/browse/COLDBOX

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thanks Brad, I opened up a ticket.

Actually that’s one thing that I have found very helpful about cfwheels is that I can use the set() tag to set defaults for any core function in the framework. Keeps the code very DRY.

Not sure if thats possible with coldbox or not?

It would depend on what you are trying to achieve?

Propose or better yet, do some proof of concepts and we would add it.

As for the HTML helper. Maybe you can store default values to the arguments to each of the functions. Does that make sense?

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano