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

Stealth textfield prefill feature from query parameters #498

Closed
liangyuanruo opened this issue Oct 20, 2020 · 1 comment · Fixed by #524
Closed

Stealth textfield prefill feature from query parameters #498

liangyuanruo opened this issue Oct 20, 2020 · 1 comment · Fixed by #524
Assignees
Labels
P2 planned for next 1-2 months

Comments

@liangyuanruo
Copy link
Contributor

If a query parameter is provided to a form URL in one of the following formats:

Server-side URL

  • https://form.gov.sg/<formId>?<fieldId1>=<value1>&<fieldId2>=<value2>...

Client-side URL (server can't see anything after hashbang)

  • https://form.gov.sg/#!/<formId>?<fieldId1>=<value1>&<fieldId2>=<value2>...

and if the fieldIds are valid mongoose object IDs and refer to a short text field, then prefill and disable editing the corresponding form field on the frontend.

Path and query parameters can be retrieved with the AngularJS $location service. Watch for edge cases depending on whether the hashbang or query parameters come first.

@liangyuanruo liangyuanruo added P1 highest priority - pick up as soon as available P2 planned for next 1-2 months and removed P1 highest priority - pick up as soon as available labels Oct 20, 2020
@tshuli tshuli self-assigned this Oct 22, 2020
@tshuli
Copy link
Contributor

tshuli commented Oct 29, 2020

For discussion on whether to expand prefill to support the following use cases

Singpass forms; currently the query params are lost on singpass redirect
Non-english characters; currently not supported due to sanitizing input
Other field types. Although short text field already accepts string (i.e. can input any value), expanding to other field types will allow you to apply more types of custom validation (e.g. number validation). Note that short text custom validation already works with prefill

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 planned for next 1-2 months
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants