1. #1
    Sencha User
    Join Date
    Dec 2008
    Posts
    8
    Vote Rating
    0
    tgreg is on a distinguished road

      0  

    Exclamation strange behavior of Ext.form.BasicForm

    strange behavior of Ext.form.BasicForm


    Hi,
    this may seem to be silly topic for you, but I spent 20 hours on this problem and I couldn't find solution.
    I was looking for similar problem in forum, api and other documentation/examples.


    I wanted to create a hidden (not shown) form, that would be submited in some special cases.
    That's why I've created a class:
    Code:
      LogoutForm = function(){
        this.init();
      };
      LogoutForm.prototype = {
        form      : Ext.emptyFn,
        init      : function() {
            this.form = new Ext.form.BasicForm({
                url             : 'index.php',
                defaultType     : 'hidden',
                items           : [{
                    xtype       : 'hidden',
                    name        : 'error_msg',
                    value       : 'Session expired, please log in again.',
                    allowBlank  : true
                },{
                    xtype       : 'hidden',
                    name        : 'sid',
                    value       : 'sid_over_here',
                    allowBlank  : true
                }],
                standardSubmit  : true
            });
        },
        doTimeout : function() {
            Ext.get(document.body).mask('logging out...');
            this.form.getForm().getEl().dom.action = MAIN_INDEX_PAGE + 'index.php';
            this.form.getForm().submit({
              //params: { error_msg: 'Session expired, log in again please.'},
              method: 'POST'
            });
        },
        doLogout : function(sid) {
            this.form.getForm().getEl().dom.action = MAIN_INDEX_PAGE + 'logout.php';
            this.form.getForm().submit({
              //params: { error_msg: 'Logged out successfuly.', sid : sid},
              method: 'POST'
            });
        }
      };
    MAIN_INDEX_PAGE is set to contain the web page address.

    So, somewhere at my page, in some special cases, I want to submit this form.
    In these cases I call a function with such code:

    Code:
    var form = new LogoutForm();
    form.doTimeout();
    The thing is, form is not submitted and some errors appears.
    I can't get the reason.
    I get following error on FFX's console:
    Code:
    this.el is null
    initComponent()(Object url=index.php defaultType=hidden items=[2])ext-all.js (wiersz 135)
    initComponent()(Object url=index.php defaultType=hidden items=[2], undefined)ext-all.js (wiersz 135)
    init()()jsonErro...Reader.js (wiersz 28)
    LogoutForm()()jsonErro...Reader.js (wiersz 9)
    logoutAction()()main.js....cdbf1db76 (wiersz 3)
    EventManager()()ext-all.js (wiersz 12)
    EventManager()()ext-all.js (wiersz 12)
    TextItem()(Object browserEvent=Event mouseout button=0 type=mouseout)ext-all.js (wiersz 113)
    MenuMgr()(Object browserEvent=Event mouseout button=0 type=mouseout)ext-all.js (wiersz 111)
    camelFn()()ext-all.js (wiersz 13)
    apply()()ext-base.js (wiersz 9)
    
    [IMG]chrome://firebug/content/blank.gif[/IMG]Ext.form.BasicForm=function(B,A){Ext.app...his}});Ext.BasicForm=Ext.form.BasicForm;
    Line 28 points to line with standardSubmit : true inside init() method of class.

    If I comment lines with:
    Code:
    this.form.getForm().getEl().dom.action = CRM_MAIN_INDEX_PAGE + 'index.php';
    problem does not disappear.

    What I do wrong?
    Please help!

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    are you treturning a json object like: {success:true} ?

    also, why change the dom's action property? Why not just set the url here:

    Code:
    this.form.getForm().submit({
              url : someNewUrl,
              //params: { error_msg: 'Session expired, log in again please.'},
              method: 'POST'
            });

  3. #3
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    btw, what version of Ext are you using?

    Also, i misspoke. When doing standard submits, the config object is ignored.

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

      0  

    Default


    BasicForm does not create any DOM structures. It manages an existing form, eg, the form element of a FormPanel.

    You have to configure it with el: myForm

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi