---
# indicator is the field that is used to test for form submission
indicator: submit

constraints:
    - SingleValue

filters:
    - TrimEdges
    
# Start listing the form elements
elements:
    - type: Text
      name: name
      label_loc: label_name
      # This is an optional 'mouse over' title pop-up
      attributes:
        title: Enter the name of the bar
      constraints:
        - Required
        - Printable
      filters:
        - HTMLScrubber

    - type: Text
      name: street
      label_loc: label_street
      constraints:
        - Printable
      filters:
        - HTMLScrubber

    - type: Block
      name: city_block
      elements:
        # Add a drop-down list for the city selection.  Note that we will
        # dynamically fill in all the cities from the controller but we
        # could manually set items in the drop-list by adding this YAML code:
        # options:
        #   - [ '1', 'Bastien' ]
        #   - [ '2', 'Nasseh'  ]
        - type: Select
          name: city
          id: city
          empty_first: true
          empty_first_label_loc: label_empty
          label_loc: label_city
          constraints:
            - Required
            - Integer

        - type: Submit
          name: submit_new_city
          id: btn_new_city
          value_loc: value_submit_new_city
          non_param: true
         
    - type: Text
      name: url
      label_loc: label_url
      label_attributes:
        class: clearme
      constraints:
        type: Regex
        common:
          - URI
          - HTTP
          - { '-scheme': 'https?' }
      filters:
        - HTMLEscape

    - type: Select
      name: status
      label_loc: label_status
      #empty_first: true
      #empty_first_label_loc: label_empty
      options:
        #- [ 'non-smoking', 'non-smoking' ]
        #- [ 'mixed', 'mixed' ]
        #- [ 'smoking', 'smoking' ]
        - value: ''
          label_loc: label_empty
        - value: 'non-smoking'
          label_loc: label_nonsmoking
        - value: 'mixed'
          label_loc: label_mixed
        - value: 'smoking'
          label_loc: label_smoking
      constraints:
        - Required
        - AutoSet

    - type: Textarea
      rows: 5
      name: comment
      label_loc: label_comment
      comment_loc: comment_comment
      constraints:
        - Printable
      filters:
        - HTMLScrubber

    # The submit button
    - type: Submit
      name: submit
      value_loc: value_submit
      non_param: true

