Hari Rajagopal wrote:
On a form submit, I would like to throw a warning dialog (Are you
sure? Yes | No - type) but based on the data entered in the form input
I looked at button_to and link_to but can't seem to make them throw
the dialog based on the data entered in the form?
Any ideas appreciated.
I think you're getting two different design patterns confused here. A
confirm dialog is just for dangerous operations where you want to make
sure somebody doesn't delete something important just because their
motor skills are not up to par or they didn't understand the label you
chose for that link.
If you want to look at the data and yell at the user based on what they
typed, that is more like a validation in a model, where you would notice
that they just tried to set next year as the year they were born and you
would send them back to the form with an error message.
Please send along some context and maybe we can steer you in the right