0

I have a custom form where I use a tableselect, and a couple of textboxes and checkboxes. The query for the tableselect is extended using TableSort and PagerDefault.

I noticed that when the user sorts a column, or goes to another page (using the pager), Drupal does a simple redirect which wipes all values in the textboxes and checkboxes.

This even occurs when looking at the inbuilt /admin/content screen.

I can't really expect the user to sort and page the table, and then enter textbox values. And sorting and paging is pretty standard functionality. Is there anyway around this?

0

No there's no in-built way around this. The tablesort and pager functionality works by providing links to new pages. When you link to a new page, any values you have in form elements on the previous page will not exist any more, unless they've specifically been persisted to the session and then picked up again on the new page load (this is a browser issue and nothing to do with Drupal).

The easiest thing you can do is implement AJAX for your pager/sort links which invokes the content area of the page to reload rather than navigate when they're clicked. Then your form elements will remain untouched.

Your Answer

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