1. #1
    Sencha Premium Member
    Join Date
    Mar 2008
    Location
    San Jose, CA
    Posts
    124
    Vote Rating
    0
    surfyogi is on a distinguished road

      0  

    Default [OPEN][2.*/3.0] Standard submit of form does not set form action in dom

    [OPEN][2.*/3.0] Standard submit of form does not set form action in dom


    Looks like a bug, where I have to set the action attribute of the form in dom before submitting or there will be no form action assigned and the form post will fail:

    Code:
    items: [{
        xtype:"button",
        text: 'Find',
        minWidth: 100,
        style:'padding:0px 0px 0px 140px;margin:0px 10px 30px 10px',
        handler: function(){ 
                                        
            air_rt_form.getForm().el.dom.action=air_rt_form.getForm().url;
            air_rt_form.getForm().submit(); 
        }
    
                                       }]     // end inside items array
    does the same in FF and IE, and I'm using the ext-base.js; easy work around but this should probably get fixed so other's don't run into the same thing.

    thx! (Ext is the BEST man)

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

      0  

    Default


    To expand, where the BasicForm config standardSubmit is used to request a browser submission of the form as opposed to an Ajax submission, the url config should be stamped into the generated DOM form element as the action attribute value.

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

      0  

    Default


    I suggest this fix (to which I, herinafter known as the herinafter do perperually grant rights, notwithstanding... (continued page 94)):

    Code:
        initEl : function(el){
            this.el = Ext.get(el);
            this.id = this.el.id || Ext.id();
            if(this.standardSubmit){
                this.el.dom.action = this.url;
            } else {
                this.el.on('submit', this.onSubmit, this);
            }
            this.el.addClass('x-form');
        },

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

      0  

    Default


    Although this thread might provide a different option if <form> as body is implemented: http://extjs.com/forum/showthread.php?t=28125

  5. #5
    Ext User
    Join Date
    Apr 2008
    Location
    Switzerland, St-Blaise (NE)
    Posts
    7
    Vote Rating
    0
    4him is on a distinguished road

      0  

    Default Other fix proposition

    Other fix proposition


    How about this other fix in 'FormPanel' (Form.js) in the 'onRender' method:

    Code:
    var o = {
      tag: 'form',
      action : this.url, // <-- Fix here 
      method : this.method || 'POST',
      id : this.formId || Ext.id()
    };
    It works for my use case...

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

      0  

    Default


    Yes that will work for you, but the fix must really go into BasicForm because that is what gets submitted, and it can be used independently of FormPanel.

  7. #7
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    89
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Quote Originally Posted by Animal View Post
    Yes that will work for you, but the fix must really go into BasicForm because that is what gets submitted, and it can be used independently of FormPanel.
    I don't agree, BasicForm never creates a FORM element, so why should it set the action attribute?

    Also, AJAX submit uses the FORM action attribute if the url of BasicForm isn't set.

    ps. Shouldn't your code be:
    Code:
    this.el.dom.action = this.url;

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

      0  

    Default


    No, it doesn't create the form, it wraps a form. But the point remains that it can be used without a FormPanel, so in this case, it must still honour the url config by setting the action attribute if standardSubmit is specified.

    (I know, if they're using a BasicForm to wrap an existing DOM form, they're likely to have set action, but BasicForm has to be sure)

    (Yes, of course... I missed the "dom" bit. I'll edit)

  9. #9
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    5
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    Any plans to implement a patch for this in future version?

    For now, one possible solution has been added to the FAQ:
    http://extjs.com/learn/Ext_FAQ_Forms#Standard_Submit

    Suggest to patch the source, or supplement the Docs to alert people what needs to be done.

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

      0  

    Default


    Shameless BUMP!

    When is this ancient bug with a very simple fix going to be fixed? The bug was reported in 2.1 and got sent out in 2.2!

    People are still being bitten by this when using standardSubmit: true