Form Builder does not fully allow Ajax GET requests

Created on 23 February 2024, about 1 year ago
Updated 1 May 2024, 11 months ago

Problem/Motivation

In πŸ“Œ Allow AJAX to use GET requests Fixed we allowed ajax get requests; however, FormBuilder still specifically checks POST for form_id and throws exceptions if not in place. I came across this when attempting to build a table within a Form with sorters from non-database/non-views related content. The sorters and pagination are links rather than form elements and therefore do not POST data.

Steps to reproduce

Attempt to build a form during an ajax request that contains only GET variables
BrokenPostRequestException is thrown from FormBuilder here

if ($ajax_form_request && !$request->request->has('form_id')) {
  throw new BrokenPostRequestException($this->getFileUploadMaxSize());
}

and here:

if ($ajax_form_request && $form_state->isProcessingInput() && $request->request->get('form_id') == $form_id) {
  throw new FormAjaxException($form, $form_state);
}

Proposed resolution

Use $request->get() instead of $request->request->get()

Remaining tasks

  1. Fix issue
  2. Provide test

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

FormBuilder now allows a Form to be fully built in Ajax with GET requests

πŸ› Bug report
Status

Fixed

Version

10.2 ✨

Component
FormΒ  β†’

Last updated 24 minutes ago

Created by

πŸ‡¬πŸ‡§United Kingdom scott_euser

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024