Bug #15286
closed
Problem with FORM action. Wrong action url
Added by Dmitry Pikhno almost 19 years ago.
Updated over 18 years ago.
Description
i'm trying to connect form object with some news element
so url of page with form and news looks like index.php?id=X&tx_ttnews[tt_news]=Y
but action in FORM looks like index.php?id=X.
ok. i can fix it via ts:
form = FORM
form.type=index.php?id=X&tx_ttnews[tt_news]=Y
but if realurl is enabled action url still looks like index.php?id=X&tx_ttnews[tt_news]=Y
(of course, realurl is configured for tt_news)
so i see 2 problems:
1) FORM doesn't include automatically GET params in action url
suggestion: lets add some flags (string or int).
smth like this:
form.includeAction = tt_news[tt_news], photo, ... // include these GETs in action
form.includeAction = 1 // include all GET params in action url
form.excludeAction = ..... ?
2) "type" property doesn't work properly with realurl - there is no
transformation, if "type" is string var
(issue imported from #M2046)
Please, take a look at my bug if you have time
If the action should point to the current page's URL, it might work to have an empty action attribute (yes, that's allowed in XHTML).
i know this Oliver, thnx :)
but i cannot force FORM object to generate empty action.
i'm talking about function FORM in class.tslib_content.php
Do you now some way to make empty action in FORM via ts?
After having a closer look at tslib_content::FORM, I haven't found a simple way to have an empty action. :-( Maybe we need to change that function?
Hi,
it isn't possible to say
form.action =
?
If not, maybe it is possible for you to implement this?
Greets, Sebastian
ok. i found solution
Manual(TSref) says that FORM.type is (int) or string var, but it doesn't say that FORM.type also uses stdWrap properties!
so in my case:
voteform.type.typolink.parameter.data = page:uid
voteform.type.typolink.addQueryString = 1
voteform.type.typolink.returnLast =url
but take care, "addQueryString" works only in >3.8.1(http://bugs.typo3.org/view.php?id=1770)
upd: as i just noticed my solution works only if realurl is disabled.
otherwise(realurl is ebabled), addQueryString doesn't see query string
it is strange because this is works fine with realurl
voteform.type.typolink.additionalParams=&tx_ttnews[tt_news]={GPvar:tx_ttnews|tt_news}
voteform.type.typolink.additionalParams.insertData=1
seems that realurl affects on $_GET but doesn't affect on $_SERVER[QUERY_STRING]
so i suggest ot use
$addQueryParams = $conf['addQueryString'] ? t3lib_div::implodeArrayForUrl('', t3lib_div::_GET()) : '';
instead
$addQueryParams = $conf['addQueryString'] ? '&'.t3lib_div::getIndpEnv('QUERY_STRING') : '';
( http://bugs.typo3.org/view.php?id=1770 )
So what is the problem now? As it seems, addQueryString does not work with RealUrl? If that would work, would it solve your problem?
yes. this will solve the problem with realurl
$addQueryParams = $conf['addQueryString'] ? t3lib_div::implodeArrayForUrl('', t3lib_div::_GET()) : '';
otherwise addQueryString works only with disabled realurl
I'll fix addQueryString to work with _GET instead of the enviroment varaible QUERY_STRING.
In 4.0 you can do this:
voteform.type.typolink.parameter.data = page:uid
voteform.type.typolink.addQueryString = 1
voteform.type.typolink.addQueryString.method = GET
voteform.type.typolink.addQueryString.exclude = cHash,someotherarg
voteform.type.typolink.returnLast =url
So I think we can close this bug.
The target attribute in the form tag says "{$PAGE_TARGET}" ... forgot something here?
That is caused by bug #15752. Will this solve your problem?
Does note #6509 and #6534 help you? IMHO the issues should be solved in the latest CVS version.
Seems like this was fixed already.
Also available in: Atom
PDF