The tip is about simulation of picklist on the Web with search facility.
One of my clients required an application in one of its pages that, when he clicks on 'A', he should get all entries of organizations details starting with 'A' in different columns like picklist. After displaying that list, he wanted to select one of them, and like picklist, the value should populate a field in the form.
Code
For that, the following things have to be created:
1.Create an agent with db.search(fuzzy) which takes an string to search the document Put the collection in a folder. Don't forget to remove old documents from the folder before putting new value to it.
********************************
Initiate this agent with every letter with that string for eg. for A-"A*", for B-"B*" etc
********************************
2.The folder design must have checkbox/radio in the first column as written in html.
*********************************
3.Write a function in a form in that function--just use JavaScript to populate window.opener fields.
*****************************
4. Embed that folder in this form.
5. On click of that checkbox/radio fields call that function.
***********************************
6. Now come to the form from where you want to start this process.
************************************
7. Put a button just beside that field, and there write your javascript window.open with parameters.
************************************
8. Pass parameters for opening the form where your folder is embedded.
********************************
9. First line of the form will show A-Z grid having an action hotspot which runs that agent with its letter parameter.
***************************************
10. When someone clicks on A, the agent runs with a parameter that puts the docs in folder.
****************************************
11. The output comes as organization name, address, city...as many columns you add to the doc with a checkbox option.
***********************************
12.When the user clicks on any checkbox, the function written on the JS header comes in action which takes parameter from a document(view column) and makes it available to function.
**************************
13. This parameter is sent to the window.opener to populate a field.