Skip to content

Passing an input array with params in name #6

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

Open
feelepxyz opened this issue Oct 26, 2010 · 0 comments
Open

Passing an input array with params in name #6

feelepxyz opened this issue Oct 26, 2010 · 0 comments

Comments

@feelepxyz
Copy link

I'm having a hard time trying to figure this out.

So I'm using datalink and tmpl for an experiment shop thingy.
Building the cart part with tmpl and liking some of the fields up with datalink to calculate totals and what not.

However, as there are multiple items in the cart, I would like to use a pair of brackets in the input names when passing them to the server. Something like:

<input … name="title[]" …
To give me an array of all the items in the cart.
But doing this makes datalink create a new object property, instead of updating the existing one, as the name field is different, so no surprise there. But then tmpl doesn't allow strings as object identifiers so no brackets there..

The alternatives I'm coming up with are either to allow strings as object identifiers im tmpl ('${"artno[]"}'), or make data-link ignore brackets in the name="".. Doesn't seem to great though.

Am I missing something here?
Mind you, I'm still seriously learning javascript/programming, so please correct me if I'm thinking this wrong.

Regards
Philip

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