Validating for a non empty value

Looking for options to validate a field and save to config only when all values are correct collectively.

x= s:taboption("password", Value, "pass", translate("Password"))
x.rmempty = false

with x.rmempty = false, Luci is reporting a error, but it is saving all values other than the to the config file other than this.

Another option that was tried is to add a validate function with x.rmempty=true.

function x.validate(self, value)
    if x === nil then  return nil end
    return value
end

validate function is called only when the field is non empty. if no value is entered for the password field, validate function is not getting called.

Luci is reporting a error, but it is saving all values other than this validated field.

I am facing the same issue , Does anyone know how to prevent to save config file if luci encountered an error.