You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ted Husted <te...@gmail.com> on 2006/01/15 14:58:42 UTC

Re: Help!! - Dynamic validator form not working.

One thing not shown here would be plugging in the validator via the
struts-config.

* http://struts.apache.org/struts-action/userGuide/building_view.html#validator

-- HTH, Ted.
http://www.husted.com/poe/


On 1/11/06, Maha Venkataraman <ma...@mit.edu> wrote:
> Hi,
>
> I am having some problems in  getting struts to
> validate my input form. It seems to completely ignore
> the validation and starts executing the action.
>
> Here are the relevant files. Any help regarding this
> is highly appreciated.
>
> Thanks in advance
>
> Maha
>
> struts-config.xml
> ------------------
>
>      <form-beans>
>        <!-- objectType form bean -->
>        <form-bean name="ObjectTypeForm"
>                         type="forms.ObjectTypeForm"
> dynamic="true">
>          <form-property name="objectType"
> type="java.lang.String"/>
>          <form-property name="description"
> type="java.lang.String"/>
>        </form-bean>
>
>      </form-beans>
>
> the action - mappings contains
>
>            <action  path="/ObjectType"
>                       type="actions.ObjectTypeAction"
>                    name="ObjectTypeForm"
>                    scope="request"
>                    validate="true"
>                    input="/objecttype.jsp"
>                    parameter="function">
>                <forward name="failure"
> path="/error.jsp" />
>                <forward name="success"
> path="/index.jsp" />
>                <forward name="goToAddStartPage"
> path="/objecttype.jsp" />
>            </action>
>
> The ObjectTypeAction class extends DispatchAction.
>
> validate.xml
> ------------
>
> <form-validation>
>      <formset>
>          <form name="ObjectTypeForm">
>              <field property="objectType"
> depends="required">
>                  <arg0 key="prompt.objecttype"/>
>              </field>
>          </form>
>      </formset>
> </form-validation>
>
> validation-rules.xml
> --------------------
>
> <form-validation>
>    <global>
>      <validator name="required"
>
> classname="org.apache.struts.validator.FieldChecks"
>               method="validateRequired"
>         methodParams="java.lang.Object,
>
> org.apache.commons.validator.ValidatorAction,
>
> org.apache.commons.validator.Field,
>
> org.apache.struts.action.ActionErrors,
>
> javax.servlet.http.HttpServletRequest"
>                  msg="errors.required">
>      </validator>
>    </global>
> </form-validation>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org