Results 1 to 7 of 7

Thread: getValue is not method

  1. #1

    Exclamation getValue is not method

    Solved:I am creating an application in which I am using radiofield group name paid

    but in this line
    var updatePaymentStatus = Ext.getCmp('paid').getValue();

    it is throwing error that "Cannot call method 'getValue' of undefined"


    Dont know why this error ??
    Plz help or tell me how to get the checked value

  2. #2
    Sencha User Sameer Khan's Avatar
    Join Date
    Oct 2011
    Location
    Bangalore, India
    Posts
    118

    Default try this code

    HI, i think for the radio field group you have to maintain unique id's for all the elements, but name should same for the entire radio group...
    If u try to get value on name of radio group, we will get this problem..

    Just try this code & under stand this code and apply on ur example...U will get Idea..

    Sample Code:
    -----------------
    {
    xtype: 'container',
    layout:'hbox',
    defaults:{xtype : 'radiofield', labelAlign : 'right',labelWidth : '60%', flex:1},
    items:[{
    label: '1-Early',
    name: 'm0110_epTiming',
    id :'m0',
    value:'1'
    },{
    label: '2-Later',
    name: 'm0110_epTiming',
    id :'m1',
    value:'2'
    },{
    label: 'UK',
    name: 'm0110_epTiming',
    id : :m2',
    value:'-2'
    },{
    label: 'NA',
    name: 'm0110_epTiming',
    id : 'm3',
    value:'-1'
    }]
    },

    Now u call like this:

    FormPanelObject.getValues().m0110_epTiming --> you will get Value

    (Or)
    Ext.getCmp('m0').getValue();
    Ext.getCmp('m1').getValue();
    Ext.getCmp('m2').getValue();
    Ext.getCmp('m2').getValue();
    // Here individually u need to call on id of radio field items, then only u will get radio field item values...

    Let me know... thanks .,..
    Sameer Khan

  3. #3

    Question Thanx for reply but problem not solved

    Thanx Sameer for helping me out but name of radiofields are already same:

    {xtype: 'spacer' },
    {xtype: 'radiofield',name: 'paid', label: 'Delivered', checked:true,value:0},
    {xtype: 'spacer' },
    {xtype: 'radiofield',name: 'paid', label: 'Paid',value:1},
    {xtype: 'spacer' },
    {xtype: 'radiofield',name: 'paid', label: 'Not Paid',value:2},
    {xtype: 'spacer' }

    I want value of checked field and it is not the part of any form.........

  4. #4
    Sencha User Sameer Khan's Avatar
    Join Date
    Oct 2011
    Location
    Bangalore, India
    Posts
    118

    Default

    Hi, Just send me your form code code..I will have a look at this. And i will let you know how u r doing ?

    If radio field is the element for the form then you can call "yourformname.getValues().paid"...it will give the radio field value what ever you select ...
    Sameer Khan

  5. #5

    Default Here is the code

    var changePayment = function(oid) {

    if (!Ext.is.Phone) { //Nivedita Jain
    var oID=oid;

    var Payment = new Ext.form.FormPanel({
    floating: true,

    url: server_path + '?action=paymentchange&oID='+oid,
    scroll: 'vertical',
    width: 440,
    height: 400,
    standardSubmit: false,
    centered: true,
    id:'changePayment',
    autoRender: true,
    modal: false,
    hideOnMaskTap: false,
    layout: 'fit',

    dockedItems: [
    { xtype: 'toolbar', title: 'Payment' },
    { items: [
    {xtype: 'spacer' },
    {xtype: 'radiofield',name: 'paid', id:'delivered',label: 'Delivered', checked:true,value:0},
    {xtype: 'spacer' },
    {xtype: 'radiofield',name: 'paid', id:'pay',label: 'Paid',value:1},
    {xtype: 'spacer' },
    {xtype: 'radiofield',name: 'paid', id:'notPay', label: 'Not Paid',value:2},
    {xtype: 'spacer' }
    ]
    },

    { xtype: 'toolbar', docked:'bottom',items:[
    {text: 'Save',name:'save',handler: function() {
    // alert("hello");
    var updatePaymentStatus = Ext.getCmp('paid').getValue();

    alert(updatePaymentStatus+" value");
    Ext.Ajax.request({
    url: server_path + '?action=updatePayment',
    method: 'POST',
    params: {
    payment:updatePaymentStatus,
    order:oID
    },
    success: function (res, req) {
    Ext.Msg.alert("Mpole", "Payment Updated");
    },
    failure: function (res, req) {
    Ext.Msg.alert("Mpole", "Some Problem has Occured");
    }
    });
    Payment.hide();
    }},

    {text: 'Cancel',name:'cancel',handler: function() {
    Payment.reset();
    Payment.hide();
    }
    }
    ]
    }

    ],cls: 'modelWindow',
    store: paymentchangeStore
    })
    //alert(oid);
    paymentchangeStore.load({params: {oID: oid}});
    Payment.show();
    }
    }

  6. #6

    Default Here is the code

    var changePayment = function(oid) {

    if (!Ext.is.Phone) { //Nivedita Jain
    var oID=oid;

    var Payment = new Ext.form.FormPanel({
    floating: true,

    url: server_path + '?action=paymentchange&oID='+oid,
    scroll: 'vertical',
    width: 440,
    height: 400,
    standardSubmit: false,
    centered: true,
    id:'changePayment',
    autoRender: true,
    modal: false,
    hideOnMaskTap: false,
    layout: 'fit',

    dockedItems: [
    { xtype: 'toolbar', title: 'Payment' },
    { items: [
    {xtype: 'spacer' },
    {xtype: 'radiofield',name: 'paid', id:'delivered',label: 'Delivered', checked:true,value:0},
    {xtype: 'spacer' },
    {xtype: 'radiofield',name: 'paid', id:'pay',label: 'Paid',value:1},
    {xtype: 'spacer' },
    {xtype: 'radiofield',name: 'paid', id:'notPay', label: 'Not Paid',value:2},
    {xtype: 'spacer' }
    ]
    },

    { xtype: 'toolbar', docked:'bottom',items:[
    {text: 'Save',name:'save',handler: function() {
    // alert("hello");
    var updatePaymentStatus = Ext.getCmp('paid').getValue();

    alert(updatePaymentStatus+" value");
    Ext.Ajax.request({
    url: server_path + '?action=updatePayment',
    method: 'POST',
    params: {
    payment:updatePaymentStatus,
    order:oID
    },
    success: function (res, req) {
    Ext.Msg.alert("Mpole", "Payment Updated");
    },
    failure: function (res, req) {
    Ext.Msg.alert("Mpole", "Some Problem has Occured");
    }
    });
    Payment.hide();
    }},

    {text: 'Cancel',name:'cancel',handler: function() {
    Payment.reset();
    Payment.hide();
    }
    }
    ]
    }

    ],cls: 'modelWindow',
    store: paymentchangeStore
    })
    //alert(oid);
    paymentchangeStore.load({params: {oID: oid}});
    Payment.show();
    }
    }

  7. #7
    Sencha User Sameer Khan's Avatar
    Join Date
    Oct 2011
    Location
    Bangalore, India
    Posts
    118

    Default

    Here, your code is very clear, why don't you use "this.getValues().paid" , it will give u the radio field value..It's very simple.

    One more thing is Ext.Ajax.request() won't work for cross domain communication...so You can ues JSONP request....If u use Ext.AJax.request() it always gives you status code -0...
    Sameer Khan

Posting Permissions

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