Home > Support > Resource Center > Web Publisher 4 Documentation

Creating Search Forms


When you click the Search button, the Web Publisher displays the search form. You can change the appearance of the search form, or you can create more complex forms for specific searches (like a proximity search, date search, or a search in a specific field).


     Ÿ Redesigning the Search Form

     Ÿ Creating Specialized Search Forms

     Ÿ Searching Multiple Databases

     Ÿ Redefining the Search Button


Redesigning the Search Form

You use a standard HTML form to pass a search request to the Web Publisher. To create or modify a search form, you will be required to use HTML codes. Sample HTML search forms are supplied on our web site at http://ww.askSam.com


To Create a Search Form:

1. Create an HTML form with the text and layout you want.

2. There are several elements you must include when defining the form:

     Ÿ The "Method" must be set to a GET.

     Ÿ The "Action" must be set to the URL of the AS_Web4.exe

     Ÿ A hidden Command field must have the value "search"

     Ÿ A hidden File field must have the value of the file name you wish to search.


Below is sample HTML code for a search form:


<HTML>

<BODY>


<FORM action=/scripts/as_web4.exe method=Get>

<INPUT Type=hidden Name="Command" value="Search">

<INPUT Type=hidden Name="File" value="DATAFILE.ASK">

<INPUT Type=hidden Name="NumRows" value="10">


Enter your Search:<BR>

<INPUT Size=45 Name="Request">

<INPUT Type="submit" Value="Search"><P>

</FORM>


</BODY>

</HTML>


In your browser, the previous form would look like this:



To add OPTIONS in a Search Form:

Options allows you to choose the amount of information that is displayed with your search results and also to choose the number of results displayed per page in your browser.


Below is sample HTML code for a search form with OPTIONS:


<HTML>

<BODY>


<FORM action=/scripts/as_web4.exe method=Get>

<INPUT Type=hidden Name="Command" value="Search">

<INPUT Type=hidden Name="File" value="DATAFILE.ASK">


Search For: <INPUT Size=45 Name="Request">

<INPUT Type="submit" Value="Search"><BR>


Options: <SELECT id=ViewName name=ViewName>

<OPTION >(Default)</OPTION>

<OPTION >(Summary)</OPTION>

<OPTION >(Detailed)</OPTION>

<OPTION >(Entire Page)</OPTION>


</SELECT>

<SELECT id=NumRows name=NumRows>

<OPTION value=10>10 results per page</OPTION>

<OPTION value=20>20 results per page</OPTION>

<OPTION value=30>30 results per page</OPTION>

<OPTION value=40>40 results per page</OPTION>

<OPTION value=50>50 results per page</OPTION>

</SELECT>

</FORM>

</BODY>

</HTML>



In your browser, the previous form would look like this:




