Jorge Loyo said the following on 09/17/2009 10:38 AM:
> I am building an application for e-commerce and I was thinking I could
> have a few custom tags. For example, I was thinking of having a
> customtag like <store:top25 />, but I don't know how this would work
> to retrieve data since it won't go through the normal event cycle... I
> mean, I can just call my service directly from there, but this just
> seems a little dirty...
>
Yes it is a messy. Doesn't mean you cannot use custom tags in your
application, but I would limit them to having data passed into them.
You could do:
<store:top25 data="#event.getArg("storeData")#"/>
I've really started liking custom tags in the pass year for formatting /
utility work. Mach-II 1.8 is shipping with a complete form custom tag
library and a view tag library (metadata, etc.).
This is a clear example of custom tags encapsulating tedious code work:
<form method="post" encType="multipart/form-data"
action="#BuildUrl('processUser')">
<h4>First Name</h4>
<p><input id="firstName" value="#event.getArg('user').getFirstName()#"
type="text" name="firstName"/></p>
<h4>Last Name</h4>
<p><input id="lastName" value="#event.getArg('user').getLastName()#"
type="text" name="lastName"/></p>
<p><input type="submit" value="Save Changes" /></p>
</form>
To this - (this produces the same HTML the above would):
<cfimport prefix="form" taglib="/MachII/customtags/form" />
<form:form actionEvent="processUser" bind="user">
<h4>First Name</h4>
<p><form:input path="firstName" /></p>
<h4>Last Name</h4>
<p><form:input path="lastName" /></p>
<p><input type="submit" value="Save Changes" /></p>
</form:form>
Saves a lot of typing, especially when you get into select boxes and
radio groups -- pre-selecting options is a bunch of ifs and error prone.
.pjf
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/
Wiki / Documentation / Tickets:
http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/
-~----------~----~----~----~------~----~------~--~---