Redirect field not being set correctly in latest webform
vector0319 - October 1, 2008 - 02:02
| Project: | SugarCRM Webform Integration |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
The redirect field url was always defaulting to the node done page when I entered anything into the confirmation/redirect text box after updating to the latest webform-5.x-2.1.3 in drupal 5.7. I think some of the webform node info changed so I modified the sugarwebform.module a bit to make it work for me. Here is the original block:
if (valid_url(trim($node->confirmation), true)) {
$redirect = trim($node->confirmation);
}
elseif (preg_match('/^internal:/', $node->confirmation)) {
$path = preg_replace('/^internal:/', $base_url .'/', $node->confirmation);
$redirect = trim($path);
}
else {
// create an absolute URL for the SugarCRM lead capture page to send the user back to
$redirect = url('node/'. $node->nid .'/done', NULL, NULL, TRUE);
}and I changed it to:
$confirmation = $node->webform["confirmation"];
if (valid_url(trim($confirmation), true)) {
$redirect = trim($confirmation);
}
elseif (preg_match('/^internal:/', $confirmation)) {
$path = preg_replace('/^internal:/', $base_url .'/', $confirmation);
$redirect = trim($path);
}
else {
// create an absolute URL for the SugarCRM lead capture page to send the user back to
$redirect = url('node/'. $node->nid .'/done', NULL, NULL, TRUE);
}Working ok for me. Will do some more testing though.

#1
Thank you Vector, that worked for me too :)