Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Validator on map-backed Form properties?

 
P-A Rosenberg
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'm trying to achive Javascript based form validation using the Struts validator framework on a Form containing a Map.

I think I know how to validate this "server side" but is it possible to use the Validator framework for the purpose and generate a javascript popup?

Copy/paste from Form:
public class OrderResourceModifyForm extends ValidatorForm
{
private Map timeTypePrices;
public OrderResourceModifyForm()
{
this.timeTypePrices = new HashMap();
}

public void setTimeTypePrice(String key, Object value)
{
this.timeTypePrices.put(key, value);
}

public Object getTimeTypePrice(String key)
{
return this.timeTypePrices.get(key);
}
}


Copy/paste from JSP:
<c:forEach var="orderResourcePrice" items="${timeTypePriceList}">
<tr>
<td>
<html-el:text property="timeTypePrice(${orderResourcePrice.timetype.id})" value="${orderResourcePrice.pricePerHour}" />
</td>
</tr>
</c:forEach>


Please help me write the field entry in my validation.xml in order to validate the input stored in the map timeTypePrices!
The attempt below doesn't do the trick...

<form name="OrderResourceModifyForm">

<field
property="timeTypePrices"
indexedListProperty="timeTypePrices"
depends="required, float" >
<arg0 key="label.orderresource_add_edit.price_per_hour"/>
</field>

</form>

Any help is appreciated!
Regards
//P-A
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic