I have a custom form which saves "weights" of nodes to a custom table. The form has an Ajax submit handler. The form is rendered in a table using
theme('table') and it has draggable handles added using
Because the form gets submitted via Ajax, the messages such as "Changes made in this table will not be saved until the form is submitted" and any other messages in the "message region" don't get cleared even if the form is submitted and the values are saved.
I've partially succeeded in solving this by returning an array of ajax commands from my callback function.
In particular I return the following commands:
$commands = array(); $commands = ajax_command_html('#page-banners-status', theme('status_messages')); $commands = ajax_command_remove('.tabledrag-changed'); $commands = ajax_command_remove('.tabledrag-changed-warning');
but I've run into a new problem where now, even though the "Changes made in this table will not be saved until the form is submitted" message is removed after the save, it doesn't come back if the table is further modified after the save. I've tried to grab the form again and pass it back using an ajax command:
// my form function receives additional parameters $form = drupal_get_form('my_custom_form', $path, $tid); $commands = ajax_command_html('.table-container', drupal_render($form));
But whenever I call drupal_get_form from the callback function, it seems to break the function.