PDA

View Full Version : onload possible?



simcityfreak4
14 Oct 2007, 4:45 PM
I found the script in one of the demos here: http://extjs.com/deploy/ext/examples/dialog/msg-box.html

Is there a way to make it so that when the page loads the message pops up? I got it so that works on my own server and I thought I could use onload in the body tag, but im not sure what to put in it.

Thanks for the help!

jay@moduscreate.com
14 Oct 2007, 4:56 PM
it's better off to use Ext.onReady(fn(){}); than on the onload event.

simcityfreak4
14 Oct 2007, 6:40 PM
How would I do that? I just found Ext and don't know much yet.

Animal
14 Oct 2007, 10:46 PM
http://extjs.com/deploy/dev/docs/?class=Ext&member=onReady

If that doesn't help, then it's not Ext you're having a problem with.

simcityfreak4
15 Oct 2007, 12:04 PM
Is there a way to do that in v1.1? I was looing through the documentation thing and didn't see anything called that for v1.1.

TiVoShane
15 Oct 2007, 12:30 PM
You should use Ext.onReady to initialize all your variables/widgets so this would be a good place to make a dialog pop up.

In your page just enter some script like this



<script>
Ext.onReady(Ext.Msg.show({title:'Hello',msg:'This is a message',
buttons:Ext.Msg.YESNO,
fn:javascriptFunctionToCallWithResponse}));

function javascriptFunctionToCallWithResponse(btn)
{
if (btn == 'yes')
{
alert('you pressed YES! Why do I care? hmmm......');
}
}

</script>


a Popup should appear when the page loads because Ext will be ready shortly after the page loads.

jay@moduscreate.com
15 Oct 2007, 1:59 PM
Is there a way to do that in v1.1? I was looing through the documentation thing and didn't see anything called that for v1.1.

it's all over the place

simcityfreak4
15 Oct 2007, 2:08 PM
Thanks, thats what I needed!

moleouf
18 Jan 2008, 10:15 AM
I know this can be an annoying question to a trained person but can you please give me an example of an onload message box prompt with two text boxes to fill.

Regards,

P.S : This is what i want to show when the page loads :

Ext.onReady(function(){

Ext.MessageBox.prompt('Name', 'Please enter your name:');

});

The thing is I want two text boxes in the dialog.