Allow hidden form fields.

pull/7/head
Ferry Boender 9 years ago
parent c98717ef2a
commit 6214b2681e
  1. 4
      doc/MANUAL.md
  2. 10
      src/scriptform.py

@ -168,6 +168,10 @@ Structurally, they are made up of the following elements:
- **`allowed_users`**: A list of users that are allowed to view and submit
this form. **Optional**, **List of strings**.
- **`hidden`**: If 'true', the input field is hidden. This is useful for
pre-filled forms which takes it values from the GET request.
**Optional**, **boolean**.
- **`users`**: A dictionary of users where the key is the username and the
value is the plaintext password. This field is not required. **Dictionary**.

@ -66,6 +66,7 @@ html_header = u'''<html>
div.form p.form-description {{ font-size: 0.90em;
margin: 40px 25px 65px 25px; }}
div.form li {{ font-size: 0.90em; list-style: none; }}
div.form li.hidden {{ display: none; }}
div.form p.form-field-title {{ margin-bottom: 0px; }}
div.form p.form-field-input {{ margin-top: 0px; }}
select,
@ -743,12 +744,17 @@ class ScriptFormWebApp(WebAppHandler):
field['type'])
)
classes = ''
if 'hidden' in field and field['hidden']:
classes += 'hidden '
return (u'''
<li>
<li class="{classes}">
<p class="form-field-title">{title}</p>
<p class="form-field-input">{input} <span class="error">{errors}</span></p>
</li>
'''.format(title=field['title'],
'''.format(classes=classes,
title=field['title'],
input=input,
errors=u', '.join(errors)))

Loading…
Cancel
Save