Prompt box

I need to add a prompt to a form whenerver someone tries to submit so
bad data. Basically what I have is a form that takes credit card info.
On submit a method gets called that validates the card number. If that
validation fails, I would like a prompt box to show-up and indicate that
an ‘Invalid Card Number’ was entered. I add the following to my
remote_form helper:

:failure => “alert(‘ERROR’)”

It works, but not quite right. My question is, can I call prompt in a
method in my controller and not as an attribute of the form tag? That to
me would make more sence. I don’t know how to do that, however. Anyone
have any ideas or alternatives that might work? Thanks,

~S