You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kosigi Gururaj <ko...@aceva.com> on 2003/04/01 20:43:36 UTC
Vlidation problem by using indexed="true" in
Hi
I am facing a problem with validation by using indexed="true" in <logic:iterate>...
My form is AmountForm and here is the code
public class AmountForm extends ActionForm
{
private ArrayList amountVO = null;
public ArrayList getAmountVO()
{
return m_promiseToPay;
}
public void setAmountVO(ArrayList amountVO)
{
this.amountVO = amountVO;
}
}
The arraylist in AmountForm.java contains the object of AmountVO. The AmountVO looks like
public class AmountVO
implements java.io.Serializable
{
private String amount;
private String date;
}
in the jsp i am iterating it like this....
<html-el:form method="GET" action="/payment/edit" onsubmit="return validateAmountForm(this);">
<logic:iterate id="Id" name="AmountForm" property="amountVO" indexId="index">
<tr>
<td>
<html:text indexed="true" name="Id" property="date" size="12"/>
</td>
<td>
<html:text indexed="true" name="Id" property="amount" size="20"/>
</td>
</tr>
</logic:iterate>
<table class="dialogButtons" cellpadding="0" cellspacing="0">
<tr>
<td class="dialogButtons">
<nested:submit><bean-el:message key="activity.submit" bundle="CommonResources"/></nested:submit>
<html-el:cancel><bean-el:message key="activity.cancel" bundle="CommonResources"/></html-el:cancel>
</td>
</tr>
</table>
</html-el:form>
<html:javascript formName="AmountForm" dynamicJavascript="true" staticJavascript="false"/>
Here there is no problem in rendering the page ...I am able to see the 2 rows if the array list contains 2 AmountVO object.
Now the problem is, if i enter a new date value in "date",i want it to validate with validation.xml..
so i added an entry like this in validation.xml
<form name="AmountForm">
<field property="date"
indexedProperty="Id"
indexedListProperty="amountVO"
depends="required">
<msg name="required" key="errors.date.empty"/>
</field>
</form>
even after entering this , I am not able to validate...
in the view source of the jsp i will see this code....you can see the function required() is blank..
<script type="text/javascript" language="Javascript1.1">
<!-- Begin
var bCancel = false;
function validatePromiseToPayForm(form) {
if (bCancel)
return true;
else
return validateRequired(form);
}
function required () {
}
//End -->
</script>
basically my problem is how will i validate a Form with list....it is very urgent..
so any body can help me out...
Thanx in advance.
rgds
Guru
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org