Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8456729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:37:19+00:00 2026-06-10T12:37:19+00:00

Note: I’m a total ignoramus regarding javascript. I’ve broken my ExtJS 4.1 MVC app

  • 0

Note: I’m a total ignoramus regarding javascript.

I’ve broken my ExtJS 4.1 MVC app out into several controllers like:

/app/controller/Auth
    |          |Quiz
    |          |Result
    |          |Blah...
    |model/...

I want to respond to an “event”, not a DOM Event, rather a Ext.form.action.Submit.success event by calling functions in both my Auth and Quiz controllers. The summarized code for the first part is here:

// File: app/controller/Auth.js
attemptLogin : function() {
    var form = Ext.ComponentQuery.query('#loginpanel')[0].form;
    if (form.isValid()) {
        form.submit({
        success : function(form, action) {
            // THIS IS THE FUNCTION FROM THE CURRENT CONTROLLER
            Assessor.controller.Auth.prototype.finishLogin();
            // THIS IS THE FUNCTION FROM THE OTHER CONTROLLER
            Assessor.controller.Quiz.prototype.setupAssessment();
        },

This works but feels wrong. Is there a proper way to do this? It seems like I should fire a unique event that is listened to by both controllers, but I can’t understand how to do that with Ext.Event. Any guidance?

Thanks! I’m really grateful for all the great ideas and advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:37:20+00:00Added an answer on June 10, 2026 at 12:37 pm

    It makes sense to me to fire a custom event from the form and simply listen to it in both your controllers, like what you said here:

    It seems like I should fire a unique event that is listened to by both
    controllers

    // File: app/controller/Auth.js
    attemptLogin : function() {
        var form = Ext.ComponentQuery.down('#loginpanel').form;
        if (form.isValid()) {
            form.submit({
            success : function(form, action) {
                // fire the event from the form panel
                form.owner.fireEvent('loginsuccess', form.owner);
            },
    

    Then in each of your controllers you can listen to it with Controller#control, like this:

    Ext.define('YourApp.controller.Auth', {
        extend: 'Ext.app.Controller',
    
        init: function() {
            var me = this; 
    
            me.control({
    
                '#loginpanel': {
    
                    loginsuccess: me.someHandler
    
                }
            });
        },
    
        someHandler: function(form) {
            //whatever needs to be done
            console.log(form);
        }
    }
    

    And then add the same thing to your Quiz controller:

    Ext.define('YourApp.controller.Quiz', {
        extend: 'Ext.app.Controller',
    
        init: function() {
            var me = this; 
    
            me.control({
    
                '#loginpanel': {
    
                    loginsuccess: me.someOtherHandler
    
                }
            });
        },
    
        someOtherHandler: function(form) {
            //whatever needs to be done
            console.log(form);
        }
    }
    

    I’ve used this approach successfully in 4.1.0 and 4.1.1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

NOTE: I have read Routing From the Inside Out AND the Engine Yard blog
NOTE: This question is only loosely related to tinyxml, however including details like that
Note: purely out of curiosity and not for any actual use case. I'm wondering
Note: This was posted when I was starting out C#. With 2014 knowledge, I
Note that I am not asking which to choose (MVC or MVP), but rather
Note: This might seem like a Super User question at first, but please read
Note, this is not a duplicate of .prop() vs .attr() ; that question refers
(Note: This is not a question about what is the best way with code
Note: I am not asking how to use Google Code's SVN repo as a
note: i only want to move 1 shape at a time Circle.prototype.create = function(){

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.