Welcome, Guest

redirecting to the same page with url parameters
(1 viewing) (1) Guest

TOPIC: redirecting to the same page with url parameters

redirecting to the same page with url parameters 3 years, 9 months ago #153

I migrated my site to joomla 1.5 with the native beta version of BreezingForms (1.5.1b) in just an hour, so that's fantastic. The forms seem to look ok at first sight.

However there is still a complication. My forms are calculators. When a user presses a Compute button then some javascript code is triggered doing some computations. This javascript code also makes a url to show the same page. In the url there are parameters containing the values that were computed by the javascript code. When the page is redirected to the same page with some url parameters then first then php code does some more computations and the form is shown again with the results from both the javascript and the php computations.

The problem is that the javascript code to pass parameters to the form does not seem to work.

Before the javascript code to pass parameters to the form again was the following
function rvbCommon_GenerateRedirectUrl(pageNr)
{
    <?php
      $content_id = ff_getParam(\'ff_contentid\');
      if (is_numeric($content_id))
        return \"var id =\".$content_id.\"; \";
      else return \"var id = \'not_called_by_mambot?\';\";
    ?>

    <?php
      global $Itemid;
      return \"var Itemid =\".$Itemid.\"; \";
    ?>

   return \'{mossite}/content/view/\' +
          escape(id)+
      \'/\' +escape(Itemid) +
      \'?ff_page=\' +escape(pageNr)

} // rvbCommon_GenerateRedirectUrl


.....

ff_redirectParent(rvbCommon_GenerateRedirectUrl(1)+'&ff_param_compButtonPressed=1'+'&ff_param_gender='+escape(gender)+'&ff_param_wearsGlasses='+escape(wearsGlasses)+
'&ff_param_age='+escape(age)+'&ff_param_distancePower='+escape(distancePower);


It seems that BreezingForms does not execute the php code in the javascript function any more.
Before with facileForms the html output was
function rvbCommon_GenerateRedirectUrl(pageNr)
{var id=11;var Itemid=9;return 'http://rvb11.com/content/view/'+escape(id)+'/'+escape(Itemid)+'?ff_page='+escape(pageNr)
}


With BreezingForms the html output is:
function rvbCommon_GenerateRedirectUrl(pageNr)
{return\'http://rvb15.com/content/view/\' +escape(id)+\'/\' +escape(Itemid) +\'?ff_page=\' +escape(pageNr)
}



Apart from this issue I found that forms with unspecified height (Auto) are not correctly displayed. For me this is not that important, I can just fix the height of my forms.


Another bug with 1.5.1b is that links to categories and sections in the main menu seem to break when using the BreezingForms plugin. This bug has already been reported,
http://www.crosstec.de/forums.html?func=...p;id=140&catid=5.
Typing in the section url's directly does not work either, and disabling the BreezingForms plugin is not an option for me.

A last showstopper is
www.crosstec.de/forums.html?func=view&am...tid=5&id=156#156:
Every time a form element with javascript code is saved in the backend a backslash is added in front of every quote. I don't think this backslash problem is related to the first problem: that php code is not evaluated in javascript scripts (and in html text elements)
Last Edit: 3 years, 9 months ago by mathdeveloper. Reason: found another bug

Re:redirecting to the same page with url parameter 3 years, 9 months ago #166

After yesterday's update of the BreezingForms component from v1.5.1b to v1.5.1b1 I got my first two forms working.

Thanks so much for BreezingForms and these fast fixes, I did not expect that my upgrade to joomla 1.5 would be working so soon !

As you posted in another thread I changed the header of botFacileForms in botFacileForms.php to

function botFacileForms($contentObj, /* JParameter */ $row, $mask=0, $page=0)


I had to change my javascript code for redirecting to the same url slightly. Redirecting the url now works for me, even when using search engine friendly url's. This change reflects the upgrade from joomla 1.0.x to 1.5.x:

function generateRedirectUrl(pageNr)
{
    <?php
      $content_id = ff_getParam('ff_contentid');
      if (is_numeric($content_id))
        return 'var id ='.$content_id.'; ';
      else return "var id = 'not_called_by_mambot?';";
    ?>
    <?php
      global $Itemid;
      return 'var Itemid ='.$Itemid.'; ';
    ?>

   return '{mossite}/index.php?view=article&id=' +
          escape(id)+
      '&option=com_content&Itemid=' +Itemid +
      '&ff_page=' +escape(pageNr);

} // generateRedirectUrl




............

   ff_redirectParent(generateRedirectUrl(1) +
     '&ff_param_compButtonPressed=1' +
     '&ff_param_age=' +escape(age)
   );


Although this page redirect works I still see the following error message in the server log file:

[Sun May 04 09:57:46 2008] [error] [client 127.0.0.1] PHP Notice:  Undefined variable: Itemid in D:\\website15\\components\\com_facileforms\\facileforms.php on line 118, referer: http://rvb15.com/index.php?view=article&id=13&option=com_content&Itemid=33&ff_page=1


If I change line 118 in facileforms.php into the following this error message goes away:

	if (isset($Itemid) && $Itemid > 1) {


My feeling is that the error message has something to do with that Joomla protects itself from injecting php variables into url's.

I also see the following error message in the log file:

[Sun May 04 09:58:50 2008] [error] [client 127.0.0.1] PHP Notice:  Undefined variable: mosConfig_lang in D:\\website15\\components\\com_facileforms\\facileforms.process.php on line 11, referer: http://rvb15.com/index.php?view=article&id=13&option=com_content&Itemid=33&ff_page=1
Last Edit: 3 years, 9 months ago by mathdeveloper.

Re:redirecting to the same page with url parameter 3 years, 9 months ago #167

no problem mate, just keep on reporting issues ,)
  • TheMuffinMan

Re:redirecting to the same page with url parameter 3 years, 9 months ago #168

I have edited my previous posting with two extra error messages. These are not really important but still good to get on a sort of to-do list.

Re:redirecting to the same page with url parameter 3 years, 9 months ago #171

I think the original authot expected the $Itemid to be accessible if register_global is set to on.

pleaase check if it is on. if it is you could try to replace the $Itemid that causes the notice with this

JRequest::getVar( 'Itemid', -1)

I bet it will be gone then, hopefully ,)
  • TheMuffinMan
Last Edit: 3 years, 9 months ago by .

Re:redirecting to the same page with url parameter 3 years, 9 months ago #174

it really was like that that it expected register_globals = on such the $Itemid can be seen.

when you know grab the upgraded package you will notice that menulinks now work! (it was exactly that problem that caused it!)

thank you so much!
  • TheMuffinMan
Last Edit: 3 years, 9 months ago by .
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.39 seconds

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany