Results 1 to 3 of 3

Thread: Getting form values

  1. #1
    Sencha User FlashM's Avatar
    Join Date
    Jan 2011
    Location
    EU / Slovenia / Ljubljana
    Posts
    3

    Question Getting form values

    Hi,

    I'm building big application where I have a form that is dynamically built. For the sake of simplicity let's say my form consists of a radio group, combobox and few text fields.

    This is my radio group form item:


    Code:
    xtype: 'radiogroup',
    fieldLabel: 'Gender',
    value: this.data.Gender,
    items: [
        { boxLabel: 'Male', name: 'gender', inputValue: 1 },
        { boxLabel: 'Female', name: 'gender', inputValue: 2 }
    ]
    This is my combo box form item:

    Code:
    xtype: 'combo',
    name: 'status',
    value: this.data.Status,
    width: 120,
    fieldLabel: 'Status',
    emptyText: "Select status...",
    forceSelection: true,
    triggerAction: "all",
    selectOnFocus: true,
    typeAhead: true,
    mode: 'local',
    store: new Ext.data.ArrayStore({
        fields: [
                    'Status',
                    'StatusString'
                 ],
        data:  [
                    [0, 'Active'],
                    [1, 'Inactive']
                 ]
    }),
    valueField: 'Status',
    displayField: 'StatusString'

    This is my text field form item:


    Code:
    xtype: 'textfield',
    name: 'title',
    fieldLabel: 'Title',
    value: this.data.Title
    When I execute form.getValues() method it returns me object that looks like this:

    gender: "2"
    status: "Active" ==> should be "0"
    title: "Some title"


    When I execute form.getFieldValues() method it returns me object that looks like this:

    gender: ext-comp-1583 ==> should be "2" but instead an object is returned
    status: "0"
    title: "Some title"


    This is the object that I would like to get:

    gender: "2"
    status: "0"
    title: "Some title"


    But how?

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    getValues() will work after you change Combobox 'name' to 'hiddenName'.

    getFieldValues() doesn't work because of the strange getValue() implementation of CheckboxGroup and RadioGroup. I would suggest overriding these.

  3. #3
    Sencha User FlashM's Avatar
    Join Date
    Jan 2011
    Location
    EU / Slovenia / Ljubljana
    Posts
    3

    Cool

    That actually did the trick, thank you.

Similar Threads

  1. Simple Form submit with HTTP Post fails to transmit form values
    By Meyerhoefer in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 30 Aug 2011, 11:33 AM
  2. How get values from form ! !
    By sunder in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 3 Sep 2010, 4:00 AM
  3. Loading Form from xtype doesn't load form values
    By ndtreviv in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 20 Apr 2009, 1:52 AM
  4. how to submit xtype: 'form' form values
    By anitsirc in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 13 Aug 2008, 10:10 AM

Tags for this Thread

Posting Permissions

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