This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

hey guys how can i validate array of data dynamically(the array is created dynamically by javascript) knowing that i get error every time saying that it is not a binded object and it is a string (the object i am trying to validate it)so how can i overcome this ?

thnaks alot for your time

Hi,

some detailed information & code would help to solve the problem you're having. You can call the validator e.g. in the 'SimpleFormController' by implementing some appropriate method.
And as far as I know, you can manually bind the data aswell in the controller.

//where Financialtransactiondetails is the list that contains the dynamic //data

Iterator itr=document,.getFinancialtransactiondetails().ite rator();

while(itr.hasNext())
{
Object currenct=itr.next();
Long cashAmount = new Long(((FinancialTransactionDetails)currenct).getAm ount());
log.debug(">>>>>>>>>>>>>>>>>>> cashAmount "+cashAmount);
Sum+=cashAmount;
}
//if the sum of all the money = the amount that the user entered then //every thing is good else i will raise an error

if(!Sum.equals(amount))
errors.rejectValue("amount","Error In Amount","Total Amount Must Be Equal To Details Amount");

}

--------------------------------------------------END OF VALIDATION-----------------------------------------------

*when i enter a wrong amount then i will be prompeted to enter the correct amount(that is right) and when i enter the correct amount (just to correct the wrong amount i entred before) i get the CLASS CAST EXCEPTION , if i entred it correct from the 1st time everything will work just fine......well got any idea