dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: filter search results by clicking checkboxes

  1. #1
    Join Date
    Aug 2009
    Posts
    13

    filter search results by clicking checkboxes

    Hey there everyone.

    I'm a bit of a newb with javascript and php so apologies if this question is a bit simple, although I can't get my head round how to go about doing it.

    I have a search page where a user can type in a search box, or they can use an alphabetical list to search for the record they're looking for. Eg they click 'a' and all the records beginning with the letter 'a' appear.

    I'd also like to have it so that each record has a number of tags, and I'd then like to be able to filter records according to which tags have been selected - preferably using checkboxes.

    For example, perhaps the tags would be colours and the records represented shoes. There'd be checkboxes for blue, yellow, black, brown and so on. At first all colours would be shown, but if the user clicks on brown the all but the brown shoes dissappear.

    like I say, I'm new to learning php so please be gentle. Also I'm using Cakephp so if there's anyway to make it easier using Cake then I'd love to know.

    thanks

  2. #2
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    I think that would be more of a database/server-side language question than a JavaScript question. You want to filter the search according to what checkboxes are checked - that's done SQL-side (unless the query is being generated in PHP, then it's server-side), not client-side.

    Unless I miss something in your question.

  3. #3
    Join Date
    Aug 2009
    Posts
    13
    So I've made the list and been advised that I should use 'observerform' call on the page that runs whenever the form is changed'

    I've googled observerform but haven't been able to figure out what exactly to do since I'm totally new to javascript.

    Can anyone give me a bit of a road map on how to do this? I don't get how to attach the javascript to the form and how to make it call a function to run the query

    I did find http://stackoverflow.com/questions/2...ultiple-fields which has a bit of javascript which might help but from what I've learned about cakephp there is probably a much better way of doing this.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles