Welcome Guest, Not a member yet? Register   Sign In
Submit a form from Pagination link
#1

[eluser]Jim Higgins[/eluser]
Is there a way to submit a form when a Pagination link is clicked? And, if so, is there a way to do it without modifying the core Pagination class?

Basically, I have a search form on a page that displays search results and has pagination links. If something changes in the form and a user clicks a pagination link rather than the submit button, I'd like to run them through the controller and be able to read the new POST input. However, if the form does not submit when the pagination link is clicked, the controller does not recognize any new POST inputs. I know I'm missing some very easy solution here, but my brain is a bit sleepy right now.

My instincts tell me to add a Javascript submit to each of the pagination links onclick. However, from what I can tell, this would require modifying the Pagination class.
#2

[eluser]GSV Sleeper Service[/eluser]
you could use unobtrusive javascript (jquery, prototype, mootools etc) and attach a form submit to the onclick event of your pagination links.
#3

[eluser]xwero[/eluser]
It seems a bit confusing to me. Lets say one search creates 10 pages and the form is changed on the fifth page but the changed search only generates 3 pages the viewer is going to be redirected to the first or third page?

I think submitting a search and pagination are two different functions. The pagination is only valid for the search that is submitted.
#4

[eluser]frenzal[/eluser]
i agree, new search = new pagination
#5

[eluser]xwero[/eluser]
Of course a new search requires a new pagination but what i wanted to say is pagination links and the submit button are two different things. With the pagination you browse through the search results. Mixing this with submitting a search is confusing.

I understand you want to assist your users but I think a user would be helped better by a message - Your search has changed. Do you want to submit a new search - rather than an implicit search submit. I think this behavior will be rare because if you change the search you will submit a new search rather than clicking on a pagination link.
#6

[eluser]CI_Newb[/eluser]
First of all, sorry for bringing this thread back from the dead but this situation is what i'm dealing with right now.

On my search page
[search form with lots of fields}
[table that displays pagination and results]

Now a user fills out the form and it submits to the results function which gathers the results and loads the pagination.

Page reloads properly with the query results and the proper pagination links. But if the user clicks on a pagination button, it is set to reload the page but since no form was submitted, it basically queries the table with no criteria from the search form and pagination breaks.

What I thought of to solve this was to make a hidden form that stores the values from the search form and if a user clicks a pagination button, it submits that hidden form back to the results controller. Only problem is I can't figure out how to submit that form.




Theme © iAndrew 2016 - Forum software by © MyBB