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

Prefill fields from url-parameters #638

Open
mr-itbiz opened this issue Oct 15, 2020 · 9 comments
Open

Prefill fields from url-parameters #638

mr-itbiz opened this issue Oct 15, 2020 · 9 comments
Labels
1. to develop Accepted and waiting to be taken care of enhancement New feature or request
Milestone

Comments

@mr-itbiz
Copy link

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

@mr-itbiz mr-itbiz added 0. Needs triage Pending approval or rejection. This issue is pending approval. enhancement New feature or request labels Oct 15, 2020
@jotoeri jotoeri changed the title Send answer values via get/url Prefill fields from url-parameters Feb 10, 2021
@jotoeri jotoeri added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending approval or rejection. This issue is pending approval. labels Feb 10, 2021
@jotoeri jotoeri added this to the Maybe someday milestone Feb 10, 2021
@sethiele
Copy link

sethiele commented Mar 5, 2021

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.

@RedTiger26

This comment has been minimized.

@nabl13

This comment has been minimized.

@KiaraGrouwstra
Copy link

@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/

@KiaraGrouwstra
Copy link

there are a few components to this:

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

@Chartman123
Copy link
Collaborator

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 :)

@Schlepptop
Copy link

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:

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

@KiaraGrouwstra
Copy link

@Schlepptop that sounds like a question of user intent. i wonder if there is an easy answer there.

@Schlepptop
Copy link

The safest approach would probably be to handle this with a modal as in #1310.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants