1. #1
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    61
    Vote Rating
    0
    nik600 is on a distinguished road

      0  

    Default Unanswered: ext3 -> ext4 = myform.getForm().getEl is not a function

    Unanswered: ext3 -> ext4 = myform.getForm().getEl is not a function


    Dear alli'm trying to send the fields of a Ext.form.Panel into an AJAX request.This is the code of my form:

    PHP Code:
    var myform = new Ext.FormPanel({        
    frame:true,        
    autoScroll:true,        
    closable :true,        
    title'My Form Title',        
    defaultType'label',        
    items: [{            
    text'Type your name',            
    xtype:'textfield'         }]    
    }); 
    and this is the piece of javascript that i call when i want to send the form data to server:


    PHP Code:
     Ext.Ajax.request({            
    url 'Save.php',            
    method 'POST',            
    form myform.getForm().getEl().dom,            
    success : function(resultrequest) {alert('ok');},
    failure : function(resultrequest) {alert('ok');}
    }); 
    The problem is that the getEl() method seems to be unavailable and i get this error:

    Code:
    myform.getForm().getEl is not a function
    This code was working with extjs 3.x, and is not working with 4.x, can you help me to understand where is the problem?

    Thanks

  2. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,074
    Answers
    111
    Vote Rating
    94
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    I havent looked into your code completely but one error could be that in form, just use myform.getForm(). Take a look at this example and you should be able to find any differences between your version and ExtJS 4.

    http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.Basic

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    61
    Vote Rating
    0
    nik600 is on a distinguished road

      0  

    Default


    Thanks for your reply but if i use:

    PHP Code:
     Ext.Ajax.request({            
    url 'Save.php',            
    method 'POST',            
    form myform.getForm(),            
    success : function(resultrequest) {alert('ok');},
    failure : function(resultrequest) {alert('ok');}
    }); 
    i get a different error:

    Code:
    form.getAttribute is not a function

  4. #4
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,074
    Answers
    111
    Vote Rating
    94
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    why dont you try the submit method of the Basic Form:

    http://docs.sencha.com/ext-js/4-0/#!...-method-submit

  5. #5
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    61
    Vote Rating
    0
    nik600 is on a distinguished road

      0  

    Default


    Because i have some code that handles some custom controls on all my forms and then submit it using an Ext.Ajax.request request.

    i've seen that the Ext.Ajax.request method still support the form parameter, so i need to understand how to use it and where is the difference between the ext3 and ext4.

    If i have no chances to reuse it, i'll change my code.

    Thanks

  6. #6
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    61
    Vote Rating
    0
    nik600 is on a distinguished road

      0  

    Default


    another problem is that not all my requests gives JSON response as the submit of the form creates a file-download on server-side.

    in some situation i change the target of the form to open a _BLANK page.

    Basically, i need to access to the getEl() method and then getEl().dom object, is it possible using extjs4 ?

    Thanks

  7. #7
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,074
    Answers
    111
    Vote Rating
    94
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    There is a getEl() member for the Form:

    http://docs.sencha.com/ext-js/4-0/#!...l-method-getEl

    however, the comment there points out that it will only return a valid element if the component is rendered. may be that is what was causing the error...

  8. #8
    Sencha Premium Member
    Join Date
    Nov 2008
    Posts
    61
    Vote Rating
    0
    nik600 is on a distinguished road

      0  

    Default


    Yes but it returns the html div that contains the FormPanel, i need the dom form element.

  9. #9
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,074
    Answers
    111
    Vote Rating
    94
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

  10. #10
    Sencha - Community Support Team hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,962
    Answers
    9
    Vote Rating
    10
    hendricd will become famous soon enough hendricd will become famous soon enough

      0  

    Default


    @nik600 --

    Ext 4 does not render a <form> element any more. (So that unrendered tabPanels my still participate in larger Form layouts, etc)

    For a FormPanel configured with standardSubmit: true, a form element is created dynamically when the submit method is called.

    Hope this clarifies the behaviour.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


Thread Participants: 2