[TYPO3-dev] search form looses id

Richard Davies richard at ocular.co.nz
Thu May 31 00:59:52 CEST 2012


Hi Robert,

I didn't think about the GET value being part of the action. See
http://stackoverflow.com/questions/1116019/submitting-a-get-form-with-query-string-params-and-hidden-params-disappear
Short answer: any GET values in an action with a method of GET may be
ignored.

Richard

On 31 May 2012 10:39, Robert Wildling <robertwildling at gmail.com> wrote:

> Thank you, Richard, for your response. I still have to try the Tamper Data
> thing on FF, at the moment I am on Chrome. However, the form is not nested,
> the URL generated correctly.
>
> But what I observed today was this: when the form action is set to "GET"
> the id gets lost, while other parameters are sent; as soon as i set the
> form action to POST, it is the other way around: the id stays within the
> form, while category and province get lost (the search result jumps back to
> a list with all records...)
>
> ???
>
> Any inputs would be very welcome! Thanks in advance!
> Regards,
> Robert
>
>  Hi,
>>
>> The link in<form action="' . $searchResultPageLink . '" method="GET">  is
>> being generated correctly? Is the correct URL sent? If you use firefox,
>> use
>> something like Tamper Data to view what is being sent to the server.
>>
>> The issue may be that you accidentally nested your form inside another
>> form. This is obviously not allowed - however FF sends the outer form
>> action, hence why you wouldn't see the id value being carried across.
>>
>> Richard
>>
>> On 27 May 2012 07:11, Robert Wildling<robertwildling at gmail.**com<robertwildling at gmail.com>>
>>  wrote:
>>
>>  Hi,
>>>
>>> I really beg for your help!!!
>>>
>>> An ext generates a form like this.
>>>
>>> ...
>>>        function main($content, $conf) {
>>>                $this->conf = $conf;
>>>                $this->pi_setPiVarDefaults();
>>>                $this->pi_loadLL();
>>>
>>>                // Database tables
>>>                $categoryTable = 'pages';
>>>                $categoryPid = 3;
>>>                $provincesTable = "static_country_zones";
>>>                $provincesArea = 'zn_country_iso_2="AT"';
>>>
>>>                $manufacturerPid = 10;
>>>                $searchResultPagePid = 89;
>>>
>>>                // Link generation for the action attribute of the form
>>> tag
>>>                $searchResultPageLink = $this->pi_getPageLink($**
>>> searchResultPagePid);
>>>
>>>                // Generate the search form - 1.: Categories
>>>                $content .= '<form action="' . $searchResultPageLink . '"
>>> method="GET">';
>>>                $content .= '<select name="category" id="selectCat">';
>>>
>>>                // Get first level of the categories
>>>                $selectManufacturers = $GLOBALS['TYPO3_DB']->exec_**
>>> SELECTquery('*',$****categoryTable,'pid='.$****categoryPid,'','','');
>>>                $numManufacturers = $GLOBALS['TYPO3_DB']->sql_num_****
>>> rows($selectManufacturers);
>>>
>>>                $i = 0;
>>>                while ($res = $GLOBALS['TYPO3_DB']->sql_****
>>> fetch_assoc($**
>>> selectManufacturers))
>>>                {
>>>                        $content .= '<option value="' . $res['uid'] .'"';
>>>
>>>                        // if category is set, set the chosen record to
>>> selected
>>>                        if((t3lib_div::_GET('category'****) != '')&&
>>> (t3lib_div::_GET('category') != 'divider')&&
>>>  (t3lib_div::_GET('category')
>>>
>>> == $res['uid'])) {
>>>                                $content .= " selected='selected'";
>>>                        }
>>>                        $content .= '>' . $res['title'] .'</option>';
>>>
>>>                        // Get second level of the categories
>>>                        $sel = $GLOBALS['TYPO3_DB']->exec_**
>>> SELECTquery('*',$****categoryTable,'pid='.$res['****uid'],'','','');
>>>                        while ($res2 = $GLOBALS['TYPO3_DB']->sql_****
>>> fetch_assoc($sel))
>>> {
>>>                                $content .= '<option value="' .
>>> $res2['uid'] . '"';
>>>
>>>                                if((t3lib_div::_GET('category'****) !=
>>> '')
>>> &&  (t3lib_div::_GET('category') != 'divider')&&
>>> (t3lib_div::_GET('category') == $res2['uid'])) {
>>>                                        $content .= "
>>> selected='selected'";
>>>                                }
>>>                                $content .= '>- ' . $res2['title'] .
>>> '</option>';
>>>                        }
>>>
>>>                        $i++;
>>>                }
>>>                $content .= '</select>';
>>>
>>> ... (2nd select box)
>>>
>>>                // Search Button
>>>                $content .= '<input type="submit" value="' .
>>> $this->pi_getLL('submit_****button_label') . '" />';
>>>
>>>                // close form tag
>>>                $content .= "</form>";
>>>                $content .= '</div>';
>>>
>>>                return $content;
>>>        }
>>>
>>>
>>> After clicking on the search button, the id, which is saved in
>>> $searchResultPagePid and correctly generated as a link in
>>> $searchResultPageLink, gets "lost", while the parameters (category=xy)
>>> are
>>> part of the URL.
>>>
>>> What am I doing wrong here?
>>> config {
>>>  linkVars = L, print
>>>  uniqueLinkVars = 1
>>> }
>>>
>>> is set ...
>>>
>>> Any ideas? Please!
>>>
>>> Thank you very much!
>>> Robert
>>> ______________________________****_________________
>>> TYPO3-dev mailing list
>>> TYPO3-dev at lists.typo3.org
>>> http://lists.typo3.org/cgi-****bin/mailman/listinfo/typo3-dev<http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-dev>
>>> **<http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-dev<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev>
>>> **>
>>>
>>>
> ______________________________**_________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-dev<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev>
>



More information about the TYPO3-dev mailing list