diff --git a/doc/MANUAL.md b/doc/MANUAL.md index af42cbb..4bdeb2b 100644 --- a/doc/MANUAL.md +++ b/doc/MANUAL.md @@ -183,6 +183,9 @@ Structurally, they are made up of the following elements: - **`style`**: A string of inline CSS which will be applied to the field. **Optional**, **String**. + - **`classes`**: A string of optional CSS classes to add to this field. + **Optional**, **String**. + - **`...`**: Other options, which depend on the type of field. For more information, see [Field types](#field_types). **Optional**. diff --git a/examples/customize/customize.json b/examples/customize/customize.json index 4dfeffc..240487d 100644 --- a/examples/customize/customize.json +++ b/examples/customize/customize.json @@ -12,7 +12,8 @@ "name": "background", "title": "Different background color", "type": "string", - "style": "background-color: #C0FFC0;" + "style": "background-color: #C0FFC0;", + "classes": "foo bar" } ] } diff --git a/src/webapp.py b/src/webapp.py index d1371df..2342561 100644 --- a/src/webapp.py +++ b/src/webapp.py @@ -373,6 +373,8 @@ class ScriptFormWebApp(WebAppHandler): if field.get('required', None): params['classes'].append('required') + params['classes'].extend(field.get('classes', '').split()) + params["style"] = field.get("style", "") # Get field-specific parameters