summaryrefslogtreecommitdiffstats
path: root/ogcp/forms/action_forms.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-06-03 17:21:12 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-06-03 17:26:09 +0200
commit43e3346a4a0a2e2f1cea1c3d6f03bfab780a636f (patch)
tree877cd2ba09981cf4c283c20e50965dd66d2fe9d9 /ogcp/forms/action_forms.py
parentcf6794d7c811dfaa8c0a69225598b5f061b45f96 (diff)
forms: ensure ip and mac are not empty in client add form
Use the WTForms validator InputRequired to check the field and disable the submit button if either the IP or MAC fields have no contents.
Diffstat (limited to 'ogcp/forms/action_forms.py')
-rw-r--r--ogcp/forms/action_forms.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py
index 19387aa..e18de5e 100644
--- a/ogcp/forms/action_forms.py
+++ b/ogcp/forms/action_forms.py
@@ -122,8 +122,10 @@ class FolderForm(FlaskForm):
class ClientDetailsForm(FlaskForm):
server = HiddenField()
name = StringField(label=_l('Name'))
- ip = StringField(label=_l('IP'))
- mac = StringField(label=_l('MAC'))
+ ip = StringField(label=_l('IP'),
+ validators=[InputRequired()])
+ mac = StringField(label=_l('MAC'),
+ validators=[InputRequired()])
serial_number = StringField(label=_l('Serial Number'))
livedir = SelectField(label=_l('ogLive'),
choices=[('ogLive', 'Default'),])