0

I am altering a form and placing a new 'button' . On the press of the button, using the #ajax property , I want to display 2 separate tables with checkboxes for each row. Each table has separate data.

The 2 tables should be initially hidden and should become visible on button press. How should I proceed with this ??

The table data is fetched from database and some operations are performed on it.. so where should I put this code ? In the callback function ?

Update- I tried to implement this by using tableselect, but the checked boxes aren't returning the values in the $form_state['values']. You can check out the code here or suggest me a simpler interface to implement.

  • I need more clarification of the question in order to properly answer. If I understand you correctly, I think I have a solution. I need more clarification with the most simplified code example that illustrates your problem. Please edit your question to reflect this. – Brandon Bearden Aug 15 '12 at 22:56
  • Please clarify your question or you can specify the code here and write where you get the problem – Naveen Valecha Aug 17 '12 at 7:28
0

You should not put the table-building code in the ajax callback. Put the code to build the tables into the hook_form_alter() implementation that you are using to add the button. You can use $form_state['triggering_element'] to tell if the button has been pressed, and only execute the query and build the tables if you need to.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.