<!-- BEGIN register/default.tt -->
	[% META title = 'Registration &raquo; Search for Patient Details' -%]

    [% # PROCESS dumper.tt dump = c.stash.errs %]

    <script type="text/javascript" src="/js/jquery.watermarkinput.js"></script>
    <script type="text/javascript">
        jQuery( function() {    
            $("#is_valid_date_day").Watermark("dd");
            $("#is_valid_date_month").Watermark("mm");
            $("#is_valid_date_year").Watermark("yyyy");
        } );
    </script>
    
    <h3>Search For Patient Details</h3>

    [% # PROCESS site/form_validator.tt profile = 'patient_data' # can't do dates in future %]

    [% IF dfv_errors %]
        <p class="error">[% c.cfg('msg').dfv_errors %]</p>
    [% END %]

    [% patient_search_data_dfv_js # doesn't work with 'require_some' %]

	[% INCLUDE site/snippets/help.tt file = 'patientsearch' %]


    <div id="registration">
      <form method="get" action="[% app_url %]/register/patient_search"
            name="register" id="register" [% patient_search_data_onsubmit %]>
        <div class="name">
			<p id="registration_format">
                <u>FORMAT</U>: last name, followed by (optional) first name or first initial, comma-separated
            </p>

 			<p>Name:
                [% IF error_name; class = 'input_error'; ELSE; class = 'field'; END %]
				<input type="text" class="[% class %]" name="name" size="20" value="[% c.query.param('name') %]"
					[% site.html.on_focus %] />
                [% error_name %]
			</p>
        </div>

        [% BLOCK validate_date; IF c.cfg('use_cgi_ajax') %]
            onChange="do_ajax(
                ['is_valid_date_day','is_valid_date_month','is_valid_date_year'],
                ['bad_date']
            ); return true;"
        [% END; END %]

        <div class="dob">
            [% SET class = error_year || error_day ? 'input_error' : 'field' %]
            <p class="[% class %]" align="center">
                <u>FORMAT</U>: dd / mm / yyyy
            </p>
			<p>
            [% IF error_year || error_day %]
                <span class="dfv_errors">invalid &#187;</span>
            [% END %] D.o.B:

                <input type="text" name="day" size="2" id="is_valid_date_day"
                    value="[% c.query.param('day') %]" [% PROCESS validate_date %]
                    maxlength="2" class="[% class %]" [% site.html.on_focus %] />

				<input type="text" name="month" size="2" id="is_valid_date_month"
                    value="[% c.query.param('month') %]" [% PROCESS validate_date %]
                    maxlength="2" class="[% class %]" [% site.html.on_focus %] />

				<input type="text" name="year" size="4" id="is_valid_date_year"
                    value="[% c.query.param('year') %]" [% PROCESS validate_date %]
                    maxlength="4" class="[% class %]" [% site.html.on_focus %] />

			    <span class="ajax_error"><em id="bad_date"></em></span>
			</p>
        </div>
    
        <div class="patient_id">
			<p id="registration_submit_format">
                [% site.html.submit %]
                [% site.html.reset %]
            </p>
			<p>Unit/NHS No:
				[% IF error_patient_id; class = 'input_error'; ELSE; class = 'field'; END %]
				<input type="text" class="[% class %]" name="patient_no" size="15"
                    value="[% c.query.param('patient_no') %]" [% site.html.on_focus %] />
			</p>
        </div>
      </form>
      
      [% IF c.cfg('settings').have_online_requests %]
        <form method="get" action="[% app_url %]/register/online_request_form"
            name="request_form" id="request_form">
            <h5>Online Request Form:</h5>
            <div class="req_form">
                <p>ID:
                    <input type="text" class="" name="id" size="25" />
                    [% site.html.submit %]
                </p>
            </div>
        </form>
      [% END %]
    </div>

	<script type="text/javascript">
	<!--
		document.getElementById('register').name.focus();
	//-->
	</script>
<!-- END register/default.tt -->