chris.paschen
Chris Paschen
I've got a bunch of 'stuff' that I am doing in a PHP file plugin called from the form onAfterProcess.
One of the things that this does is to manually (via a database update query) updates a 'profile_complete_status' field.
When a user clicks the save button I would really like them to be redirected to a different page based on the status of that field.
I created a redirect plugin on the form (when the form is flagged complete):
* do: redirect
* In: front end
* On: Both
* Jump page: a URL on the current site
* Save and Next: No
* Append jump url with data: No
* Condition:
if ('{ked_books_books___profile_complete_status_raw}' == '1')
{
$status = 1;
} else {
$status = 0;
}
return $status;
The redirect works fine without a condition. And it works fine IF the status field is already set to 1 (prior to the run of the onAfterProcess code).
However, if the value of that status field gets saved during the SAVE button click, then the redirect code doesn't see the changed field.
I'm guessing that I'm just running up-against the fact that the redirect form plugin is running AFTER the onAfterProcess code.
If that's the case, is there a different point to process my script so that it would run before the redirect plugin BUT after the form would have saved data to repeat groups (i.e. a databasejoin element with multiple select that is saved to a _repeat## file)?
[One of the things that my custom php script file does is do a count of how many items are selected in different databasejoin fields and then does some calculations based on that.]
Any ideas?
One of the things that this does is to manually (via a database update query) updates a 'profile_complete_status' field.
When a user clicks the save button I would really like them to be redirected to a different page based on the status of that field.
I created a redirect plugin on the form (when the form is flagged complete):
* do: redirect
* In: front end
* On: Both
* Jump page: a URL on the current site
* Save and Next: No
* Append jump url with data: No
* Condition:
if ('{ked_books_books___profile_complete_status_raw}' == '1')
{
$status = 1;
} else {
$status = 0;
}
return $status;
The redirect works fine without a condition. And it works fine IF the status field is already set to 1 (prior to the run of the onAfterProcess code).
However, if the value of that status field gets saved during the SAVE button click, then the redirect code doesn't see the changed field.
I'm guessing that I'm just running up-against the fact that the redirect form plugin is running AFTER the onAfterProcess code.
If that's the case, is there a different point to process my script so that it would run before the redirect plugin BUT after the form would have saved data to repeat groups (i.e. a databasejoin element with multiple select that is saved to a _repeat## file)?
[One of the things that my custom php script file does is do a count of how many items are selected in different databasejoin fields and then does some calculations based on that.]
Any ideas?