Project

General

Profile

Actions

Feature #72409

closed

Dont append query params in FormViewHelper if method is GET

Added by Philipp Wrann over 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
Fluid
Start date:
2015-12-23
Due date:
% Done:

0%

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

Description

If you place a f:form viewhelper with method GET the query params have to be moved from form-action to hidden input fields.

http://www.w3.org/TR/2011/WD-html5-20110525/association-of-controls-and-forms.html#form-submission-algorithm

Actions #1

Updated by Claus Due over 8 years ago

  • Tracker changed from Bug to Feature
  • Priority changed from Must have to Could have
  • Target version changed from 7.6.3 to Candidate for Major Version
  • Complexity set to hard

Hi Philipp,

I'm not sure I understand if this is a bug report? If you do this with a regular HTML form then it too will replace the parameters, as described in the RFC you link to under "Mutate action URL". Mutation of the action URL implies replacing the current query arguments with ones coming from the form fields.

In other words, this is by design in HTML as it is in Fluid.

You may also find a similar discussion on https://forge.typo3.org/issues/27415 where the point is raised that doing these things would likely be incompatible with realurl (an assessment I agree with, but this sort of magic behavior would likely mean incompatibility with realurl and every other URL generating extension in that forms would never be able to build such an URL at form submission time without jumping through hoops one should never jump through).

My conclusions would be:

  • I personally would not do this but it is possible, as long as the new incompatibilities with things like realurl are acceptable.
  • This should be declared as a feature and should be off by default, enabled per-form (as such, it wouldn't go into 7.6.x which in my opinion is okay, it's a pretty big change to a key behavior).
  • I would not consider doing this until we know which routing solution TYPO3 will adopt as one could affect the other very easily.

I've updated the issue report parameters accordingly but haven't closed or rejected it ;)

Actions #2

Updated by Philipp Wrann over 8 years ago

I think this is not a big deal, after rendering the action url you can determine which params are still present in the query string and did not get replaced by some pretty url mechanism.

So after the generation you simply add all queryparams as hidden inuput fields too (and keep them in the url as well).

You dont need to change any security hash or whatever, its simply a fallback value, if the browser is removing the query string (what most browsers actually do).

So in pseudocode:

action = this->renderUrl();
this->tag->addAttribute('action', action);
if (method === get) {
  queryParams = parse_url(action, query_string);
  if (queryParams) {
    // add hidden input fields for query params
  }
}

At the moment GET Forms that point to other pages are not possible without some prettyurl module replacing the id/L/type params... they get lost.

Actions #3

Updated by Claus Due over 7 years ago

  • Status changed from New to Closed

Closing this one - in addition to the method described, arguments `additionalParams`, `addQueryString`, `argumentsToBeExcludedFromQueryString` and `addQueryStringMethod` can be used to modify the behavior of the "action" URL `f:form` generates.

Actions

Also available in: Atom PDF