Results 1 to 3 of 3

Thread: how to use getValues in formPanel?

  1. #1
    Sencha User
    Join Date
    Jun 2017
    Posts
    5

    Default Answered: how to use getValues in formPanel?

    i try to use getValues method on form panel here is my code.

    Code:
    <FormPanel                            shadow
                                ref={form => (this.form = form)}
                                name="FormTA"
                                layout={{ type: "hbox", pack: "space-between" }}
                            >
                                <TextField
                                    placeholder="Nama"
                                    label="Nama"
                                    name="Nama"
                                    required
                                />
                                <TextField
                                    placeholder="Pendidikan Terakhir"
                                    label="Pendidikan Terakhir"
                                    name="PendidikanTerakhir"
                                    required
                                />
                                <TextField
                                    placeholder="Kualifikasi"
                                    label="Kualifikasi"
                                    name="Kualifikasi"
                                    required
                                />
                                <TextField
                                    placeholder="Lama Pengalaman"
                                    label="Lama Pengalaman"
                                    name="LamaPengalaman"
                                    required
                                />
                                <TextField
                                    placeholder="Sertifikat Keahlian"
                                    label="Sertifikat Keahlian"
                                    name="SertifikatKeahlian"
                                    required
                                />
                                <Button
                                    text="Tambah"
                                    ui="action"
                                    handler={this.SaveData}
                                />
    
    </FormPanel>
    

    here is SaveData functon:

    Code:
    SaveData() {        console.log("form submited");
            const values = this.FormPanel.getValues();
            console.log(values);
    
        }
    the error that i get is this.formpanel is undefined
    i saw some example this method works

  2. I suggest using an arrow function to define your handler so that it's scoped to your component. Here is an example:

    https://fiddle.sencha.com/?extreact#...or&fiddle/23ue

  3. #2

    Default

    this is referenced to button, you need to get reference to form panel, you can do this by
    SaveData() { console.log("form submited");
    const values = this.up('formpanel').getValues();
    console.log(values);

    }




  4. #3
    Sencha User
    Join Date
    Mar 2015
    Location
    Maryland
    Posts
    482
    Answers
    114

    Default

    I suggest using an arrow function to define your handler so that it's scoped to your component. Here is an example:

    https://fiddle.sencha.com/?extreact#...or&fiddle/23ue

Similar Threads

  1. getValues from formpanel
    By sendy in forum Sencha Touch 2.x: Q&A
    Replies: 5
    Last Post: 20 Jan 2013, 1:29 PM
  2. formpanel.getValues() Doesn't Return Value of checkboxfield
    By knappe in forum Sencha Touch 1.x: Q&A
    Replies: 2
    Last Post: 16 Nov 2011, 12:02 PM
  3. [Ext 2.0] FormPanel getValues() missing?
    By jarrod in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 25 Jul 2007, 2:36 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
  •