*** This is the equivalent of 'controller' method code at the top of the document.
*** We still recommend you use a Process method to handle lengthy code blocks rather
*** than using code in script, but it *is* possible to do it all in script like this

*** Read clientname variable from HTML Form variable or Address QueryString
LOCAL lcClientName
lcClientName=UPPER( Request.Params("clientname") )

*** Run the FoxPro query into TQuery Cursor
SELECT company, FirstName,LastName,Phone ;
 FROM Customers ;
 WHERE UPPER(company)=TRIM( lcClientName ) ;
 ORDER BY company

*** Close underlying cursor
USE IN Customers

*** For display fix up empty client name
IF EMPTY(lcClientName)
   lcClientName="All Clients"  
<!DOCTYPE html>
    <title>Client List</title>
    <!-- application.css references bootstrap and font-awesome -->

    <link href="~/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/lib/fontawesome/css/all.min.css" rel="stylesheet" />
    <link href="~/css/application.css" rel="stylesheet" />
    <div class="banner">
        <a class="slide-menu-toggle-open no-slide-menu"
           title="More Samples">
            <i class="fa fa-bars"></i>
        <div class="title-bar no-slide-menu">
            <a href="~/">
                <img src="~/images/icon.png"
                     style="height: 45px; float: left" />
                <div style="float: left; margin: 4px 5px; line-height: 1.0">
                    <i style="color: #0092d0; font-size: 0.9em; font-weight: bold;">West Wind</i><br />
                    <i style="color: whitesmoke; font-size: 1.65em; font-weight: 600;">Web Connection</i>

        <nav class="banner-menu-top float-right">
            <a href="http://west-wind.com/webconnection/docs/" class="hidable">
                <i class="fa fa-book"></i>
            <a href="/wconnect/">
                <i class="fas fa-home"></i>

    <div id="MainView">
        <div class="container">
            <div class="page-header-text"><i class="fa fa-list"></i> 
            Customer List
            <span class="badge badge-pill badge-super badge-primary"><%= Reccount() %></span>
            <div class="btn-group" style="margin: 5px 0 15px">
                <a href="~/" class="btn btn-default btn-outline-primary btn-sm"> <i class="fa fa-home"></i> Samples</a>
                <a href="showfileastext.wwd?file=~/wcscripts/nocode.wcs" class="btn btn-outline-primary btn-sm"> <i class="fa fa-code"></i> Show Code</a>
                <a href="" class="btn btn-outline-primary btn-sm"> <i class="fa fa-refresh"></i> Refresh Page</a>

            <div class="alert alert-info" style="margin: 20px 0;font-size: 0.9em">
                <i class="fa fa-info-circle fa-4x float-left" style="margin: 0 10px 10px 0"></i> This page was created using only a templated HTML page that runs FoxPro code. It runs a FoxPro query to
                retrieve records using a script block and then uses an HTML Helper function - HtmlDataGrid() - to display
                the table's data in an HTML table. Using templates allows for all code changes to be made in a page
                and immediately see the changes in real time as templates are evaluated dynamically each time they are run

            <form action="nocode.wcs" method="post" style="margin-bottom: 20px;">
                <div class="form-row">

                    <div class="input-group ">
                        <%= HtmlTextBox("clientname",.f.,[ class="form-control" style="width: 240px;" placeholder="Search for customers"]) %>
                        <div class="input-group-append">
                            <button class="btn btn-primary"
                                    id="btnSubmit" name="btnSubmit">
                                <i class="fa fa-search"></i>


            LOCAL loConfig
            loConfig = CREATEOBJECT("HtmlDataGridConfig")
            loConfig.PageSize = 5
            Response.Write( HtmlDataGrid("TQuery",loConfig) )

                    © West Wind Technologies, 1995 - <%= Year(Date()) %>
                <a href="http://www.west-wind.com/webconnection/" class="float-right">
                    <img alt="Powered by Web Connection" src="~/images/WestWindText.png">


*** Cleanup Code