Results 1 to 2 of 2

Thread: Form should not submit unnamed fields

    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
    3
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

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
  •