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.