1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    49
    Vote Rating
    0
    Digital God is on a distinguished road

      0  

    Default ExtJs + Jquery form submit

    ExtJs + Jquery form submit


    I'm using extjs with jquery and it works fine. But when i submit forms - i get a little problem. The problem is with form serialize function.

    if i've text value "just a simple text", after form submit i get "just+a+simple+text". I don't where to post this problem - here or in jquery forums

    i get inside jquery and ext-base code and i found this

    jquery serialize function, at the end.
    Code:
       return s.join("&").replace(/%20/g, "+");
    how can i submit form without this '+' and using jquery adapter?

    P.S.
    i use form.getValues() and Ext.Ajax.request to submit form

  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


    how ar eyou seting the textfield's value? Can you see the +'s in the DOM element (via firebug inspection) itself?

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    49
    Vote Rating
    0
    Digital God is on a distinguished road

      0  

    Default


    I mean not the field value. It is in post request.

    For example - textfield named News title. Field settings - name = title, xtype = textfield, allowblank = false. nothing more. Field value is "Just simple text"

    In window i've button with handler. I use
    Code:
    var data = formpanel.getForm().getValues()
    to get form values.

    And if i debug data variable - i'll have title = "Just+simple+text".

    This '+' appears only with jquery adapter.
    You can find it at the end of jquery param function
    Code:
    return s.join("&").replace(/%20/g, "+");
    i don't know why they use this code. maybe it is right. but how can i submit my form without this '+'?

  4. #4
    Sencha User
    Join Date
    Feb 2011
    Posts
    2
    Vote Rating
    0
    atovstonog is on a distinguished road

      0  

    Default Just use native ExtJS form serializer

    Just use native ExtJS form serializer


    Error happened because of incorrect work of jQuery adapter and his realization of method "Ext.lib.Ajax.serializeForm".
    So you need to change implementation of this method to native ExtJS and keep next inclusions order:
    Code:
    1. jquery.js
    2. ext-jquery-adapter.js
    3. ext-all.js
    4. <script type="text/javascript">
                Ext.lib.Ajax.serializeForm = function(form) {
                    var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements, 
                        hasSubmit = false, 
                        encoder = encodeURIComponent, 
                        name, 
                        data = '', 
                        type, 
                        hasValue;
    
    
                    Ext.each(fElements, function(element){
                        name = element.name;
                        type = element.type;
    
    
                        if (!element.disabled && name) {
                            if (/select-(one|multiple)/i.test(type)) {
                                Ext.each(element.options, function(opt){
                                    if (opt.selected) {
                                        hasValue = opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttributeNode('value').specified;
                                        data += String.format("{0}={1}&", encoder(name), encoder(hasValue ? opt.value : opt.text));
                                    }
                                });
                            } else if (!(/file|undefined|reset|button/i.test(type))) {
                                if (!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)) {
                                    data += encoder(name) + '=' + encoder(element.value) + '&';
                                    hasSubmit = /submit/i.test(type);
                                }
                            }
                        }
                    });
                    return data.substr(0, data.length - 1);
                };
    </script>

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