HI,

I have the following DynaFormBean defined in tiles-def.xml:

<form-bean  name="answerDetailsForm"
                  dynamic="true"
                  type="org.apache.struts.action.DynaActionForm">
                  <form-property name="fieldIdMemberIds"
type="java.lang.String[]" />
                  <form-property name="questionName" type="java.lang.String"
/>

</form-bean>
 
I am using the following code excerpt from the form which creates the
<%=name%> dynamically
based on values returned from the database.I want to use DynaFormBeans or a
sub-class of it 
or DynaValidatorForm to make sure that the field is required and one of the
radio buttons for 
each field is checked. How can I do that ?




<%
 for (int i1=0;i1 < fields.length; i1++) {
        Field field = (Field)fields[i1];
        long fieldId = field.getFieldId();
        String name = "fieldValue";
        String member = "memberId" + memberId;
        name = name + fieldId + member;
                            

%>
    <tr align="right">
       <td><input type="hidden" name="fieldIdMemberIds" value="<%=name %>"
/></td>
       <html:errors property="<%=name%>" />
       <td><%=field.getFieldName()%> </td>
       <%
           Collection colFieldValues =
FieldValuesHandler.getFieldValues(fieldId);
           Iterator iterFieldValues = colFieldValues.iterator();
           while (iterFieldValues.hasNext()) {
                    FieldValues fieldValue = (FieldValues)
iterFieldValues.next();
            
        %>

        <td><input type="radio" name="<%=name%>" value="<%=fieldValueDflt%>"
<%if (fieldValueAnswer.equals(fieldValueDflt)) {%>checked <%}%>
/><%=fieldValueDflt%></td>
        <%
             }
         %>

Thanx in advance,
Vijay

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to