Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-2992 in a recent build.
  1. #1
    Sencha User aatiis's Avatar
    Join Date
    Nov 2011
    Location
    Bajmok, Serbia
    Posts
    60
    Vote Rating
    2
    aatiis is on a distinguished road

      0  

    Default Form should not submit unnamed fields

    Form should not submit unnamed fields


    The docs for Ext.field.Field say:

    name : StringThe field's HTML name attribute. Note: this property must be set if this field is to be automatically included with form submit().


    Defaults to: null
    However, a field with no name is still submitted:

    Code:
      ...
      {
        xtype: "togglefield",    label: "Existing chapters",
        labelWidth: null
      }
      ...
    A field like this would result in "null=" being submitted when form.submit() is called.

    A workaround is to use form.submit({params: ...}), or to disable the field in question before submitting the form.

    Please either clarify this in the docs if this is expected behaviour, or fix if this is a bug.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,632
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I'd consider this a bug as I agree with the docs.

    I have put in a fix where getValues() will only return the values of fields with the name configured but you can override it by passing true as the second argument.

    Code:
    form.getValues() //return fields with name configured
    form.getValues(null, true) //return all fields
    So now the form.submit() will only get the fields with the name configured.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread