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
Add ability to pass params into forms #2674
Conversation
Thanks, @xmorave2! I'm curious whether @EreMaijala has any thoughts on this, since he's more invested in the form code than I am. I also wonder whether we need to add test coverage for this new functionality, and whether we should add a configuration setting to limit which parameters may be pre-filled via URL (in case there are any possible abuses of the functionality that we might want to avoid). Any thoughts? |
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 is a good idea, but @demiankatz has valid points. We need to protect at least the read-only reserved elements (referrer, useragent, submit). Also need to ensure that this doesn't allow overriding a select field with an invalid value (I didn't test it yet), and here test coverage would help.
688d828
to
b63bee9
Compare
Thanks for review. I added configuration for enabling prefill only for specific fields and check if some of protected fields are not prefilled. I didn't implement prefilling for selects and checkboxes - it turned out a bit complicated and we don't even need for our use case. |
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 the progress on this! I have just a few minor suggestions.
Thanks @demiankatz I fixed them all. |
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, @xmorave2! I'll wait to see if @EreMaijala has any further thoughts before merging this.
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.
Looks good to me now!
This enables to create links with urls like
/Feedback/Form/SomeForm?param=value
to prefill inputs for user, or fill hidden inputs with some dynamic value.