I am using the GWT application widget library and want to开发者_如何学Python validate the controls in the button click event.The code I am writing
GQuery input = $(e).filter("input[type='password']").widgets();
but its is giving me compile time error.Please tell me or refer me any tutorial for validating the widget library controls.
the widgets() method returns a list of widget and not a GQuery object
List<Widget> myPasswordInputs = $(e).filter("input[type='password']").widgets();
If you are only one input of type password you can maybe use directly widget() method :
PasswordTextBox myPasswordInput = $(e).filter("input[type='password']").widget();
Question: are you sure of your '$(e).filter("input[type='password']")' ? Because it means : "Create a GQuery object containing my element 'e' and keep it only if 'e' is an input of type password"
If you want to retrieve all password inputs present within an element e, you have to use :
List<Widget> myPasswordInputs = $("input[type='password']",e).widgets();
Julien
Try:
GQuery input = GQuery.$(e).filter("input[type='password']").widgets();
You need to do a static import to use $
directly:
import static com.google.gwt.query.client.GQuery.*;
import static com.google.gwt.query.client.css.CSS.*;
精彩评论