Struts and ValidatorForm --> does it work with variable number of form elements? -


hi,

i have form generate rows of input elements (using javascript) users enter data. each row contains data particular box user entering (e.g. height, width, length, etc.). i've gotten form work , can read actionform into/out of arraylist object.

i'd validate these entries catch invalid entries front. (i'm on 1.3.10) can't seem find documentation using validatorform dynamic number of form elements. is, never know how many rows of boxes entered, , wonder if has used validator validate dynamic form elements?

is possible? or resigned implement .validate() method?

is possible use validator elements , leave rest .validate() method? has done this, , if so, pitfalls?

i'd appreciate comments or pointer resource can read up.

you can making following steps.
1. define class (simple pojo) dimensionbean; contains value of 1 row input elements (like height, width, length etc).
2. in form bean (child of validatorform), define array or list of dimensionbean. name of array arrdimensionbeans.
3. in validation.xml can define follows

<field property="height" indexedlistproperty="arrdimensionbeans" depends="validwhen">       <arg0 key="yourform.height.label"/>         <var>           <var-name>test</var-name>           <var-value>((arrdimensionbeans[].width == null) or (*this* != null))</var-value>         </var>       </field> 

this check height if width null or height not null. can change var-value per requirement. hope solve problem.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -