Prompt

I would like to add a prompt to a membership validation method that I
have which basically validates a number that the user enters. If the
number is validated, their info is saved to a database, but if not, a
prompt pops up saying “Invalid Membership Number,” or something to that
effect. The thing is I have no idea how to do this. I know that in a
link_to helper I can say :confirm => “Really?”. The rub here is, that I
need this box to only popup if a condition fails and defently not
everytime a button (in this case I am using a form and a bitton) is
clicked. Is there anyway I can get this type of action from my
controller? Thanks in advance,

~S