[TYPO3-dev] Problems with a form in my extension and the action attribute

Jigal van Hemert jigal at xs4all.nl
Wed Aug 18 12:47:42 CEST 2010


Hi,

On 18-8-2010 11:38, Björn Pedersen wrote:
>>> StephenBungert schrieb:
>>>> I set the action with:
>>>> $markerArray['###FORM_ACTION###'] =
>>>> $this->pi_getPageLink($GLOBALS['TSFE']->id);
>>>>
> Do not use pi_getPageLink, use either typolink or the variable passing
> link functions in pi_base. And just make sure to set all necessary
> variables.

The problem is not which function to use here to make a link to the 
current page.
If you read further the problem becomes clear:

>>>> And this is fine when the page is first visited - i see it
>>>> correctly in the form action attr, but after submitting the id is
>>>> not in the query string and the root page is shown.
>>>
>>> try using id as hidden field. I remember these problems using GET
>>
>> And what happens when Realurl / cooluri is installed? The form is now
>> submitted to an "old" url, isn't it?
>>
>> Is there a way to make the form work with GET without having to look for
>> certain installed extensions?

In short:
The TYPO3 link functions include a querystring in the action attribute 
of a GET form (id plus optionally others):
- without url rewriter (e.g. realurl) this will be stripped by the 
browser and only the fields in the form are added to the url
- with a url rewriter the parts of the querystring which are mapped in 
the realurl configuration are used to build the url so they will survive

Alternatively, include all parameters (including id) in the form as 
hidden fields:
- without url rewriter this works correctly
- with url rewriter the form will go to a url which is not rewritten (so 
visitor will see an "old type" url (with id=xx...))

The only (ugly) solution I can think of at the moment is to let TYPO3 
build the url, let PHP parse it, put the querystring parts in the form, 
rebuild the rest and use that as the action. I hope there is a prettier way!

-- 
Kind regards / met vriendelijke groet,

Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh




More information about the TYPO3-dev mailing list