1. #11
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,120
    Vote Rating
    453
    Answers
    3160
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      1  

    Default


    Try this:

    Code:
        submitContactForm: function(btn)    {
            var form = btn.up('formpanel');
            console.log(form);
        }
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  2. #12
    Sencha User
    Join Date
    Oct 2012
    Location
    Lahore, Pakistan
    Posts
    5
    Vote Rating
    0
    sencha_mir is on a distinguished road

      0  

    Default


    Ok but what is wrong with the code written by me (in video it is working).

  3. #13
    Sencha User
    Join Date
    Oct 2012
    Location
    Lahore, Pakistan
    Posts
    5
    Vote Rating
    0
    sencha_mir is on a distinguished road

      0  

    Default


    Thanks although you have solved my problem but i am still curious why code shown in the video is not working.

  4. #14
    Sencha User
    Join Date
    Nov 2012
    Posts
    2
    Vote Rating
    0
    johnnyN is on a distinguished road

      0  

    Default same question, why doesn't code work?

    same question, why doesn't code work?


    I changed to the new way of doing refs

    Code:
    refs: {
        contactForm: '#contactForm'
    }
    and still get the error.

    after looking around, I read that you have to place the refs inside a config
    so i changed my code to

    Code:
    config: {
        refs: {
            loginForm: '#loginForm'
           }
        },
    after that everything worked

  5. #15
    Sencha User
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    26
    Vote Rating
    0
    Ades is on a distinguished road

      0  

    Default Uncaught TypeError: Unexpected Token s

    Uncaught TypeError: Unexpected Token s


    hallo,

    i make the same example and also had the same problem.
    Thanks to you, now everything is ok, but i have a new problem.

    How looks your contact.php?

    I get the error message: "Uncaught TypeError: Unexpected Token s".
    Do someone know why? :-(

    is the Problem here: url:'contact.php'

    Do i have to write it different?

    thanks in advance

  6. #16
    Sencha User
    Join Date
    Nov 2012
    Posts
    2
    Vote Rating
    0
    johnnyN is on a distinguished road

      0  

    Default


    Hi Ades,
    does the error happen after you do something (an event) or on load?
    can you post your code?
    also code of contact.php ?

  7. #17
    Sencha User
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    26
    Vote Rating
    0
    Ades is on a distinguished road

      0  

    Default


    Hallo Jonny,

    thank you very much.

    Now it's ok, because wrote in the contact.php:

    <?php
    $username = $_POST["username"];
    $password = $_POST["password"];
    if('test' == $username || '123' == $password){
    $aRes = array('success' => true);
    }
    else{
    $aRes = array('success' => false);
    }

    echo json_encode($aRes);
    ?>


    and in the main class :


    submitkontaktForm:function(btn){
    var form=btn.up('formpanel');


    form.submit({
    url:'contact.php',

    success : function(form, res){
    console.log('right');
    alert('Sie sind angemeldet');
    },

    failure : function(form, res){

    console.log('false');
    alert('false Login');
    }
    })
    },


    i just used different class-names, like the example in the video.

    Everything is now ok, but i would like to say:

    if the Login is true, so give me a view. I have a new View, but i can't create the view.

    I wrote:
    success : function(form, res){
    //Ext.create is not working :-(
    Ext.create("Anmeldung.view.Hauptseite");
    console.log('right');
    alert('Sie sind angemeldet');
    },


    it is not working :-(

    Do someone now what can i do?

    Thanks

  8. #18
    Sencha User
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    26
    Vote Rating
    0
    Ades is on a distinguished road

      0  

    Default


    ok it's working :

    //------------------------------------------------------------------

    submitkontaktForm:function(btn){
    var form=btn.up('formpanel');

    //console.log(form);
    form.submit({
    url:'login.php',

    success : function(form, res){
    console.log('right');

    Ext.Viewport.setActiveItem(Ext.create('Login.view.Next'));


    alert('you are logged in');
    },

    failure : function(form, res){

    console.log('false');
    alert('falscher Login');
    }
    })
    },

    //-----------------------------------------------------------------