PDA

View Full Version : ProgressBar for BasicForm.Submit instead of Messagebox



Jackanory
8 Apr 2013, 2:58 PM
When I submit my form, the server will go through several long running, discrete steps before returning a page to the browser. Each step will be writing a status message to a database. Instead of displaying a static WaitMsg, I need to display that status message to my user. This sounds like a job for the ProgressBar, but the basic form is hooked up to the MessageBox. So...

Is there a way to override my form such that the ProgressBar is used instead of the MessageBox?

Oh, how I've searched the forums:o)

mitchellsimoens
10 Apr 2013, 6:34 AM
The form submit will only use messagebox if you tell it to. If you don't tell it to then you can handle displaying what you want.

Jackanory
10 Apr 2013, 8:01 AM
Thanks for the response; I've been lurking on these forums for a couple of years now, so I know you guys like to give 'almost' answers to encourage us to search further. So I've searched.

As far as I can see there is no way to tell the submit to use the MessageBox, that's just what it uses! At least, in version 3.4, which is still supported, and 3.2 which I am forced to use. I wrote an Ext.override for a FormLayout once, so I guess I'll have to puzzle out how to do that again for this situation, unless ...

I wonder if you'd be so kind as to tell me where/how one normally specifies that the submit uses a message box, so I'd have a clue how to tell it to use something else.

Regards,

Dave

mitchellsimoens
10 Apr 2013, 2:30 PM
Like I said, unless you tell it to, it won't use MessageBox or anything of the sort. Here is an example:


var form = new Ext.form.FormPanel({
renderTo : document.body,
url : 'data/form.php',
items : [
{
xtype : 'textfield',
fieldLabel : 'Foo',
name : 'foo',
value : 'bar'
},
{
xtype : 'button',
text : 'Submit',
handler : function () {
form.getForm().submit();
}
}
]
});

So you want to use a progress bar so in the button handler create a progress bar in a window or something and show it or use Ext.MessageBox's wait method.

Jackanory
10 Apr 2013, 4:29 PM
Oh, I was looking at it a different way; I was trying to configure the submit, but only seeing things like WaitMsg, etc. You're suggesting that I expand the handler function thusly?


handler : function () {
form.getForm().submit();
BuildProgressBar();
}

And that ProgressBar won't wait for the submit to return, it'll just fire off? I'll try that when I get back to work tomorrow, thanks.

Jackanory
22 Apr 2013, 1:24 PM
Perhaps 'tomorrow' was a little optimistic, but I did get back to it, and it worked exactly as stated. Thanks once again for the advice.

Dave