jsf 2 - Writing Javascript for client-side class-level validation using primeface -
i have class-level constraint on class below:
@notequalaccounts public class fundtransfervo extends signablevo implements serializable{ private string fromaccount; private string toaccount; //setter,getter }
and custom constraint code is:
@target({elementtype.type}) @retention(retentionpolicy.runtime) @constraint(validatedby = notequalaccountsvalidator.class) @clientconstraint(resolvedby=clientnotequalaccountsvalidator.class) public @interface notequalaccounts { string message() default "{org.javaee7.validation.custom.constraint.notequalaccounts}"; class<?>[] groups() default {}; class<? extends payload>[] payload() default {}; }
i want have javascript client-side validation of class using primeface, i've written code below, doesn't work
primefaces.validator['notequalaccounts'] = { message_id: '...', validate: function(element, fundtransfercontroller) { if(fundtransfercontroller.fundtransfervo.gettoaccount()===fundtransfercontroller.fundtransfervo.getfromaccount()) { msg = ''; throw msg; } } };
fundtransfercontroller controller bean(fundtransfervo) used in it.
is there way validate class-level constraints on client-side using primeface?
Comments
Post a Comment