can you use :confirm => ''great consequences'', :post => true within text_field_tag options? I''m trying to confirm with users that changing that particular field will have great consequences. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ah yes, thanks... Stephen Bartholomew wrote:> 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-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Im not too hot with the javascript... I wanted the message to show only after the form is submitted and not just changing the field and clicking off. Daniel Salo wrote:> ah yes, thanks... > > > > Stephen Bartholomew wrote: >> 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-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the reply... after doing the checkForm I realize the prompt is too harsh (visually harsh), so im thinking about putting this into ajax instead. So now I''ve changed my hunt to a nice ajax script:) Stephen Bartholomew wrote:> 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-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
That''s exactly where I am! thanks. Stephen Bartholomew wrote:> 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-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---