forms
forms copied to clipboard
Prefill fields from url-parameters
Nextcloud (please complete the following information):
- Nextcloud-Version: [e.g. 20.0.0]
- Forms-Version: [e.g. 2.0.4]
Hello it is possible to send values for a Form via get? I have a form with the field name and I want to create a link like /index.php/apps/forms/eQHeX2MT6MbfErg4zwztzf?name=Anton
it is possible? Thank you
To make the business value a bit clear:
With this feature you can create auto generated Form-Links for customers with prefilled user IDs or so.
+1 from me, too.
Would be really nice for mailings to populate customer ids
+1
This Feature would be really awesome, also it would be an advantage over microsoft and google forms as they are also not supporting this.
@nabl13
This Feature would be really awesome, also it would be an advantage over microsoft and google forms as they are also not supporting this.
gforms does support this, see https://trevorfox.com/2015/06/dynamically-pre-fill-google-forms-with-mailchimp-merge-tags/
there are a few components to this:
- ensuring form inputs have sane
id
attributes, preferably based on the question. this appears related to #1040. - populating the inputs from query parameters, which comes down to:
var params = (new URL(document.location)).searchParams;
for (var [param_key, param_value] of params.entries()) {
var formElement = document.getElementById(param_key);
if (formElement) {
formElement.value = param_value;
}
}
- (bonus) potentially facilitating generating such prefilled URLs from the UI
Hi @KiaraGrouwstra
if you want you can give it a try and work on this :) We would be very happy if you can create a PR for this issue :)
Given the development in #1382, is this still the suggested approach for implementing this? I could see the two methods interfering with each other. I assume the localStorage should take precedence?
there are a few components to this:
- ensuring form inputs have sane
id
attributes, preferably based on the question. this appears related to Add technical identifier / name for fields #1040.- populating the inputs from query parameters, which comes down to:
var params = (new URL(document.location)).searchParams; for (var [param_key, param_value] of params.entries()) { var formElement = document.getElementById(param_key); if (formElement) { formElement.value = param_value; } }
- (bonus) potentially facilitating generating such prefilled URLs from the UI
@Schlepptop that sounds like a question of user intent. i wonder if there is an easy answer there.
The safest approach would probably be to handle this with a modal as in #1310.