Redirect Url -> does not forward all values

Questions and bug reports for current release of CKForms

Redirect Url -> does not forward all values

Postby Redshirt » Fri May 28, 2010 12:42 pm

I realized that the redirect function (if you want to postprocess your stuff on a site) does not push all values through.

The field names are fully transported over, some values are not.

The issue: if you have an array (i.e. select field) and the ckform wants to redirect that, it will encounter an array and try to concat that to the URL for redirection.

That's not working.

/components/com_ckforms/controller.php

Lines 103:
Code: Select all
100                         if ($ckform->redirectdata == 1)
101                         {
102                                 foreach ($post as $key => $value) {
103                                         $params = $params . '&'. $key.'='.htmlentities($value);
104                                 }
105                                 if (strlen($params) > 0 && strpos($ckform->redirecturl, '?') === false)
106                                 {
107                                         $params = '?'.substr($params, 1);
108                                 }
109                         }


And my fix:

Code: Select all
100                         if ($ckform->redirectdata == 1)
101                         {
102                                 foreach ($post as $key => $value) {
103                                         if (is_array($value)) $value=array_shift($value);
104                                         $params = $params . '&'. $key.'='.rawurlencode($value);
105                                 }
106                                 if (strlen($params) > 0 && strpos($ckform->redirecturl, '?') === false)
107                                 {
108                                         $params = '?'.substr($params, 1);
109                                 }
110                         }


I lose the key for the array, but well.
And htmlentities is not good for links - as it adds bad codes a link cannot process ( i.e. ä = ä) where & is not escaped.
Instead, rawurlencode does the trick.

I am not very fond of the fact that the entire info is not transferred via POST but via GET.

But well.

EDIT:
if will also break the Joomla url rewriting if it submits the "id" of the form.

Add after line 102
103 if ($key=="id") continue; //we do not need the ID, it will not work with url rewriting
Redshirt
 
Posts: 7
Joined: Fri May 28, 2010 12:31 pm
Top

Re: Redirect Url -> does not forward all values

Postby mikee » Sat Aug 14, 2010 4:51 am

Thank you worked like a charm !
mikee
 
Posts: 2
Joined: Tue May 11, 2010 1:56 pm
Top


Return to CKForms 1.3.x Support forum

Who is online

Users browsing this forum: No registered users and 1 guest