1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    30
    Vote Rating
    0
    ivone_tarigan is on a distinguished road

      0  

    Exclamation Help ME..passing value into texfield

    Help ME..passing value into texfield


    hiii all i wanna pasing value from database into textfield in js..

    im using getCmp and set value into textfield..

    this is my code to get value from databse

    Code:
     Ext.Ajax.request
    ({
        url:purchase.core.purchase_requisition.controller+'/tes',
         params: 
         {
         'pr_number':result1,
        },
        callback: function(options, success, response)
         {
            var respon = response.responseText;
            console.log('response: '+respon);
             Ext.getCmp('pr_number').setValue(respon);
         }
     });

    and this is my form

    Code:
    initComponent: function()
        {        
            Ext.apply(this,{
            items: [{
                xtype:'fieldset',
                layout:'column',
                autoHeight:true,
    
                width: 1500,
                items:[{
                    
                    columnWidth:.300,
                    layout: 'form',
                    items: [
                    {
                        xtype:'textfield',
                        fieldLabel: 'PR Number',
                        anchor:'70%',
                        name: 'pr_number',
                        id: 'pr_number',
                        //value:pr_number,
                        readOnly:true
                    },


    im very confuse..why value doesnt display in my textfield..and when i compile ad given erorr..

    response: 00004
    Ext.getCmp("pr_number") is undefined
    [IMG]chrome://firebug/content/blank.gif[/IMG] Ext.getCmp('pr_number').setValue(respon);


    i hope you can help me...

    thanks _ivone_

  2. #2
    Sencha User
    Join Date
    Jul 2010
    Posts
    30
    Vote Rating
    0
    ivone_tarigan is on a distinguished road

      0  

    Default


    help me guyss....

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Are you sure your form has been created when you receive the value?

  4. #4
    Sencha User
    Join Date
    Jul 2010
    Posts
    30
    Vote Rating
    0
    ivone_tarigan is on a distinguished road

      0  

    Default


    yup..thats the point..

    im not sure..when i receive thats value..my form hasnot benn created..

    but..if receive thats value into other form and the value is displaying...im very confuse about it..

    this is my full code..

    this is my form :

    Code:
       purchase.core.purchase_requisition.form = Ext.extend(Ext.form.FormPanel,{
        constructor: function(config)
        {
                config = config||{};
                config.labelWidth = config.labelWidth || 120;
                config.frame = config.frame || true;
                config.autoHeight = config.autoHeight || true;
                config.title = config.title || 'Purchase Requisition Form';
                config.bodyStyle = config.bodyStyle || 'padding:1px 1px 1px';
                config.width = config.width || 365;
                config.defaults = {width: 200},
                config.border = config.border || false;
                
                purchase.core.purchase_requisition.form.superclass.constructor.call(this, config);
        },
            
        initComponent: function()
        {        
            Ext.apply(this,{
            items: [{
                xtype:'fieldset',
                layout:'column',
                autoHeight:true,
    
                width: 1500,
                items:[{
                    
                    columnWidth:.300,
                    layout: 'form',
                    items: [
                    {
                        xtype:'textfield',
                        fieldLabel: 'PR Number',
                        anchor:'70%',
                        name: 'pr_number',
                        id: 'pr_number',
                        //value:tes,
                        readOnly:true
                    },
                    
                    {
                        xtype:'textfield',
                        fieldLabel: 'Order for Delivery to',
                        anchor:'70%',
                        name: 'pr_order_for_delivery_to',
                        id: 'pr_order_for_delivery_to'
                    }, {
                        xtype:'textarea',
                        fieldLabel: 'Purpose Required',
                        anchor:'70%',
                        name: 'pr_purposed_required',
                        id: 'pr_purposed_required'
                        
                    }, {
                        xtype:'datefield',
                        fieldLabel: 'Date required',
                        name: 'pr_date_required',
                        id: 'pr_date_required',
                        anchor:'70%'
                    },{
                        xtype:'hidden',
                        fieldLabel: 'action',
                        name: 'action',
                        id: 'action',
                        value : 'save',
                        anchor:'80%'
                        }
                
                    ]
                },
                {
                    columnWidth:.300,
                    layout: 'form',
                    items: [{
                        xtype:'combo', 
                        fieldLabel: 'Branch',
                        id:'pr_branch',
                        store: new purchase.core.purchase_requisition.comboStoreBranch(),
                        name: 'pr_branch',
                        displayField : 'branch_name',
                        mode:'remote',
                        valueField : 'branch_id',
                        hideTrigger:false,
                        triggerAction : 'all',
                        minChars:2,width: 250,
                        typeAhead : true,
                        loadingText: 'Please Wait...',
                        forceSelection : true,
                        editable: false,
                        emptyText : 'Select Branch',
                        selectOnFocus : true,
                        anchor:'70%',
                        allowBlank: true,
                    },
                    {
                        xtype:'combo', 
                        fieldLabel: 'Division',
                        id:'pr_division',
                        store: new purchase.core.purchase_requisition.comboStoreDivisi(),
                        name: 'pr_division',
                        displayField : 'divisi_name',
                        mode:'remote',
                        valueField : 'divisi_id',
                        hideTrigger:false,
                        triggerAction : 'all',
                        minChars:2,width: 250,
                        typeAhead : true,
                        loadingText: 'Please Wait...',
                        forceSelection : true,
                        editable: false,
                        emptyText : 'Select Divisi',
                        selectOnFocus : true,
                        anchor:'70%',
                        allowBlank: true,
                    }
                    ,{
                        xtype:'combo', 
                        fieldLabel: 'Department',
                        store: new purchase.core.purchase_requisition.comboStoreDepartment(),
                        id:'pr_department',
                        name: 'pr_department',
                        displayField : 'department_name',
                        mode:'remote',
                        valueField : 'department_id',
                        hideTrigger:false,
                        triggerAction : 'all',
                        minChars:2,width: 250,
                        typeAhead : true,
                        loadingText: 'Please Wait...',
                        forceSelection : true,
                        editable: false,
                        emptyText : 'Select Department',
                        selectOnFocus : true,
                        anchor:'70%',
                        allowBlank: true,
                    }
                    ,{
                        xtype:'combo', 
                        fieldLabel: 'Ship Mode',
                        id:'pr_shipmode',
                        store: values,
                        name: 'pr_shipmode',
                        store: values,
                        displayField:'value',
                        typeAhead: true,
                        mode: 'local',
                        triggerAction: 'all',
                        emptyText:'Select Ship Mode...',
                        loadingText: 'Please Wait...',
                        selectOnFocus:true,
                        anchor:'70%',
                        allowBlank: true,
                    }
                    
                    ]
                    },
                ]}
                ],
                buttonAlign: 'center',
                buttons:[
                {
                    text: 'Save',
                    iconCls:'icon-disk ',
                    listeners:
                    {
                        click:
                        {
                            scope: this,
                            fn: savePurchaseRequisition
                        }
                    }
                },
                {
                    text: 'Cancel',
                    listeners: 
                    {
                        click:
                        {
                            scope:this,
                            fn: function()
                            {
                                this.getForm().reset();
                            }
                        }
                    }
                }]
                
            });
            function savePurchaseRequisition()
            {
                if(this.getForm().isValid())
                {
                    Ext.Ajax.request
                    ({
                        url: purchase.core.purchase_requisition.controller +'/save',
                        params: this.getForm().getValues(),
                        callback: function(options, success, response)
                        {
                            
                            var respon = response.responseText; 
                            console.log('response: '+respon);
                            
                            if(respon == '1')
                            {
                                Ext.getCmp('pr_grid').getStore().reload();
                                Ext.MessageBox.alert('Status','Purchase Requisition Has Been Saved..',response.responseText);                                
                            }
                            
                            else
                            {
                                Ext.MessageBox.alert('Purchase Requisition Saving Failed..',response.responseText);
                                
                            } 
                        }
                    });    
                }
                this.getForm().reset();
                
            }
            
            
            
            purchase.core.purchase_requisition.form.superclass.initComponent.apply(this, arguments);
        },
        
        
        getFormValues: function() 
        {
            var retVal = {};
            this.items.each(function(item) {
                retVal[item.name] = item.getValue();
            });
            return retVal;
        }
    });

    this is code when i displaying form..
    Code:
     purchase.core.purchase_requisition.sitegridform = Ext.extend(Ext.Panel, {
        constructor: function(config){
            config = config || {};
            config.width = config.width || 900;
            config.border = config.border || false;
            config.layout = 'form';
            
            purchase.core.purchase_requisition.sitegridform.superclass.constructor.call(this, config);
        },
        initComponent: function(){
            Ext.apply(this, {            
                items: [
                    this.form = new purchase.core.purchase_requisition.form({
                        width: 900,
                        autoHeight: true
                    })
                ]
            });            
            
            purchase.core.purchase_requisition.sitegridform.superclass.initComponent.apply(this, arguments);
        }


    and this is my code to get the value and i take it in top..global variable..

    Code:
      Ext.namespace('purchase.core.purchase_requisition');
    purchase.core.purchase_requisition.controller = 'index.php/core/purchase_controller';
    
    var result1='';
    
    Ext.Ajax.request
    ({
        url:purchase.core.purchase_requisition.controller+'/tes',
         params: 
         {
         'pr_number':result1,
        },
        callback: function(options, success, response)
         {
            var respon = response.responseText;
            console.log('response: '+respon);
             Ext.getCmp('pr_number').setValue(respon);
         }
     });

Similar Threads

  1. Look and Feel about texfield
    By fm424946 in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 14 Jan 2009, 9:22 AM
  2. Resize of TexField
    By mannobug in forum Ext GWT: Help & Discussion (1.x)
    Replies: 2
    Last Post: 23 Dec 2008, 11:58 PM
  3. Word Counter for TextArea / TexField
    By srajakaruna in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 11 Sep 2008, 7:31 PM
  4. How validate a texfield with a rpc call
    By cgraf in forum Ext GWT: Help & Discussion (1.x)
    Replies: 1
    Last Post: 26 Jun 2008, 2:25 PM
  5. Validate a texfield for numbers only
    By acontreras in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 14 Jan 2008, 7:55 AM

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar