Chaning the Fieldname dynamic extjs 6

58 views Asked by At
xtype: 'hidden/text/textarea',
name: 'somename',
reference: 'somereference',

How do i change the name of dynamically i have tried

typeId.inputEl.dom.name = 'typeId[1]';

but it is not working i am using extjs here is the inspector image

as image name can be seen as result[1255] but when posting it is posting the old name as result;

1

There are 1 answers

5
scebotari66 On BEST ANSWER

Assuming that "typeId" is your form field, you only have changed the name of the underlying dom element, but you also need to set the name for the ExtJS component:

typeId.name = 'newName';

Check out this example: https://fiddle.sencha.com/#view/editor&fiddle/1ngu

  1. Open the "Network" tab in dev tools
  2. Do a form submit by accessing "Form Submit"
  3. Access "Change field name"
  4. Do a form submit again and observe that the submitted name has changed