Results 1 to 10 of 31

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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Mar 2008
    Location
    San Jose, CA
    Posts
    124

    Default [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 User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    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 User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    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 User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    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

    Default 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 User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    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 User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    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 User
    Join Date
    Oct 2017
    Location
    Ohio
    Posts
    6

    Default

    How can I tell if it is a bug or just me messing things up? I'm relatively new and I simply get confused.

  9. #9
    Sencha User
    Join Date
    Oct 2017
    Location
    Ohio
    Posts
    6

    Default

    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.

    Has anyone had luck with this? Driving me mad.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •