From 43e3346a4a0a2e2f1cea1c3d6f03bfab780a636f Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Mon, 3 Jun 2024 17:21:12 +0200 Subject: 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. --- ogcp/forms/action_forms.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ogcp/forms') 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'),]) -- cgit v1.2.3-18-g5258