Hello, I'm requesting a feature that when a node form is submitted, it does not go to the new page. But simply submits and says [title] posted. The page isn't reloaded.

Thanks.

Comments

brendoncrawford’s picture

Assigned: Unassigned » brendoncrawford
Category: feature » bug

This would be a bug, not a feature request. So I can fix this, I need you to post two things:

1) Exported CCK content type

2) Firebug console AJAX dump

Thanks,
Brendon

ManyNancy’s picture

Hi, this is the case for all content types, including the out of box ones.

I see POST something in firebug, but then it immediately goes to the page that is posted, so there's no way for me to see what it actually says. Ajax validation works though, just the go to new page behavior is undesired.

Also, how would you export a content type?

brendoncrawford’s picture

Category: bug » feature
Status: Active » Closed (won't fix)

Minqensan,

Oh, I see what you are saying. I misunderstood your request.

My intention is to not interfere with Drupal's default behaviour. Adding this kind of functionality would definitely interfere with Drupal default behaviour. If you want to achieve this functionality, you can add this to your own module, where 'foo' is the name of your module, and 'baz' is the name of the content type you wish to alter:


function foo_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id === 'baz_node_form') {
    if (array_key_exists('redirect', $form_state)) {
      $form_state['redirect'] = NULL;
    }
    if (array_key_exists('destination', $_GET)) {
      unset($_GET['destination']);
    }
  }
}

brendoncrawford’s picture

Priority: Normal » Minor
Status: Closed (won't fix) » Fixed

Minqensan,

Here is another possible solution that will now work. You can make a JavaScript plugin which handles the actions to perform. This is available in 6.x-1.x-dev which will be updated within 12 hours.

Drupal.Ajax.plugins.FOO = function(hook, args) {
  if (hook === 'complete') {
    if (args.form_id === 'SOME_FORM_ID') {
      alert("Form submission is complete");
      // If this returns false, no redirection will occur
      return false;
    }
    else {
      // redirection will occur
      return true;
    }
  }
  return true;
}

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.