You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: