Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when using js2form #41

Open
pnomolos opened this issue Nov 28, 2012 · 1 comment
Open

Issue when using js2form #41

pnomolos opened this issue Nov 28, 2012 · 1 comment

Comments

@pnomolos
Copy link

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?

@pnomolos
Copy link
Author

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));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant