You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Alvarado, Juan (c)" <Ju...@NielsenMedia.com> on 2002/11/21 18:17:33 UTC

Help with custom validation please

I've written a simple custom validator that is working just fine. However,
when the validation returns back to the page to display the error message to
the user, all I get is the following:

???en_US.errors.ordersearch??? 
I know that key errors.ordersearch is in the ApplicationResources.properties
file for sure.

The rest of my configuration for this custom validator is as follows:

<validator name="namordersearch"
 
classname="com.nielsenmedia.nam.ui.validation.NAMCustomValidator"
               method="validateOrderSearch"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionErrors,
                       javax.servlet.http.HttpServletRequest,
                       javax.servlet.ServletContext"
                  msg="errors.ordersearch">
        </validator>

 <form name="searchByForm">
                        <field property="searchBy" depends="required">
                                <arg0 key="prompt.searchby"/>
                        </field>
                        <field property="searchTerm"
depends="namordersearch">
                                <arg0 key="prompt.search.term"/>
                        </field>
                </form>

All I have in my method at the present time is this:

public static boolean validateOrderSearch(Object bean,
	
ValidatorAction va,
	
Field field,
	
ActionErrors errors,
	
HttpServletRequest request,
	
ServletContext context){
	

		errors.add(field.getKey(),
StrutsValidatorUtil.getActionError(request, va, field));
		return false;

If anyone has run across this issue and has a possible solution, please let
me know.

Thanks in advance




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>