PDA

View Full Version : newbies please help implement Textbox field



lateruel23
21 Nov 2011, 3:07 PM
if I need more detailed validation of a Textbox field, how do I implement this? What should i do to work it out?

Thanks.

micgala
22 Nov 2011, 12:50 AM
Hi.

You may try setRegexText, if just using regex is fine for you.
You can also create a Validator instance, and set if witht eh setValidator method.

chalu
22 Nov 2011, 7:47 AM
What exactly do U want to validate, as others have said U can use it's API to set regex or a validator for it.



TextField<String> text = new TextField<String>();
text.setFieldLabel("Name");
text.setEmptyText("Enter your full name");

// basic validation
text.setAllowBlank(false);
text.setMinLength(4);
text.setMaxLength(20);

// if U want more
text.setRegex("the regex pattern string");
text.setsetValidator(new Validator(){
public String validate ( Field<?> field, String value ){

}
});


Have a look at the API Docs here : http://www.sencha.com/gxtdocs/#com.extjs.gxt.ui.client.widget.form.TextField

lateruel23
22 Nov 2011, 10:13 PM
thanks for the answer. i'll let you know the development of what i'm doing.

gonna make it work.

Thanks.