A simple HTML search form in WebDrawer or ServiceAPI

Background

WebDrawer contains a fairly generic search form that allows you to choose up to three search clauses.  It si possible to refine which search clauses are displayed in those fields but you may want to create your own entirely custom form.  This post talks about the basics of doing that.

File Location

In the video I place my template in the Views folder.  It is probably better to place customer templates in a folder separate to the standard WebDrawer files.  This folder must be a child of Views as seen below.

Editing hptrim.config

In the video I add a route to hptrim.config, I also say that the route name may be anything.  That is not strictly true, the route name must not contain spaces and you should avoid special characters as some of them are not allowed in URLs.  This is the route I add in the video...

    <add 
      name="Search" 
      model="FormSearch" 
      template="SearchFormView"       
      properties="RecordRecordType,RecordExtension,RecordTitle,RecordNumber,RecordIsElectronic" 
      pageSize="15"/>

Razor View

Even though I call it a template the accurate name for this is the View (as in View / Model / Controller).  I have made a change to the file you can download here in that I have added a little code to display a message when we have done a zero results search.

Video (and apologies)

I noticed when reviewing the video that I there were a couple of UI artefacts remaining from some other experiments I had done.  So if this does not look like your garden variety WebDrawer that is why.

Written on April 16, 2015