PDA

View Full Version : Dynamic select and show results



markus69
02-02-2008, 04:16 PM
Hi,

i would want implement on my site a similar script of this: click (http://www.online-betting-guide.co.uk/school/tools/bookmaker_search.php)

I have a page with a list of books divided for language (english,italian,dutch and spanish). I want create a dynamic list for choise the desired language and show the result in the same page.

Can you help me ?

Thanks !

markus69
02-06-2008, 12:53 PM
up.........

BYK
02-07-2008, 07:25 PM
You may do that with an AJAX call where the server filters the book list OR you can keep the list as a Javascript array then filter and show the list.

candidnj
05-14-2008, 03:43 PM
can you please tell how to do this using ajax as i am new to ajax and i also have such requirement in my project. i am using ajax+struts

BYK
05-14-2008, 06:36 PM
What do you use for AJAX?

candidnj
05-15-2008, 03:35 AM
hi!!
i have a jsp page where on click on a button a new window gets opened up which contains data retieved from the database. also there is a text box on top with label where if user enters any character then corresponding to that character the data should get filtered in that table.
eg:
there is a button on index.jsp. click on this button results in the pop up of the child window where a table gets created containing the data retrieved from the database. also there is a text box on top where now if user enters any character data in the table gets filtered corresponding to that character(s)
eg:

<input type="text" name="text">(text box on the child window)
|------------------|
S.No. CityName
1 Delhi
2. Mumbai
3. Jaipur
5. Jodhpur
6. kolkata
(all these values are stored in the database and retrieved in a query) now my requirement is that if user enters J then all the cities starting with J should get displayed on the same page. I am using ajax for this but i need a javascript solution for doing this.

output should be:
S.No. CityName
3. Jaipur
4. Jodhpur

i am using ajax and struts.i want to know how can the data retrieved from the action class be displayed. please help me solve this problem.thanks in advance

codeexploiter
05-15-2008, 08:31 AM
I think you are looking for mixing AJAX and auto-suggest feature together for your purpose. As already mentioned you have to use AJAX for retrieving the state names in run-time from server. In order to work with AJAX you need to write code in a cross-browser compatible manner. You can use any freely available JS framework that makes AJAX operations simple for a beginner
http://developer.yahoo.com/yui/connection/

For the auto suggest part you can have some freely available JavaScript for that purpose. Have a look at the following link which shows some examples for auto suggest/auto complete functionality.
http://developer.yahoo.com/yui/autocomplete/

If you are looking for some AJAX tutorial please mention that here.

candidnj
05-15-2008, 06:16 PM
Thanks for the prompt response. let me put some details regarding what i am looking and how am i thinking of doing it. let me know if it is by any chance possible or not.

i have a jsp page where each field has a button associated with it. on click to that button a child window opens up and it shows a dynamic table which consists data fetched from the database based on the name of the field(textbox).

flow of my project is:
jsp->struts(action class)->ejb(bean class)->action class-> result(jsp page)
i want to integrate ajax with it.

now what i wish to do is apply the filter property on the child window.
when the user enters any text then onkeypress a fuction retrieveURL() gets called from where action class is being called.

the problems i am facing are:
1. on executing the action claas i not getting recognized. the error it shows is invalid action path.
2. my 2nd problem is how will i post the data which i retained in a 2d array corresponding to the text entered by the user on the jsp.

please help me solve this problem
thanks

candidnj
05-15-2008, 06:26 PM
Thanks for the prompt response. let me put some details regarding what i am looking and how am i thinking of doing it. let me know if it is by any chance possible or not.

i have a jsp page where each field has a button associated with it. on click to that button a child window opens up and it shows a dynamic table which consists data fetched from the database based on the name of the field(textbox).

flow of my project is:
jsp->struts(action class)->ejb(bean class)->action class-> result(jsp page)
i want to integrate ajax with it.

now what i wish to do is apply the filter property on the child window.
when the user enters any text then onkeypress a fuction retrieveURL() gets called from where action class is being called.

the problems i am facing are:
1. on executing the action claas i not getting recognized. the error it shows is invalid action path.
2. my 2nd problem is how will i post the data which i retained in a 2d array corresponding to the text entered by the user on the jsp.

please help me solve this problem
thanks