HI, I am trying to validate a fully dynamic form populated from the database.The validation works fine with an ActionForm with the following properties: private String[] fieldIdMemberIds; private String questionName; private HashMap hashMap = new HashMap();
The problem is repopulating the dynamic field values back from the hashMap into the dynamic fields.The fields in error are getting highlighted properly with a custom tag but the previously entered data is lost. Is there a way I can populate back the varying fieldIdMemberId fields from the hashMap.(how does DynaForm populate fields back from just form-property names). Pls correct me if I am totally offbase here in using reset() here. Thanx, Vijay Here is the relevant code in the ActionForm class: public void reset(ActionMapping mapping, HttpServletRequest request) { String[] fieldIDMemberIds = getFieldIdMemberIds(); if (fieldIdMemberIds != null) { for (int i = 0; i < fieldIDMemberIds.length; i++) { String fieldIdMemberId = fieldIDMemberIds[i]; String answer = request.getParameter(fieldIdMemberId); if (answer != null && answer.length() > 0) { //TODO:repopulate the dynamic fieldIdMemberId fields with answers from the hashMap ??????????????? } } } } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { boolean validated = true; ActionErrors errors = new ActionErrors(); String[] fieldIDMemberIds = getFieldIdMemberIds(); if (fieldIdMemberIds != null) { for (int i = 0; i < fieldIDMemberIds.length; i++) { String fieldIdMemberId = fieldIDMemberIds[i]; String answer = request.getParameter(fieldIdMemberId); if (answer == null || answer.length() < 1) { ActionError newError = new ActionError("validate.error.required",fieldIdMemberId); errors.add( fieldIdMemberId, newError); // Return back to the previous state validated = false; } else { hashMap.put(fieldIdMemberId,answer); } } //set selected answers setHashMap(hashMap); } if (validated) { return null; } else { return errors; } } -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>