Friday, December 21, 2012

Re: client-side validation with request factory

thanx, is there a list somewhere about (un)supported annotations ? i just figured out @size(min=, max=)  doesnt seem to work either, if at the end u have to mix to much custom-validation code with validation-api, i'd better not using it


thanx


On Thu, Dec 20, 2012 at 6:29 PM, ashwin.desikan@gmail.com <ashwin.desikan@gmail.com> wrote:
not all validations are supported. email is one among them, but you can achieve email validation using regex pattern

example:

static String ATOM = "[a-z0-9!#$%&'*+/=?^_`{|}~-]";
static String DOMAIN = "(" + ATOM + "+(\\." + ATOM + "+)*";
static String IP_DOMAIN = "\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\]";

@Pattern(regexp="^" + ATOM + "+(\\." + ATOM + "+)*@"
+ DOMAIN
+ "|"
+ IP_DOMAIN
+ ")$",
flags={Pattern.Flag.CASE_INSENSITIVE},
message="Please provide a valid eMail id")
@NotEmpty(message="Email is required")
abstract String getEmail();
abstract void setEmail(String email);

~Ashwin


On Thu, Dec 20, 2012 at 6:39 PM, kim young ill <khiemu@googlemail.com> wrote:
well, it tooks me a while to realize that @Email doesnt work at all, allways give me Violation


On Thu, Dec 20, 2012 at 11:37 AM, kim young ill <khiemu@googlemail.com> wrote:
thanx,
that works




On Thu, Dec 20, 2012 at 4:28 AM, ashwin.desikan@gmail.com <ashwin.desikan@gmail.com> wrote:
all the validations you put on the pojo's can be applied on the proxies. 

example:

let's say you have a pojo named guest

Guest {

@NotNull
String name;

}

now the same validation you will have to apply on your proxy as well

GuestProxy {

@NotNull
String getName();
SetName(String name);

}

As defined in the sample, create a validatorFactory. Instead of assigning the pojo.class use the pojoProxy.class to @GwtValidation Annotation.

regards
Ashwin


On Wed, Dec 19, 2012 at 1:55 PM, kim young ill <khiemu@googlemail.com> wrote:
Hi there,
how can i use client-side validation with rf ?
in the sample project of gwt-2.5, the client-pojos are annotated directly, but what about proxies ?

thanx 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment