You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by rakeshp <ra...@gmail.com> on 2009/05/29 10:12:12 UTC
Re: Stuts2 field validation problems
invalid.fieldvalue.yourpropertyname
This should override the default message.
Robert Stenholt Mygind wrote:
>
> Hi All
>
> I have some problems with field validation in Struts2, I am not the
> most experienced in Struts2.
>
> </SNIP>
> I have a form looking something like this:
> <s:form action="calcprices" method="post">
> <s:textfield name="subscriptions" label="Some tekst:"/>
> ..
> <s:submit name="submit" value="Calc"></s:submit>
> </s:form>
> </SNIP>
>
> In my acrion class I have something looking like:
> <SNIP>
> @RequiredFieldValidator(message = "Some error text", shortCircuit=true)
> public Integer getSubscriptions() {
> return subscriptions;
> }
> </SNIP>
>
> The field is a Integer field, so if I insted write "test" in it I get
> the following HTML:
> <SNIP>
> <div id="wwerr_calcprices_subscriptions" class="wwerr">
> <div errorFor="calcprices_subscriptions" class="errorMessage">
> Invalid field value for field "subscriptions".
> </div>
> <div errorFor="calcprices_subscriptions" class="errorMessage">
> Some error text
> </div>
> </div>
> </SNIP>
>
> The first is the default from "invalid.fieldvalue" and the second is
> the one I made.. I only wish to have the secound, in some kind of
> override. I also tried to use
> @ConversionErrorFieldValidator(message = "Default message")
> @RequiredFieldValidator(message = "Some error text", shortCircuit=true)
>
> and that is the same, get both errors..
>
> I don't have any idea what to do, maybe I have misunderstood the
> Struts2 validation completely. Hope you can help.
> --
> Very Best regards
> Robert
> http://www.innovated.dk www.innovated.dk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Stuts2-field-validation-problems-tp21401218p23776022.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org