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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to