[%#                                                      -%]
[%#  File: form.tt                                       -%]
[%#  Date: 01-Mar-2011                                   -%]
[%#  By  : Kevin Esteb                                   -%]
[%#                                                      -%]
[%#  This is an autogenerated form.                      -%]
[%#                                                      -%]
[%# invoke with INCLUDE form.tt form = <variable>        -%]
[%#                                                      -%]
[%#                                                      -%]
[% BLOCK label_attributes %]
        <label for="[% x.id %]">[% x.label %] [% IF x.required %]<span class="ym-required">&nbsp;*</span>[% ELSE %]&nbsp&nbsp[% END %]</label>
[% END %]
[%#                                                      -%]
[%- BLOCK standard_attributes -%]
  [%- IF x.name %] name="[% x.name %]"[% END -%]
  [%- IF x.value %] value="[% x.value %]"[% END -%]
  [%- IF x.id %] id="[% x.id %]"[% END -%]
  [%- IF x.tabindex %] tabindex="[% x.tabindex %]"[% END -%]
  [%- IF x.class %] class="[% x.class %]"[% END -%]
  [%- IF x.style %] style="[% s.style %]"[% END -%]
[%- END -%]
[%#                                                      -%]
[%- BLOCK text_attributes -%]
  [%- IF x.size %] size="[% x.size %]"[% END -%]
  [%- IF x.maxlength %] maxlength="[% x.maxlength %]"[% END -%]
[%- END -%]
[%#                                                      -%]
[%- BLOCK textarea_attributes -%]
  [%- IF x.name %] name="[% x.name %]"[% END -%]
  [%- IF x.id %] id="[% x.id %]"[% END -%]
  [%- IF x.tabindex %] tabindex="[% x.tabindex %]"[% END -%]
  [%- IF x.class %] class="[% x.class %]"[% END -%]
  [%- IF x.style %] style="[% s.style %]"[% END -%]
  [%- IF x.rows %] rows="[% x.rows %]"[% END -%]
  [%- IF x.cols %] cols="[% x.cols %]"[% END -%]
  [%- IF x.wrap %] wrap="[% x.wrap %]"[% END -%]
[%- END -%]
[%#                                                      -%]
[%- BLOCK extra_attributes -%]
  [%- IF x.placeholder %] placeholder="[% x.placeholder %]"[% END -%]
  [%- IF x.autofocus %] autofocus="autofocus"[% END -%]
  [%- IF x.autocomplete %] autocomplete="[% x.autocomplete %]"[% END -%]
  [%- IF x.required %] required [% END -%]
  [%- IF x.pattern %] pattern="[% x.pattern %]"[% END -%]
  [%- IF x.readonly %] readonly="readonly"[% END -%]
[%- END -%]
[%#                                                      -%]
[%- BLOCK number_attributes -%]
  [%- IF x.max %] max="[% x.max %]"[% END -%]
  [%- IF x.min %] min="[% x.min %]"[% END -%]
  [%- IF x.step %] step="[% x.step %]"[% END -%]
[%- END -%]
[%#                                                      -%]
[%- BLOCK image_attributes -%]
  [%- IF x.height %] height="[% x.height %]"[% END -%]
  [%- IF x.width %] width="[% x.width %]"[% END -%]
[%- END -%]
[%#                                                      -%]
[%- BLOCK select_attributes -%]
  [%- IF x.multiple %] multiple[% END -%]
  [%- IF x.size %] size="[% x.size %]"[% END -%]
[%- END -%]
[%#                                                      -%]
[% BLOCK results -%]
  [%- IF form.results.missing || results.invalid -%]
      <div class="ym-fbox ym-error">
        <p class="ym-message">Form Errors</p>
    [%- IF form.results.missing -%]
      [%- FOREACH field IN x.fields -%]
        [%- IF form.results.missing(field.name) -%]
        <strong class="message">Field "[% field.label %]" was missing</strong>
        [%- END -%]
      [%- END -%]
    [%- END -%]
    [%- IF form.results.invalid -%]
      [%- FOREACH field IN x.fields -%]
        [%- IF form.results.invalid(field.name) -%]
        <strong class="message">Field "[% field.label %]" was invalid</strong>
        [%- END -%]
      [%- END -%]
      [%- END -%]
        <p class="message">Please correct these problems and resubmit. Thank you</p>
      </div>
  [%- END -%]
[% END -%]
[%#                                                      -%]
[% BLOCK radio -%]
      <div class="ym-fbox ym-fbox-check">
        [% PROCESS label_attributes x %]
        <input type="radio" 
        [%- PROCESS standard_attributes x -%]
        [%- IF x.checked %]checked[% END -%] 
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK radio_group -%]
      <fieldset>
        <legend>[% x.legend %]</legend>
        <div class="ym-fbox ym-fbox-check">
        [%- FOREACH item IN x.items -%]
          [%- PROCESS label_attributes x = item -%]
          <input type="radio"
          [%- PROCESS standard_attributes x -%]
          [%- IF x.checked %]checked[% END -%] 
          />
        [%- END -%]
        </div>
      </fieldset>
[% END -%]
[%#                                                      -%]
[% BLOCK checkbox -%]
      <div class="ym-fbox ym-fbox-check">
        [%- PROCESS label_attributes x -%]
        <input type="checkbox" 
        [%- PROCESS standard_attributes x -%]
        [%- IF x.checked %]checked[% END -%] 
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK checkbox_group -%]
      <fieldset>
        <legend>[% x.legend %]</legend>
        <div class="ym-fbox ym-fbox-check">
          [%- FOREACH item IN x.items -%]
          [%- PROCESS label_attributes x = item -%]
          <input type="checkbox" 
          [%- PROCESS standard_attributes x -%]
          [%- IF x.checked %]checked[% END -%] 
          />
          [%- END -%]
        </div>
      </fieldset>
[% END -%]
[%#                                                      -%]
[% BLOCK textarea -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <textarea 
        [%- PROCESS textarea_attributes x -%]
        [%- PROCESS extra_attributes x -%]
        >
        [%- IF x.value %][% x.value %][% END -%]
        </textarea>
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK hidden %]
    <input type="hidden" name="[% x.name %]" value="[% x.value %]" />
[% END -%]
[%#                                                      -%]
[% BLOCK html -%]
[%- x.value -%]
[% END -%]
[%#                                                      -%]
[% BLOCK textfield -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="text" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS text_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK email -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="email" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS text_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK url -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="url" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS text_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK number -%]
      <div class="ym-fbox ym-fbox-text">
      [%- PROCESS label_attributes x -%]
        <input type="number" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS number_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK range -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="range" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS number_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK search -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="search" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS text_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK color -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="color" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK date -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="date" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS number_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK month -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="month" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS number_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK week -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="week" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS number_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK time -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="time" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS number_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK datetime -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="datetime" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS number_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK datetime_local -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="datetime-local" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS number_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK password -%]
      <div class="ym-fbox ym-fbox-text">
        [%- PROCESS label_attributes x -%]
        <input type="password" 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS text_attributes x -%] 
        [%- PROCESS extra_attributes x -%]
        />
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK select -%]
      <div class="ym-fbox ym-fbox-select">
        [%- PROCESS label_attributes x -%]
        <select 
        [%- PROCESS standard_attributes x -%]
        [%- PROCESS select_attributes x -%]
        [%- PROCESS extra_attributes x -%]
        >
        [%- FOREACH option IN x.options -%]
          <option value="[% option.value %]"[% IF option.selected%] selected="selected"[% END %]>[% option.name %]</option>
        [%- END -%]
        </select>
      </div>
[% END -%]
[%#                                                      -%]
[% BLOCK fieldset_start -%]
    <fieldset>
      <legend>[% x.legend %]</legend>
[% END -%]
[%#                                                      -%]
[% BLOCK fieldset_end -%]
    </fieldset>
[% END -%]
[%#                                                      -%]
[% BLOCK button -%]
    <div class="ym-fbox">
      <input type="button" name="[% x.name %]" value="[% x.value %]" tabindex="[% x.tabindex %]">
    </div>
[% END -%]
[%#                                                      -%]
[% BLOCK reset_button -%]
    <div class="ym-fbox-footer">
      <input type="reset" class="ym-button" tabindex="[% x.tabindex %]">
    </div>
[% END -%]
[%#                                                      -%]
[% BLOCK cancel_button -%]
    <div class="ym-fbox-footer">
      <input type="submit" class="ym-button ym-xsmall ym-warning" name="cancel" value="Cancel" tabindex="[% x.tabindex %]">
    </div>
[% END -%]
[%#                                                      -%]
[% BLOCK submit_button -%]
    <div class="ym-fbox-footer">
      <input type="submit" class="ym-botton ym-xsmall ym-primary" name="submit" value="Submit" tabindex="[% x.tabindex %]">
    </div>
[% END -%]
[%#                                                      -%]
[%- BLOCK standard_buttons -%]
    <div class="ym-fbox-footer ym-fbox-button">
      <input type="reset"  class="ym-button ym-xsmall" tabindex="[% x.tabindex %]">
      <input type="submit" class="ym-button ym-xsmall ym-warning" name="cancel" value="cancel" tabindex="[% x.tabindex + 1 %]">
      <input type="submit" class="ym-button ym-xsmall ym-primary" name="submit" value="submit" tabindex="[% x.tabindex + 2 %]">
    </div>
[% END -%]
[%#                                                      -%]
[%- BLOCK process_fields -%]
  [%- FOREACH field IN x.fields -%]
    [%- SWITCH field.type -%]
      [%- CASE "hidden" -%]
        [%- PROCESS hidden x = field -%]
      [%- CASE "radio" -%]
        [%- PROCESS radio x = field -%]
      [%- CASE "radio_group" -%]
        [%- PROCESS radio_group x = field -%]
      [%- CASE "checkbox" -%]
        [%- PROCESS checkbox  x = field -%]
      [%- CASE "checkbox_group" -%]
        [%- PROCESS checkbox_group x = field -%]
      [%- CASE "textarea" -%]
        [%- PROCESS textarea x = field -%]
      [%- CASE "password" -%]
        [%- PROCESS password x = field -%]
      [%- CASE "select" -%]
        [%- PROCESS select x = field -%]
      [%- CASE "button" -%]
        [%- PROCESS button x = field -%]
      [%- CASE "email" -%]
        [%- PROCESS email x = field -%]
      [%- CASE "url" -%]
        [%- PROCESS url x = field -%]
      [%- CASE "number" -%]
        [%- PROCESS number x = field -%]
      [%- CASE "range" -%]
        [%- PROCESS range x = field -%]
      [%- CASE "date" -%]
        [%- PROCESS date x = field -%]
      [%- CASE "month" -%]
        [%- PROCESS month x = field -%]
      [%- CASE "week" -%]
        [%- PROCESS week x = field -%]
      [%- CASE "time" -%]
        [%- PROCESS time x = field -%]
      [%- CASE "datetime" -%]
        [%- PROCESS datetime x = field -%]
      [%- CASE "datetime_local" -%]
        [%- PROCESS datetime_local x = field -%]
      [%- CASE DEFAULT -%]
        [%- PROCESS textfield x = field -%]
    [%- END -%]
  [%- END -%]
[%- END -%]
[%#                                                      -%]
<form name="[% form.name %]" class="ym-form" action="[% form.url %]" method="[% form.method %]" enctype="[% form.enctype %]">
  <p>Required fields are marked with <span class="required">*</span></p>
  [%- FOREACH item IN form.items -%]
    [%- SWITCH item.type -%]
      [%- CASE 'fieldset' -%]
        [%- PROCESS fieldset_start x = item -%]
        [%- PROCESS results x -%]
        [%- PROCESS process_fields x = item -%]
        [%- PROCESS fieldset_end -%]
      [%- CASE 'submit_button' -%]
        [%- PROCESS submit_button x = item -%]
      [%- CASE 'reset_button' -%]
        [%- PROCESS reset_button x = item -%]
      [%- CASE 'cancel_button' -%]
        [%- PROCESS cancel_button x = item -%]
      [%- CASE 'standard_buttons' -%]
        [%- PROCESS standard_buttons x = item -%]
      [%- CASE 'fields' -%]
        [%- PROCESS results x -%]
        [%- PROCESS process_fields x = item -%]
      [%- CASE 'hidden' -%]
        [%- PROCESS hidden x = item -%]
    [%- END -%]
  [%- END -%]
</form>
