Project

General

Profile

Actions

Feature #98259

open

Set GET/POST values to additionalParams of form-tag

Added by Stefan Froemken over 1 year ago. Updated over 1 year ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
Start date:
2022-09-05
Due date:
% Done:

0%

Estimated time:
PHP Version:
7.4
Tags:
Complexity:
Sprint Focus:

Description

Hello form Team,

I have a multi-step formular and I want to edit a record.
I have added the record UID to GET vars and I found a solution to set the default values to the values of the requested record.
If I switch to page 2 the record UID is gone.
I need a solution to add the record UID as parameter for the URL.

For static values I would do something like that:

type: Form
identifier: newEvent
label: Create a new event
prototypeName: standard
renderingOptions:
  additionalParams:
    tx_events2_events:
      event: 42561
  submitButtonLabel: Submit
  fluidAdditionalAttributes:
    class: withtip frame-indent

Can you please add a placeholder for GET and/or POST vars?

Stefan

Actions #1

Updated by Stefan Froemken over 1 year ago

For now I have helped me with my own Factory class:

/**
 * I haven't found any solution to add a dynamic GET var into the YAML configuration
 */
public function build(array $configuration, string $prototypeName = null): FormDefinition
{
    if (
        isset($_GET['tx_events2_events']['event'])
        && !isset($configuration['renderingOptions']['additionalParams']['tx_events2_events']['event'])
    ) {
        $configuration['renderingOptions']['additionalParams']['tx_events2_events']['event']
            = $_GET['tx_events2_events']['event'];
    }

    return parent::build($configuration, $prototypeName);
}
Actions

Also available in: Atom PDF