diff --git a/doc/MANUAL.md b/doc/MANUAL.md index 259ae77..bacab67 100644 --- a/doc/MANUAL.md +++ b/doc/MANUAL.md @@ -153,8 +153,12 @@ Structurally, they are made up of the following elements: - **`required`**: Whether the field is required. **Optional**, **Boolean**. - - **`...`**: Other options, which depend on the type of field. - **Optional**. + - **`hide`**: If 'true', don't show the form in the list. You can still + view it, if you know its name. This is useful for other forms to + redirect to this forms and such. + + - **`...`**: Other options, which depend on the type of field. For + more information, see [Field types](#field_types). **Optional**. - **`allowed_users`**: A list of users that are allowed to view and submit this form. **Optional**, **List of strings**. diff --git a/src/scriptform.py b/src/scriptform.py index 9b51b8f..324d094 100755 --- a/src/scriptform.py +++ b/src/scriptform.py @@ -200,6 +200,7 @@ class ScriptForm: form['fields'], script, output=form.get('output', 'escaped'), + hide=form.get('hide', False), submit_title=form.get('submit_title', 'Submit'), allowed_users=form.get('allowed_users', None)) ) @@ -303,7 +304,7 @@ class FormDefinition: for validation of the form values. """ def __init__(self, name, title, description, fields, script, - output='escaped', submit_title="Submit", + output='escaped', hide=False, submit_title="Submit", allowed_users=None): self.name = name self.title = title @@ -311,6 +312,7 @@ class FormDefinition: self.fields = fields self.script = script self.output = output + self.hide = hide self.submit_title = submit_title self.allowed_users = allowed_users @@ -604,6 +606,8 @@ class ScriptFormWebApp(WebAppHandler): if form_def.allowed_users is not None and \ self.username not in form_def.allowed_users: continue # User is not allowed to run this form + if form_def.hide: + continue # Don't show hidden forms in the list. h_form_list.append(u'''
  • {title}