I realize this is more a velocity question, but the velocity email list is shared with the jakarta commons list and doesn't seem to have much velocity traffic on it.
What I'm trying to do is create a velocity macro that can define an input field using a fixed name for the field and have that macro have provisions for default values for the field based on the fields fixed name. For example, I'd love to do something like
#macro ( myInput $fieldName )
<INPUT TYPE="TEXT" NAME="FLD_$fieldName" VALUE="$!{VALUE_${fieldName}}">
#endso
#myInput ( "UserName" )
becomes
<INPUT TYPE="TEXT" NAME="FLD_UserName" VALUE="Gerry">
Assuming my Context has a symbol called VALUE_UserName in it set to the string "Gerry" (i.e. context.put("VALUE_UserName", "Gerry")).
In short, the ability to have an interpreted reference/variable name.
It would also let me do things like having macros that knew how to display errors attached to fields automatically. Consider:
#macro ( myInput $fieldName )
<INPUT TYPE="TEXT" NAME="FLD_$fieldName" VALUE="$!{VALUE_${fieldName}}">
#if ( ${ERROR_${fieldName}} )
<FONT COLOR="red">* ${ERROR_${fieldName}}</FONT>
#end
#endThis gives my verification routines a great deal of flexibility and allows very generic forms processing modules.
Any thoughts (on how to do this or if you think I'm bonkers, that is :-)?
Gerry
-- Gerry Duprey ________________________________________ SchoolsOPEN, LLC 123 North Ashley, Suite 120 Ann Arbor, MI 48104 Phone (877) 483-1944 Ext. 401 Fax (734) 661-0819
Visit us Online at www.Schools-OPEN.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
