Not really no. But you can add standard javascript event like this:
<%= text_field_tag 'my_text_field', :onchange => "alert('Changing this field will have great consequences')" %>
Steve
Not really no. But you can add standard javascript event like this:
<%= text_field_tag 'my_text_field', :onchange => "alert('Changing this field will have great consequences')" %>
Steve
Ah ok - that's going to require a bit more work - more than one post's
worth :0). You'll need to create a javascript function that is called
when you submit the form. That is reasonably straight forward.
However, in order to work out if the field has changed, you'll need to
either use onchange to set a variable stating the change or have a
hidden field with old value so you can compare. The function would
look something like this:
function checkForm() { // your statement would need to work out if the field had been changed if(field_has_changed) { return confirm('Changing this field will have great consequences'); } }
And in the form submit you'll have 'return checkForm()'
Hope that makes sense - you'll need to do a bit of googling to work out the rest of the code but hopefully I've put you in the right direction :0)
Steve
I'm not sure it's AJAX specifically that you're after as you don't need to post back to the server for this. I would however recommend that you look at Scriptaculous (http://wiki.script.aculo.us/ scriptaculous/show/CombinationEffectsDemo) if you want to display a message in neat 'web 2.0' style. Scriptaculous is included with Rails, so it's all there ready to play with.
Steve