
form(action='/api/'+form.name+'/'+(form.id || ''), method='post')
  if (form.filled)
    input(type='hidden', name='_method', value='put')
    legend= 'Update'
  else
    legend= 'New'

  //-
    Loop through every field in the Schema and create the appropriate
    formelements.
    @see /docs/crud.md

  fieldset
    each field in form.fields
      if !field.ignore
        .inline-block
          if field.type !== 'hidden'
            label(for='[name='+field.shortName+']', class=field.required ? 'required' : '')= field.shortName
          if field.type === 'textarea'
            textarea(name=field.name, required=field.required, maxlength=field.max)= field.value || null
          else
            input(type=field.type, name=field.name, required=field.required, maxlength=field.max, value=field.value)

  fieldset
    input(type='submit', value=form.filled ? 'update' : 'add')

//- In development-mode, output the Schema to the console

if (environment == 'development')
  script(type='text/javascript')
    console.dir(!{JSON.stringify(form)})

