form2js
form2js copied to clipboard
Issue when using js2form
I have my form names in ruby-style syntax like a[b][c], but when using js2form the normalizeName process turns the object I pass into the a.b.c style names. This means that the input names to don't match the names the js2form function is creating for the object, so nothing gets filled in. Is this the intended behavior or am I missing something?
As a followup, this only occurs when you have ruby-style syntax one level deep (such as a[b]). I fixed this by adding the following code on lines 136-140 of form2js.js:
else if (/^\w+\[[a-z_][a-z0-9_]+?/.test(namePart))
{
namePart = namePart[0].split('[', 2);
nameParts.push(namePart[0], namePart[1].substr(0, namePart[1].length - 1));
}