diff --git a/cgi-bin/form.py b/cgi-bin/form.py index f047682..cb8ff53 100755 --- a/cgi-bin/form.py +++ b/cgi-bin/form.py @@ -172,6 +172,8 @@ def get_form_value( result = cast(form.getfirst(name)) if isinstance(result, str): result = result.strip() + if not result and default is not None: + return default return result except (TypeError, ValueError): fail("400 Bad Request", f"Invalid value for field: {name}")