• Hi,

    Can anyone tell me how can I save options for the fields on paginated pages I mean if some options are changed and saved on one page then other options on other pages don’t get disturbed.

    I created a pagination in my plugin but when I save options for example on page 2 the options on page one get reset automatically and I want to fix this.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You need to have a separate form for each page, and the user would need to save any changes before proceeding to the next page. Some javascript to throw up a reminder if any fields were changed and not saved would be a good idea.

    That is the generic answer, but there are other possible approaches. For example, all the pages are actually a single page, what is visible is managed with javascript and CSS. When the settings are saved, all the “pages” are saved together because they actually are all a single form on a single page.

    Another approach would be to save each field on the change action using AJAX. Thus there is no need for a submit button, any change is automatically saved immediately.

    Thread Starter Usman Ali Qureshi

    (@usmanaliqureshi)

    bcworkz, Thank you for your reply. I have been waiting for an answer for about 3 days. I already resolved this issue by using jQuery to show the fields just like in pagination.

    Your ideas are good. I appreciate you for replying with some good suggestions.

    Can you guide me a little bit more about using different forms for each pagination pages?

    Thanks once again,

    Usman

    Moderator bcworkz

    (@bcworkz)

    I’m not sure what more to tell you. Each page having its own form and its own submit button I thought was self explanatory. What might be less clear is handling the submits. What’s done depends on if the submits all go to one place or their own separate page.

    Again, submits to separate pages should be self explanatory, it’s no different than submits from and to unrelated pages. If you want all submits to be processed by the same code page, you might consider a switch/case or if/elseif/else logic structure that tests for the existence of certain $_POST keys to decide which form to process.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Saving options on paginated paged’ is closed to new replies.