hello,
i want validate my text_field only when the radio_button is clicked.
i try this but when i validate my form , the radio button lost focus
and validate is not checked
---View----
<%= radio_button("user","type",
"private",:onclick=>"Element.hide(''compagny'')")
%>Private
<%= radio_button ("user","type",
"compagny",:onclick=>"Element.show(''compagny'')",
:onchange=>
visual_effect(:Highlight, "compagny"))%>Compagny
---model----
validates_presence_of :compagny_name , :if => :type_required?
def type_required?
return true unless type = "compagny"
end
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---