liquid_feedback_frontend
changeset 1376:2ff3ae341a6e
Check optional checkbox in action
author | bsw |
---|---|
date | Wed Aug 08 17:28:10 2018 +0200 (2018-08-08) |
parents | f6b61b418d8a |
children | 9b9c08e37435 |
files | app/main/registration/_action/register.lua |
line diff
1.1 --- a/app/main/registration/_action/register.lua Wed Aug 08 17:20:03 2018 +0200 1.2 +++ b/app/main/registration/_action/register.lua Wed Aug 08 17:28:10 2018 +0200 1.3 @@ -139,7 +139,14 @@ 1.4 1.5 else 1.6 local value = param.get("verification_data_" .. field.name) 1.7 - if not field.optional and (not value or (#value < 1 and (not manual_verification or field.name ~= "mobile_phone"))) then 1.8 + local optional = false 1.9 + if field.optional then 1.10 + optional = true 1.11 + end 1.12 + if field.optional_checkbox and param.get("verification_data_" .. field.name .. "_optout", atom.boolean) then 1.13 + optional = true 1.14 + end 1.15 + if not optional and (not value or (#value < 1 and (not manual_verification or field.name ~= "mobile_phone"))) then 1.16 slot.put_into("self_registration__invalid_" .. field.name, "to_short") 1.17 slot.select("error", function() 1.18 ui.container{ content = _("Please enter: #{field_name}", { field_name = field.label }) }