[Seasar-user:10936] Re: dynamic validator

=?GB2312?B?wO7A1g==?= [E-MAIL ADDRESS DELETED]
2007年 10月 10日 (水) 15:16:37 JST


Can't get params..

When i use "params.get("form:date") != null", it throws params is null.

Is there anything else i should do?

If i define <form id="TestForm" >, i should write "params.get("TestForm:date")
!= null)" ?

Thanks Very Much!


2007/10/10, Yasuo Higa <[E-MAIL ADDRESS DELETED]>:
>
> Hi, all.
> >
> > <input type="text" id="number" />
> >
> > <input type="submit" value="ウミユJ" class="button" id="doApprovalConfirm"
> /
> >
> >
> > public Validator getDateValidator() {
> > ValidatorChain chain = new ValidatorChain();
> > TRequiredValidator validator = new TRequiredValidator();
> > if (number != 0) { chain.add(validator); }
> > return chain;
> > }
> >
> > I can't get the input value of number . Why?
>
> You should get the input value via request parameter,
> because Teeda sets property value after validation phase.
>
> Please define param property in your page class as follows:
>
> private Map params;
>
> public Map getParams() {
> return params;
> }
>
> public void setParam(Map param) {
> this.param = param;
> }
>
> So, you can check the input value as follows:
>
> public Validator getDateValidator() {
>
> ValidatorChain chain = new ValidatorChain();
>
> TRequiredValidator validator = new TRequiredValidator();
>
> if (param.get("form:date") != null) {
>
>    chain.add(validator);
>
> }
>
> return chain;
>
> }
>
> "form" means id element of form tag.
>
> --
> Yasuo Higa
> [E-MAIL ADDRESS DELETED]
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
URL: http://ml.seasar.org/archives/seasar-user/attachments/20071010/a35d51f7/attachment.html 


Seasar-user メーリングリストの案内