Why would you need to do this?
Until recently, I'd have been at a loss to give you a good reason. Now however, since I've decided to modify some databases for Mobile Phone use, I have a very good reason.
Suppose that you want your database to be searchable via the web and also searchable via mobile.
Working with your existing Database
Your database probably already has a $$SearchForm (or similar) and a $$SearchTemplateDefault. Leave these as they are and your web site will continue to work beautifully.
Make a copy of the two forms and modify them for mobiles
In these examples, we'll call...
On your MSearchForm, you need only have;
1. An Editable Text Field (called SearchWord1)
2. A Button
3. A Computed Text Field called $$Return
The formula for the button could be as follows;
The formula for the $$Return Field could be as follows;
Note: HTML Brackets have been replaced with curly braces
(Actually I'm not sure you need this code on the mobile, but it's better to be safe than sorry).
Creating the Search View
You should now create a view and give it an alias of MSearchAll
If you're doing this for use on a mobile, you should make your view really simple and small (eg: Default Sans Serif 8 Points).
You won't need any categorizations here, just keep it as simple as possible (a list of titles only perhaps?)
Testing your Search
Once everything is saved, you can test your new search facility.
The URL would be something like;
http://www.mydomain.com/myfolder/mydatabase.nsf/MSearchForm?OpenForm
(obviously this is a dummy url which won't work)
Until recently, I'd have been at a loss to give you a good reason. Now however, since I've decided to modify some databases for Mobile Phone use, I have a very good reason.
Suppose that you want your database to be searchable via the web and also searchable via mobile.
- On the web, you can afford to spread out on the screen and you want to use a lot of fancy graphics and fonts.
- On the mobile, you need to keep things as small and as plain as possible.
Working with your existing Database
Your database probably already has a $$SearchForm (or similar) and a $$SearchTemplateDefault. Leave these as they are and your web site will continue to work beautifully.
Make a copy of the two forms and modify them for mobiles
In these examples, we'll call...
- the new $$SearchForm, MSearchForm
- We'll call the new $$SearchTemplate for MSearchAll
On your MSearchForm, you need only have;
1. An Editable Text Field (called SearchWord1)
2. A Button
3. A Computed Text Field called $$Return
The formula for the button could be as follows;
DB:= @Implode(@Explode(@Text(@Subset(@DbName;-1)); "\\");"/"); SearchURL := "/"+DB+"/MSearchAll?searchView&query="+@Trim(SearchWord1); ReturnURL :="/"+DB+"/MSearchAll?OpenView"; @If( @Trim(SearchWord1) != "" ; @URLOpen(SearchURL) ; @URLOpen(ReturnURL) ) |
The formula for the $$Return Field could be as follows;
Note: HTML Brackets have been replaced with curly braces
"{script language=\"javascript\"}" + "document.forms[0].Search.click();" + "{/Script}" |
(Actually I'm not sure you need this code on the mobile, but it's better to be safe than sorry).
Creating the Search View
You should now create a view and give it an alias of MSearchAll
If you're doing this for use on a mobile, you should make your view really simple and small (eg: Default Sans Serif 8 Points).
You won't need any categorizations here, just keep it as simple as possible (a list of titles only perhaps?)
Testing your Search
Once everything is saved, you can test your new search facility.
The URL would be something like;
http://www.mydomain.com/myfolder/mydatabase.nsf/MSearchForm?OpenForm
(obviously this is a dummy url which won't work)
Comments