Results 1 to 2 of 2

Thread: Get form field values if it has value

  1. #1

    Default Answered: Get form field values if it has value

    Hi,

    I am using form as filter panel. It will be used by users to fill filter criteria and based on this, data in grid will be loaded. I have 20 form fields and some fields have some default values. I want all the fields with data, empty fields should be ignored.

    Code:
    form.getValues()
    It gets all fields even if data is not entered. I tried to get dirty fields, But i don't get default value fields in this. I use
    Code:
    value: pradeep
    to set default values, it does not make the field as dirty. How do i solve this issue?

  2. Hi, the dirty property is about the modification status, not about empty/filled.
    I think the easier way is to "clean" the form values just before to send it to the server:
    Code:
    Ext.Object.each(formValues, function(key, value, object) {
        if (Ext.isEmpty(value)) {
            delete object[key];
        }
    });

  3. #2

    Join Date
    Dec 2013
    Location
    Italy
    Posts
    88
    Answers
    9

    Default

    Hi, the dirty property is about the modification status, not about empty/filled.
    I think the easier way is to "clean" the form values just before to send it to the server:
    Code:
    Ext.Object.each(formValues, function(key, value, object) {
        if (Ext.isEmpty(value)) {
            delete object[key];
        }
    });

Similar Threads

  1. setting form field values
    By adeelmahmood in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 12 Nov 2010, 4:35 PM
  2. Remember form field values
    By devtig in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 12 Feb 2010, 5:42 AM
  3. Problem getting form field values
    By Margusja in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 1 Oct 2009, 3:35 AM
  4. Help: form field values not displayed
    By SchattenMann in forum Ext 3.x: Help & Discussion
    Replies: 7
    Last Post: 31 Aug 2009, 3:06 AM
  5. Getting Form field values
    By anitsirc in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 9 Sep 2008, 2:32 PM

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
  •