Welcome Guest, Not a member yet? Register   Sign In
Search function help
#1

[eluser]mattoebs[/eluser]
Hi, I have a project that use's code igniter, I have search forms but when you search,view the resutls and then go back to search it doesn't clear the last search, is there a way i can force the search to refresh on page load?
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums!

It might be possible through using a location redirect, but you will lose the page entirely in the history.

The only alternative I can think of would be to use some JavaScript to reset the fields on window.load. I'm not sure if it'll work, and it would rely on your users having JavaScript enabled.

However, this is a browser feature that's desirable for many users. Perhaps it'll be best if you let them decide whether that want the feature enabled or not?

Oh, and there is the [url="http://www.w3.org/Submission/web-forms2/#the-autocomplete"]autocomplete attribute[/url].
#3

[eluser]mattoebs[/eluser]
How can I put a link on the page that will clear their search so they can perform a new search?
#4

[eluser]TheFuzzy0ne[/eluser]
Just use a button in your form like this:
Code:
<input type="reset" value="Clear the form" />

By default it will reset the forum when clicked. Please note that this simply reverts the form controls back to their initial value. If you have a form that has it's value attribute set to anything other than "", that value will show in the form control when it's reset.
#5

[eluser]mattoebs[/eluser]
I'm getting confused now.

At the moment, when someone search the web site the first search works then every other search performs the original search. I basically need to reset the search parameters after each search
#6

[eluser]TheFuzzy0ne[/eluser]
You're confusing me now, too. OK. Let's see your code please. I think that you might be using the form validation library incorrectly, and that might be causing the problem.
#7

[eluser]mattoebs[/eluser]
You can see it in action here : http://web233.extendcp.co.uk/grapevinerecruitment.com/
#8

[eluser]TheFuzzy0ne[/eluser]
Unfortunately, seeing:
Quote:load->model('content_model'); $this->mysmarty->assign('blocks', $this->content_model->get_blocks_by_page('home')); //categories $this->load->model('categories_model'); $this->mysmarty->assign('categories', $this->categories_model->get_all_entries()); //worktypes $this->load->model('worktypes_model'); $this->mysmarty->assign('worktypes', $this->worktypes_model->get_all_entries()); //locations $this->load->model('locations_model'); $this->mysmarty->assign('locations', $this->locations_model->get_all_entries()); // $this->load->model('vacancies_model'); $this->mysmarty->assign('lj', $this->vacancies_model->get_last(5)); // $this->mysmarty->assign('content','welcome.tpl'); $this->mysmarty->view('template.tpl'); } } ?>

404 Page Not Found

The page you requested was not found.

Is not very helpful in solving your problem...
#9

[eluser]mattoebs[/eluser]
it's cleared now, was migrating my PHP version :o(




Theme © iAndrew 2016 - Forum software by © MyBB