Using html:errors with a field that is iterated.
Hi all I am using struts 1.2.9 and starting to work on error validation. So far I have my login page using: html:errors property=username/html:errors etc etc etc. I was wondering firstly Is this still the best manner in which to display errors ? The second question which has more to do with the title is How does one use error validation on fields that are iterated ? As an example if I have 3 fields where a team has to enter a score, I want to ensure that the only values that are entered beside each field is a number. If any of those fields have other than a number I want the error to appear only beside that particular field. Is this something that can be done with error validation ? I am looking around for examples but most examples are quite dated and I am trying to use the best things available to me. thanks in advance. Adam
Re: Using html:errors with a field that is iterated.
Hi Adam, Yes, I think html:errors is a pretty good validaiton mechanism. Especially if you use the Struts validation framework (validation.xml, validator-rules.xml) for generating your errors. For showing errors right beside each specific field that fails the validation, you will need to have html:errors property=property-name/html:errors tag beside each field. But if you want to show all the errors at once (say above all the fields) then you can use html:errors/ tag as-is. Check this link for more info : (this link is not _outdated) http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html#section2 hope this helps, robin On 11/3/06, Adam K [EMAIL PROTECTED] wrote: Hi all I am using struts 1.2.9 and starting to work on error validation. So far I have my login page using: html:errors property=username/html:errors etc etc etc. I was wondering firstly Is this still the best manner in which to display errors ? The second question which has more to do with the title is How does one use error validation on fields that are iterated ? As an example if I have 3 fields where a team has to enter a score, I want to ensure that the only values that are entered beside each field is a number. If any of those fields have other than a number I want the error to appear only beside that particular field. Is this something that can be done with error validation ? I am looking around for examples but most examples are quite dated and I am trying to use the best things available to me. thanks in advance. Adam
Re: Using html:errors with a field that is iterated.
On 11/3/06, robin bajaj [EMAIL PROTECTED] wrote: Hi Adam, Yes, I think html:errors is a pretty good validaiton mechanism. Especially if you use the Struts validation framework (validation.xml, validator-rules.xml) for generating your errors. Yes I am using validation.xml and validator-rules.xml. For showing errors right beside each specific field that fails the validation, you will need to have html:errors property=property-name/html:errors tag beside each field. For this question I was more curious about those fields that are being generated by using an iterator, which means there may be many fields with the same validation needs, but I won't know how many fields there are. Basically I am wondering if there is a manner to use error validation to preform validation on a list that may have from zero to hundreds of elements. The list that I am using is being created by : logic:iterate name=ProdSelectionForm property=results id=results html:text name=results property=numProducts indexed=true / Hopefully that question makes sense. But if you want to show all the errors at once (say above all the fields) then you can use html:errors/ tag as-is. Check this link for more info : (this link is not _outdated) http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html#section2 hope this helps, thanks for the help so far. robin On 11/3/06, Adam K [EMAIL PROTECTED] wrote: Hi all I am using struts 1.2.9 and starting to work on error validation. So far I have my login page using: html:errors property=username/html:errors etc etc etc. I was wondering firstly Is this still the best manner in which to display errors ? The second question which has more to do with the title is How does one use error validation on fields that are iterated ? As an example if I have 3 fields where a team has to enter a score, I want to ensure that the only values that are entered beside each field is a number. If any of those fields have other than a number I want the error to appear only beside that particular field. Is this something that can be done with error validation ? I am looking around for examples but most examples are quite dated and I am trying to use the best things available to me. thanks in advance. Adam