Amandeep Singh
Amandeep Singh

Reputation: 3840

Using GQuery in GWT widgets

I am using the GWT application widget library and want to 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.

Upvotes: 0

Views: 775

Answers (2)

jdramaix
jdramaix

Reputation: 1104

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

Upvotes: 1

Peter Knego
Peter Knego

Reputation: 80340

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.*;

Upvotes: 0

Related Questions