-
Notifications
You must be signed in to change notification settings - Fork 237
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
Allow nested field values in session #573
Conversation
Useful for other fields too… <input name="address[line1]">
<input name="address[line2]">
<input name="address[town]">
<input name="address[postcode]"> |
6906990
to
a3c3d93
Compare
Pushed another change up as this affects the nunjucks It now supports dot or bracket notation: // Flat name/value pairs
checked("example1", "true")
checked("example2", "true")
// Nested name/value pairs (mixed notation)
checked("[parent1].example1", "true")
checked("[parent1].example2", "true")
checked("[parent2].example1", "true")
checked("[parent2].example2", "true")
// Nested name/value pairs (bracket notation, quoted)
checked("['parent-hyphenated-1']['example-1']", "true")
checked("['parent-hyphenated-1']['example-2']", "true")
checked("['parent-hyphenated-2']['example-1']", "true")
checked("['parent-hyphenated-2']['example-2']", "true") Object notation as strings is hard to parse, so I've used keypather here. |
e7e2f7f
to
aac28fe
Compare
Hey Colin, This looks like a useful addition, my only thought is: How will users know about this feature? Is there any guidance we need to add to the documentation? |
aac28fe
to
90f591f
Compare
Hi @NickColley, Glad you like it. I've gone ahead and added documented in |
90f591f
to
08ed1a6
Compare
08ed1a6
to
910e3f2
Compare
Add new entry to changelog |
One thing I'm thinking about - we generally tell people to use Could this work using |
910e3f2
to
ef03e6d
Compare
Hi @joelanman, I've changed all the examples to use Some screenshots from the documentation have been edited above. Also #573 (comment) has been updated to show both dot and bracket notation examples. |
04cc468
to
bce6faf
Compare
bce6faf
to
99c015b
Compare
Rebased with latest from |
99c015b
to
7255d61
Compare
Rebased with latest from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really useful, thanks for picking it up 👍 I've left some comments.
7255d61
to
24b111c
Compare
Hi @hannalaakso, cheers again for the review. I've replied to all your points and pushed a new version up 😊 |
E.g. <input name="example1[name]" value="Hello 123"> <input name="example2[name]" value="Hello 456"> <input name="example3[name]" value="Hello 789">
24b111c
to
ec4e26d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing my comments. I've tested the new version and it's looking good 🙂
Just need another person in the team to review this as well before we can merge it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Hello!
We've got a service where we use the same nunjucks views to collect data for both claimants and optionally their partners.
E.g.
With this pull request
useAutoStoreData
will store the data correctly 👍i.e. Nicely grouped as
claimant
andpartner
as specified in the HTML.We also regularly switch
express-session
withclient-sessions
(cookie vs. memory store) but it doesn't have thesession.destroy()
method. I've added a little compatibility change for this too.It'll help other teams also wanting to use another session store that survives Node.js restarts.