Skip to content

Prefill fields from url-parameters #638

Open

Description

@mr-itbiz

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

Activity

  1. added
    0. Needs triagePending approval or rejection. This issue is pending approval.
    enhancementNew feature or request
    on Oct 15, 2020
  2. changed the title [-]Send answer values via get/url[/-] [+]Prefill fields from url-parameters[/+] on Feb 10, 2021
  3. added
    1. to developAccepted and waiting to be taken care of
    and removed
    0. Needs triagePending approval or rejection. This issue is pending approval.
    on Feb 10, 2021
  4. added this to the Maybe someday milestone on Feb 10, 2021
  5. sethiele commented on Mar 5, 2021

    @sethiele

    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.

  6. RedTiger26 commented on Mar 9, 2021

    @RedTiger26
  7. nabl13 commented on Jun 10, 2021

    @nabl13
  8. KiaraGrouwstra commented on Aug 23, 2022

    @KiaraGrouwstra

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

  9. KiaraGrouwstra commented on Jan 21, 2023

    @KiaraGrouwstra

    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
  10. Chartman123 commented on Jan 22, 2023

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

  11. Schlepptop commented on Oct 16, 2023

    @Schlepptop

    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
  12. KiaraGrouwstra commented on Oct 16, 2023

    @KiaraGrouwstra

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

  13. Schlepptop commented on Oct 16, 2023

    @Schlepptop

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

  14. TUCAOEVER commented on Mar 20, 2025

    @TUCAOEVER
  15. dscholles81 commented on May 20, 2025

    @dscholles81
  16. klml commented on Oct 17, 2026

    @klml

    I would use the fragment identifier (#) instead of searchParams (?). searchParams is sent to the server, which could potentially lead to unintended consequences and might pose a problem under data protection. The fragment identifier remains in the browser.

    But shouldn't you instead add the URL parameters as options in Vue.js/Router, since Nextcloud/Forms uses it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    1. to developAccepted and waiting to be taken care ofenhancementNew feature or request

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions