Change $input to $$input and you won’t get an error when you hit cancel.