Seeing error on line 146 of form2object.js
I'm seeing the error:
currResult[arrName].push is not a function
When processing a form that has dynamically generated fields, do you have any ideas why?
TIA
Can you provide a form which generates this error?
The problem occurs when you have following scenario: A form where you can form lines dynamically and one of the elements in the line is a select element with a name like "name[]". The name will become "name" in the line where there is a select element. If you add another line after this without a select element, but a normal element with the name "name[]", the name will stay "name[]" and it will try to push to currResult[name] which once was an array and then was replaced by the value which was selected in the selectbox...
The problem is caused by the replacement of square brackets in the name of a select element. line 250: result = [ { name: fieldName.replace(/[]$/, ''), value: fieldValue } ] possible fix (possibly breaks other code???): result = [ { name: fieldName, value: fieldValue } ]