View Full Version : MessageBox continuous loop

19 Jul 2013, 6:18 AM
In my controller for a project I have control retrieving and saving user records via a form. On the form, when the 'save' button is clicked it will call this:

updateUser: function(button) {
if(this.checkRecords()) {
title: ' Error',
msg: 'Username already exists, " +
'Do you wish to proceed?',
buttons: Ext.Msg.YESNOCANCEL,
icon: Ext.Msg.Question,
fn: function(btn) {
if(btn == 'yes') {

if(btn == 'no') {
} else if(!button.up('window').down('form').isDisabled()) {
this.updateHandler(button, 'data/users.json', this.getUsersStore());

checkRecords: function() {
var name = $c('name').getValue();
var store = Ext.StoreManager.lookup('Users');
var index = store.find('name', name);
var record = store.getAt(index);
if(!Ext.isEmpty(record)) {
return true;
} else {
return false;

If the user hits no, the name field will be erased and they must select a new username. If you hit yes it closes the message box but then it's just in a continuous loop with the message box. How can I make it so as soon the user hits yes I can save the data?

19 Jul 2013, 6:52 AM
nvm got it, mods feel free to delete this post.