Velocity

I am wondering if this is possible in a velocity module -

<code>

<tr>

<input type="radio" name="positionType" class ="radio" value="New" #if ($positionType == "new") checked #end>New

<input type="radio" name="positionType" class ="radio" value="Replacement" #if ($positionType == "Replacement") checked #end>Replacement

</tr>

<tr>

<td valign="top">Date Initiated</td>

<td>

<input name="initiationDate" type="date" value="#if($positionType == "new") $validator.getElement("positionID").setReqd(true) #end">

</td>

</tr>

</code>

What i am trying to do is depending on the value of the radio button type positionType, i am trying to set a property value for a java object validator.

The problem i am facing is when the form is being loaded the value for positionType is not reflected properly.

So i was wondering if this is possible at all using the velocity module.

[1042 byte] By [ssv45324a] at [2007-10-2 16:43:42]
# 1
We use Velocity in our projects and we are happy with it. It is not quite clear what you need.
BIJ001a at 2007-7-13 17:53:16 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
Pairs of {} can help in cases:${validator.getElement("positionID").setReqd(true)}
BIJ001a at 2007-7-13 17:53:16 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
What does { do?
ssv45324a at 2007-7-13 17:53:16 > top of Java-index,Other Topics,Patterns & OO Design...
# 4
${} is a syntax hint for Velocity to help parse the expression. .
BIJ001a at 2007-7-13 17:53:16 > top of Java-index,Other Topics,Patterns & OO Design...
# 5

Did your copy of Velocity come with documentation? Mine did.

Formal Reference Notation

Shorthand notation for references was used for the examples listed above, but there is also a formal notation for references, which is demonstrated below:

${mudSlinger}

${customer.Address}

${purchase.getTotal()}

BIJ001a at 2007-7-13 17:53:16 > top of Java-index,Other Topics,Patterns & OO Design...