0

I have a view of node teasers. I have added custom form to every teaser. Form is submitted via Ajax (in theory).

Code for submit button:

$form['my_module_form']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Send'),
    '#ajax' => array(
      'callback' => 'my_module_form_ajax_callback',
    ),
  );

Form is added in hook_node_view like:

$content['my_module_form'] = drupal_get_form('my_module_form', $node);

Anyway after loading content by autopager ajax event isn't attached to any of new forms.

I looked to the views_infinite_scroll.js and events are attached:

Drupal.attachBehaviors(this);

but it doesn't work in my case.

Ajax works like expected on content loaded via normal page refresh. Forms from content loaded via pager, submit only as a normal request (no ajax)

I have posted it in module issues, but without any feedback, so I'm trying here.

  • In 7 it's named AJAX, not AHAH. Just saying. – Mołot Dec 30 '13 at 12:42
  • @Mołot - didn't know, thx – Codium Dec 30 '13 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.