1. #1
    Sencha User
    Join Date
    Feb 2009
    Posts
    264
    Vote Rating
    0
    Stephan123 is on a distinguished road

      0  

    Default textfield value on blur

    textfield value on blur


    Hello !

    I have a simple form.
    In this form is a textfield for a zip.
    When the 'blur event' on this field an ajax request
    send the field value to the server.

    Code:
    xtype: 'textfield',
                            fieldLabel: 'PLZ *',
                            width: 50,
                            maxLength: 5,
                            minLength: 5,
                            allowBlank: false,
                            id: 'zip',
                            maskRe: /^[0-9]$/,
                            listeners: {
                                blur: function(field){
    
                                    if(!this.isValid()){
                                        showMsgBox('Bitte PLZ überprüfen !');
                                        return;
                                    }
    
                                    Ext.Ajax.request({
                                        url : '/admin/company/findregion/',
                                        method : 'POST',
                                        params : {
                                            plz : field.value
                                        },
                                        success : function(response, action) {
    
                                        },
                                        failure : function(response, options) {
    
                                        }
                                    });
    
                                }
                            }
    When i change the value of the textfield the old value is sending to the server.
    What is wrong ?

    Your sincerly

    Stephan

  2. #2
    Sencha User kavolorn's Avatar
    Join Date
    Jun 2010
    Location
    Russia, Yaroslavl
    Posts
    11
    Vote Rating
    0
    kavolorn is on a distinguished road

      0  

    Default


    Hi

    Try to use getValue() method. This works for me:

    HTML Code:
    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8"/>
            <title>TextField value on blur</title>
            <link rel="stylesheet" type="text/css" href="http://dev.sencha.com/deploy/ext-3.4.0/resources/css/ext-all.css" />
            <script type="text/javascript" src="http://dev.sencha.com/deploy/ext-3.4.0/adapter/ext/ext-base-debug.js"></script>
            <script type="text/javascript" src="http://dev.sencha.com/deploy/ext-3.4.0/ext-all-debug.js"></script>
            <script type="application/javascript">
                Ext.onReady(function() {
                    new Ext.Viewport({
                        layout   : 'border',
                        renderTo : Ext.getBody(),
                        items    : [{
                            region : 'center',
                            layout : 'form',
                            items  : [{
                                xtype       : 'textfield',
                                fieldLabel  : 'PLZ *',
                                width       : 50,
                                maxLength   : 5,
                                minLength   : 5,
                                allowBlank  : false,
                                id          : 'zip',
                                maskRe      : /^[0-9]$/,
                                listeners   : {
                                    blur : function(field) {
                                        if (!field.isValid()) {
                                            alert('Bitte PLZ überprüfen !');
                                            return;
                                        }
                                        Ext.Ajax.request({
                                            url     : '/admin/company/findregion/',
                                            method  : 'POST',
                                            params  : {
                                                plz : field.getValue()
                                            },
                                            success : function(response, action) {
    
                                            },
                                            failure : function(response, options) {
    
                                            }
                                        });
                                    }
                                }
                            }]
                        }]
                    });
                });
            </script>
        </head>
        <body></body>
    </html>

Thread Participants: 1

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