Bug #71565
closedEXT:FORM in 7 LTS: invalid url for action
0%
Description
If the action is generated using typolink, the absRefPrefix is inserted twice at the beginning of the action uri.
Typoscript:
config.absRefPrefix = /
10 = FORM 10 { name = subscriptionform method = post prefix = subscribe confirmation = 0 action { typolink.parameter = 22 typolink.returnLast = url } [...] }
Generated form tag:
<form id="field-1" name="subscriptionform" method="post" enctype="multipart/form-data" action="//en/newsletter-subscription.html">
This is resolved as "http://en/newsletter-subscription.html" and doesn't work.
Updated by Gerrit Code Review about 9 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/44721
Updated by Gerrit Code Review about 9 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/44721
Updated by Björn Jacob about 9 years ago
- Status changed from Under Review to Needs Feedback
- Assignee set to André Spindler
Could you please try the following example form:
lib.actionTest = FORM lib.actionTest { name = subscriptionform method = post prefix = subscribe confirmation = 0 enctype = multipart/form-data # is interpreted as pageUid for backward compatibility action = 17 # overrides action actionUri { typolink.parameter = 16#anchor typolink.returnLast = url } postProcessor { 1 = mail 1 { recipientEmail = your@mail.com senderEmail = your@mail.com } } 10 = TEXTLINE 10 { name = surname placeholder = Surname required = 1 label { value = Surname } } 20 = SUBMIT 20 { name = submit value = Submit form } }
Updated by Carlos Meyer about 9 years ago
This doesn't work.
In my opinion we have to check if action is an 'int' value. If this so, it should mapped to pageUid else to actionUri.
In the example above two parameters (action and actionUri) are provided. I think we should prioritize actionUri?
Updated by André Spindler about 9 years ago
For me the example works. But I use the original 7.6.0 package, patch has not been applied.
The URL is as it should be.
But there is now another serious bug, which I have to report now. Form input from other pages seems not to be accepted.
Don't know if this is related to EXT:form or extbase.
Updated by Carlos Meyer about 9 years ago
Did you set config.absRefPrefix = / ?
I can confirm the // in my test environment. I use the current master branch.
Updated by André Spindler about 9 years ago
Yes, we use realURL but have no baseURL.
Updated by Carlos Meyer about 9 years ago
In my setup I don't use RealUrl. Please deactivate RealUrl and don't set baseUrl. Set only config.absRefPrefix = / .
Updated by Björn Jacob about 9 years ago
Right now I'm not able to get realUrl to work. I'm having a composer based installation. Which realUrl version do you guys use?
Updated by Carlos Meyer about 9 years ago
I use 1.13.4 also in composer mode. With or without realUrl the problem happened. Try this settings in your TS:
config.no_cache = 1 config.absRefPrefix = / page.15 = FORM page.15 { name = subscriptionform method = post prefix = subscribe confirmation = 0 enctype = multipart/form-data # is interpreted as pageUid for backward compatibility #action = 17 # overrides action action { typolink.parameter = 16 typolink.returnLast = url } postProcessor { 1 = mail 1 { recipientEmail = your@mail.com senderEmail = your@mail.com } } 10 = TEXTLINE 10 { name = surname placeholder = Surname required = 1 label { value = Surname } } 20 = SUBMIT 20 { name = submit value = Submit form } }
Don't use the patch.
To install realUrl or other extensions you has to set
"require": { "typo3/cms": "7.6", "typo3-ter/introduction": "^2.2" },
in your composer.json. With "typo3/cms" : "dev-master" it did not work in my case.
Updated by Carlos Meyer about 9 years ago
With "typo3/cms" : "dev-master" it did not work in my case. I mean RealUrl installation. ;-)
Updated by André Spindler about 9 years ago
Ok, for me this works, with and without realurl.
We are running TYPO3 7.6.0 here (NO composer install, original and unpatched source package).
config { absRefPrefix = / tx_realurl_enable = 1 } lib.component.footerNewsletter = COA lib.component.footerNewsletter { wrap = <div class="wrapper">|</div> 10 = FORM 10 { name = subscriptionform method = post prefix = subscribe confirmation = 0 action = {$lib.system.pages.formNewsletterSubscription} actionUri { typolink.parameter = {$lib.system.pages.formNewsletterSubscription} typolink.returnLast = url } 10 = FIELDSET 10 { 10 = TEXTLINE 10 { name = name layout = <label /><error /><input /> label = TEXT label { value = Vor- und Nachname lang.en = first and last name } placeholder = TEXT placeholder { value = Vor- und Nachname * lang.en = first and last name * } filters { 1 = alphanumeric 1 { allowWhiteSpace = 1 } } } 20 = TEXTLINE 20 { name = email layout = <label /><error /><input /> label = TEXT label { value = E-Mail Adresse lang.en = e-mail address } placeholder = TEXT placeholder { value = E-Mail Adresse * lang.en = e-mail address * } } 30 = SUBMIT 30 { name = subscribe value = TEXT value { value = Eintragen lang.en = Submit } } } } }
Updated by André Spindler about 9 years ago
So, now I have an additional bug in the generation of the action attribute.
don't know ig I should insert it here or create another ticket. Btw, ticket #71599 can be closed, as the error is form related. I will note that there.
What's wrong:
When using actionUri, the action parameter for the plugin is dropped out of the action URL.
Example: When actionUri is not defined at all, the tag is created as the following:
<form id="field-1" action="/de/newsletter-anmeldung.html?tx_form_form%5Baction%5D=process&cHash=a96dddfeea29668abfa4e12e84b5651d" name="subscriptionform" method="post" enctype="multipart/form-data">
Btw, cHash could be removed, I think.
When using the following config, I get the result:
action = {$lib.system.pages.formNewsletterSubscription} actionUri { typolink.parameter = {$lib.system.pages.formNewsletterSubscription} typolink.returnLast = url } <form action="/de/newsletter-anmeldung.html" id="field-1" name="subscriptionform" method="post" enctype="multipart/form-data">
But when action is not set, form does not process any data as it runs the default action which is "show" or something like that (haven't checked in the code).
For me I use this configuration no to get the newsletter form on each page working:
actionUri { typolink.parameter = {$lib.system.pages.formNewsletterSubscription} typolink.returnLast = url typolink.additionalParams = &tx_form_form[action]=process typolink.useCacheHash = 0 }
But in my eyes form is reponsible to insert this parameter into the action URI for its own as it is required.
Defining an action = process here also does not work, it seems like the default action and perhaps other parameters are ignored completely when actionUri is defined.
A solution of this could also be to implement the action for the controller always as post parameter in a hidden field. So there is no need to check for an action already included in the actionUri.
Updated by Björn Jacob almost 9 years ago
- Category changed from Form Framework to Caching
- Status changed from Needs Feedback to Closed
- Assignee deleted (
André Spindler)
I'm closing this issue since there is no problem within EXT:form. If the form viewhelpers are behaving strangly or the absRefPrefix setting is not working as expected, please open new issues and set the correct category (fluid or frontend respectively).