Using these HTML codes you can build your own custom Search Form. To search using your form, you can define an askSam hypertext link to your HTML file (for example: http://www.test.com/search.htm). Or you can write the HTML codes in an askSam document (in System 10 font) and define a hypertext link to the askSam document.


 If you are using the Search button to search your file, you can use the WebAdmin Utility to point the Search button to your new search form. See Redefining the Search Button for details.



Creating Specialized Search Forms

The SubSearch command lets you create specialized search forms. With the SubSearch command, you can take user input from an HTML form and build advanced searches - like date, proximity, or numeric searches. The SubSearch also lets you combine these searches in a single search form.


NOTE: The difference between the Request and SubSearch commands: The Request command takes user input and passes it directly to the askSam search engine. The SubSearch command lets you use an HTML form to build a request containing various search commands. With the SubSearch command, you can assemble input from an HTML form and then pass it on to the askSam search engine.


To Create a Search Form with a SubSearch:

1. Create an HTML form with the text and layout you want.

2. There are several elements you must include when defining the form:

     Ÿ The "Method" can be set to a POST or a GET.

     Ÿ The "Action" must be set to the URL of the AS_Web4.exe

     Ÿ A hidden Command field must have the value "SubSearch"

     Ÿ A hidden File field must have the value of the file name you wish to search.

     Ÿ In a hidden Request field you enter the search string. Use #field1#, #field2#, etc. to insert the user input from your form into the search string.


Below is sample HTML code for a search form:


<HTML>

<BODY>


<FORM action=/scripts/as_web4.exe method=get>

<INPUT type=hidden Name=Command value=SubSearch>

<INPUT type=hidden Name=File value="Bibliography.ask">

<INPUT type=hidden Name=Request Value="#req1# {IN} TITLE[">


Search in Title Field for:<BR>

<INPUT size=45 name=req1> <INPUT type=submit value=Search>


</BODY>

</HTML>


In your browser, the previous form would look like this:




Another sample in which the search form contains multiple fields:


<HTML>

<BODY>


<FORM action=/scripts/as_web4.exe method=get>

<INPUT type=hidden Name=Command value=SubSearch>

<INPUT type=hidden Name=File value="Contacts.ask">

<INPUT type=hidden Name=Request Value="#req1# AND #req2#" >


Search Term 1: <INPUT size=45 name=req1><BR>

Search Term 2: <INPUT size=45 name=req2>

<INPUT type=submit value=Search>


</BODY>

</HTML>


In your browser, the previous form would look like this:




Using these HTML codes you can build your own custom search form. Once you create a search form, there are several ways you can access this form:


     Ÿ You can define an askSam Hypertext  link to your HTML file (for example: http://www.test.com/search.htm).


     Ÿ You can enter HTML codes directly into an askSam document (in System 10 font). Then set a Hypertext link to the askSam document containing the search form.


     Ÿ If you access the search form using the Search button, the WebAdmin Utility lets you point the Search button to your new search form. See Redefining the Search Button for details.



Searching Multiple Databases

You can create a search form that searches through multiple askSam databases. You define your search form as described above. In the hidden File field, you insert the names of the askSam files you wish to search (if they are in the default directory for your askSam files) or their aliases. Separate each file name or alias by a comma. For example:


<INPUT Type=hidden Name="File" value="sales.ask,press.ask,tech.ask">


Below is sample HTML code for a search form that will search multiple databases:


<HTML>

<BODY>


<FORM action=/scripts/as_web4.exe method=Get>

<INPUT Type=hidden Name="Command" value="Search">

<INPUT Type=hidden Name="File" value="sales.ask,press.ask,tech.ask">

<INPUT Type=hidden Name="NumRows" value="10">


Enter your Search:<BR>

<INPUT Size=45 Name="Request">

<INPUT Type="submit" Value="Search"><P>

</FORM>


</BODY>

</HTML>


The output of the search results from a multiple database search will vary based upon how each individual askSam file's search results are defined. For the best and most consistent results the search results view for each of your files should be identical. The results are output based on finding the search terms requested and are listed in the order of the files in the value (see HTML code above).



Redefining the URL for the Search Button

The Search button displayed by the Web Publisher button bar automatically accesses the default search form. Using the WebAdmin Utility, you can define another URL for the Search button to access.


     1. Run WebAdmin utility from your browser

For example: http://www.servername.com/scripts/WebAdmin4.exe


     2. Select the Alias for the file you wish to modify (or create an alias for the file).


     3. Choose the SEARCH / HELP menu option.


     4. In the SEARCH PAGE URL field enter the URL of your new Search Form

(e.g. /search.htm)

     7. Choose the SUBMIT CHANGES button.


The next time you click on the Search button in the aliased file, the search form you defined will be displayed. Alternatively, you can define a hypertext link from any askSam document to a search form. You would simply define an askSam hypertext link to the URL or the askSam document containing the search form.





Return to Table of Contents

Quick Downloads

 

How people use askSam

 

Surf Report Newsletter

Subscribe today to receive our FREE monthly newsletter. The Surf Report includes tips, articles, and information about new releases, upgrades, free utilities, and special promotions. Sign up today!


Read Back Issues »
 

"askSam is an essential part of my software tool chest. I can research and collect data from anywhere and any source. Once it is in askSam I can edit, rearrange, organize, and search the information easily. Then I can present it and make it totally useful for other people via the web or CD. Fantastic!"

-- Valda Hilley, Author, Literary Agent, Teaching Consultant, Pack rat, and President, Convergent Press, Ltd.

 

Seaside Software Inc. DBA askSam Systems, 121 S Jefferson Street, Perry FL 32347
Telephone: 800-800-1997 / 850-584-6590   •   Email: info@askSam.com   •   Support: http://www.askSam.com/central.asp
© Copyright 1985-2012   •   Privacy Statement