Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i am new to EXT-JS.
i have one textfeild and button in the form. By default the button is disable. When ever user enter any value to textbox then button will enable otherwise button will be disabled. please help if any one know how to handle with EXt-JS code.
Posted

1 solution

For Regular JavaScript, one would have the following:

An onkeyup even for the textbox (I happen to like key-up), adding an 'onchange' is also OK in case of a cut-and pasted
An ID for your button

In the handler for the onkeyup/onchange events, use DOM to enable/disable button based upon its content (such as via .length). Personally, I always test for content after trimming white-space from a copy of the string internal to be sure there's really an entry in the box.

A parallel example:
http://www.w3schools.com/jsref/prop_pushbutton_disabled.asp[^]

JavaScript
document.getElementById("theButtonID").disabled=false;
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900