Validate presence of input if required