Hi, I want to modify all Ext.Button to disable it when I press it, and when the handler finish, enable it.
The problem is that I've a lot of forms in the app, and I want to do it as something general, I try to do it with this code, but doesn't run
Code:
<div id="prueba"></div>
<script type="text/javascript">
Ext.onReady(function() {
Ext.override(Ext.Button,{
handler: function(btn) {
btn.disable();
console.info(btn);
}
});
var form = new Ext.form.FormPanel({
id: 'form',
buttons: [{
text: 'Accpet',
handler: function(a) {
$.post('prueba.php',{texto: 'text'}, function() {
console.info('Post finish.');
});
}
}]
});
form.render($('#prueba').get(0));
});
</script>
I see te button "Accpet" and now, I want to only disable the button and shows it by console.info, but when I press it, it does the post action defined in the form button handler.
Does anyone know why this is happening?
Thanks