PDA

View Full Version : Check if button is already on page.



joefox
7 Sep 2010, 8:55 AM
I have a function that renders a div to a button.
How can i check to make sure the user didnt already create the button?

Right now, they can keep clicking it, and it will create a ton of buttons :(

Here is my code for creating the button

new Ext.Button({
text: 'Confirm Process',
handler: test_func
}).render(document.body,'delete_button_div');

joefox
7 Sep 2010, 9:04 AM
Nevermind got it, with just adding an id and check for id upon create.

var win_e = Ext.getCmp('conf_final_btn');
if(!win_e){
new Ext.Button({
id: 'conf_final_btn',
...
...
...
..