Expanding on what Geraldo already said you can have the following
Button saveBtn = new Button("Save")
saveBtn.addClickHandler( new ClickHandler() {
public void onClick(Event event) {
if(checkData()){
form.submit();
}else{
//no submit
}
}
}
});
public boolean checkData(){
if(nameEditBox.getText().trim().equals("")){
Window.alert("Name can not be blank");
return false;
}
if(phoneBox.getText().trim().equals("")){
Window.alert("Phone can not be blank");
return false;
}
return true;
}
You get the idea.... :).
On Sep 23, 3:27 am, Geraldo Lopes <[email protected]> wrote:
> mohan,
>
> At client you can put an event on button that advises the user to
> enter proper information.
>
> Button saveBtn = new Button("Save")
> saveBtn.addClickHandler( new ClickHandler() {
> public void onClick(Event event) {
> if (nameEditBox.getText().equals("")) {
> Window.alert("bla bla bla")
> return;
> }
> }
>
> });
>
> if the validation depends on the server you can use gwt rpc mechanism
> to achieve that
>
> http://code.google.com/intl/en/webtoolkit/doc/1.6/DevGuideServerCommu...
>
> Good Luck,
>
> Geraldo
>
> On 22 set, 06:49, mohan <[email protected]> wrote:
>
> > Hi,
> > I am very new to GWT. I have a form with Name,phone and email. I need
> > to validate the input. How can i do that? Kindly guide me.
> > Thanks in advance.
>
> > Cheers!!!
> > Mohan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---