Greetings,

I'm trying to use ajaxsubmit.module from jstools.module
Both of them are enabled and here is the piece of code to alter all node edit forms:

function my_form_alter($form_id, &$form)
{
	if ('node-form' == $form['#id']) {
		$form['#ajaxsubmit'] = TRUE;
	}
}

Actually, I don't see it is submitted through AJAX... May be I'm missing something.
How should it work here ? Ort may be I'm using this incorrectly ?

Thanks.

Comments

nedjo’s picture

Node forms get an id that includes the node type, e.g., 'page_node_form'. And you probably want to test $form_id. If you want to affect all node types, I suppose you could test against the node/add/type portion of the url. Try:

function my_form_alter($form_id, &$form) {
  if ($form_id == arg(2) .'_node_form') {
    $form['#ajaxsubmit'] = TRUE;
  }
}

A simple addition to ajaxsubmit.module would be to auto attach the behaviour via a UI, as we do with the formcheck.module.

ardas’s picture

Okay, I've found the problem ... The was another problem

But another one occurs :) When page content is big it is scrolled down. After I press Submit button and it is saved all content is broken because of scroller. Have you seen this before ?

----------------
Regards,
Dmitry Kresin, ARDAS group (www.ardas.dp.ua)

bharanikumariyerphp’s picture

Hi

Is it possible to add form submit using ajax