سؤال

I'm creating a summary view of products and prices, along with the ability to update the prices for each product (each product has 5 prices for various user roles).

I'm using AHAH to submit the specific product form, and have the form working great, including updating the old form with the new values and a message to say the jobs been done.

However, so far I can only update the one container (that which contained the submitted form) - this will mean that the view could end up with multiple success messages all over the place.

How to I get the AHAH system to update two containers - one for the form which was submitted, and one for the message (which will be a common container for all forms).

هل كانت مفيدة؟

المحلول

AHAH replaces the contents of the named wrapper with the 'data' value in the returned JSON response.

You could put all the items next to each other in one big wrapper, and then in your AHAH callback, call drupal_render for each form element as they should be shown, concatenating the outputs. e.g.:

$html = drupal_render($form['item1']);
$html .= drupal_render($form['item2']);
$html .= drupal_render($form['item3']);
drupal_json(array( 'status' => TRUE, 'data' => $html ));
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top