Paste: testcase for search field

Author: doublec
Mode: factor
Date: Fri, 27 Feb 2009 04:35:56
Plain Text |
: <search-action> ( -- action )
  <page-action>
    { myapp "search" } >>template
    [ 
      { 
        { "q" [ v-required 100 v-max-length ] } 
      } validate-params 
    ] >>validate 
    [
      { 
        { "q" [ "" v-default 100 v-max-length ] } 
      } validate-params
      "q" value "foobar" set-global
      ! if 'q' has % entered in the form it has bad data here
    ] >>init ;

    <t:form t:action="$tinyvid/search">
      <table>
        <tr>
          <td>Search:</td>
          <td><t:field t:name="q" t:size="80"/></td>
          <td><button>Search</button></td>
        </tr>
      </table>
    </t:form>

New Annotation

Summary:
Author:
Mode:
Body: