By voidengine on
Hi,
I'd like to return a user to a specific page after submitting a particular node edit form. I created a module to override $form['#action'] by appending a "?destination=" - but it didn't work. To make sure the edit was there, I put print_r($form) at the bottom of the tpl.php file I'm using to theme the form. Sure enough, $form['#action'] was set like I wanted it, but it still didn't work. I even used firebug to insert and test my override value, and it did work, so I know my syntax is ok.
I have no idea why this won't work - any suggestions?
Thanks,
Ray
p.s. Here's my module function:
function mymodule_form_alter($form_id, &$form) {
switch ($form_id) {
case 'profile_professional_node_form':
$u=arg(1);
$form['#action'] = "/user/" . $u . "/edit/profile_professional/?destination=user/" . $u . "/professional";
break;
}
}
Comments
Correction
I typed in the $form['#action'] value above incorrectly - there is no forward slash before the question mark - "...professional?destination=". Still doesn't work, although it shows up as being set in the $form variable.
Don't want to waste anyone's time...
I just tested this override on the generic page_node_form and it worked. I forgot to mention that my node is set up to be used as a node profile (module) and when I looked closer at the $form variable I saw that there are some functions defined in "after_build". I bet my override is being overridden there.