1. #1
    Ext User
    Join Date
    Apr 2007
    Posts
    189
    Vote Rating
    0
    captainm1uk is on a distinguished road

      0  

    Default E.fireFn.apply is not a function

    E.fireFn.apply is not a function


    Hi
    I have a message box set on the onReady state of a form - the prompt comes up ok but I get the above error in FF - can anyone help

    <script type='text/javascript'>
    Ext.onReady(
    Ext.MessageBox.show({
    title:'System Message',
    msg: 'Blah blah, blah',
    buttons: Ext.MessageBox.OK,
    fn: showResult,
    icon: Ext.MessageBox.QUESTION
    }))();

    function showResult (btn) {
    if (btn=='ok') {window.close();}
    }
    </script>

    Thanks

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Ext.onReady must be passed a function reference.

    What you are passing there, if you read your code, is the result from Ext.MessageBox.show

  3. #3
    Ext User
    Join Date
    Apr 2007
    Posts
    189
    Vote Rating
    0
    captainm1uk is on a distinguished road

      0  

    Default


    Yes - when the page loads, a prompt box comes up then they press ok and the window closes

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Yes, and the result from that call is passed into Ext.onReady which if you read its docs, expects to be passed a reference to a function which it executes when the DOM is ready.

    It attempts to make a call to whatever the return value of Ext.MessageBox.show() is!

  5. #5
    Ext User
    Join Date
    Apr 2007
    Posts
    189
    Vote Rating
    0
    captainm1uk is on a distinguished road

      0  

    Default


    Sorry you have lost me !!!

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    OK.

    Ext.onReady accepts a function as it's parameter.

    It will call this function when the DOM is ready.

    Clear so far?

  7. #7
    Ext User
    Join Date
    Apr 2007
    Posts
    189
    Vote Rating
    0
    captainm1uk is on a distinguished road

      0  

    Default


    I think so - isn't this is what it is doing already?? Ext.onReady(......

  8. #8
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    OK, you realize you need to pass a function object into Ext.onReady?

  9. #9
    Ext User
    Join Date
    Apr 2007
    Posts
    189
    Vote Rating
    0
    captainm1uk is on a distinguished road

      0  

    Default


    yes
    so i am back to square one - the function is being passed yet i still get the error message

    Am i missing something ?

  10. #10
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Stop running ahead.

    You are NOT passing a function.

    You are passing the return value from a call to Ext.MessageBox.show!

Thread Participants: 1