Tony Augustine
2010-Mar-18 05:30 UTC
how to disable a drop down list after selecting one value
my question is i have a drop down list to choose some vales from an xml file.after selecting one vaale and saving it will b saved. but when i tried to edit that it should be disabled. can any one provide solutions this is ma code fragment = f.select :name_type, Setting.unroll(:name_type), { :selected => (@name.name_type || "mathew").to_sym }, { :style => "width:300px",:disabled => "true" } here name_type is the name of variable declared in d xml file with that names.so what should b code 4 disabled -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Mar-18 11:50 UTC
Re: how to disable a drop down list after selecting one value
On 18 March 2010 05:30, Tony Augustine <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> my question is i have a drop down list to choose some vales from > an xml file.after selecting one vaale and saving it will b saved. > but when i tried to edit that it should be disabled. can any one > provide solutions > > this is ma code fragment > > = f.select :name_type, Setting.unroll(:name_type), { :selected > => (@name.name_type || "mathew").to_sym }, { :style => > "width:300px",:disabled => "true" } > > here name_type is the name of variable declared in d xml file with > that names.so what should b code 4 disabledAssuming there are separate views for new and edit then just disable it in the edit view. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tony Augustine
2010-Mar-18 12:04 UTC
Re: how to disable a drop down list after selecting one value
Colin Law wrote:> On 18 March 2010 05:30, Tony Augustine <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> >> here name_type is �the �name �of variable declared in �d �xml file with >> that �names.so �what �should b �code � �4 �disabled > > Assuming there are separate views for new and edit then just disable > it in the edit view. > > Colinno one view for both -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2010-Mar-18 12:19 UTC
Re: Re: how to disable a drop down list after selecting one value
On 18 March 2010 12:04, Tony Augustine <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote: >> On 18 March 2010 05:30, Tony Augustine <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> >>> here name_type is �the �name �of variable declared in �d �xml file with >>> that �names.so �what �should b �code � �4 �disabled >> >> Assuming there are separate views for new and edit then just disable >> it in the edit view. >> >> Colin > > no one view for bothIf you are using the same view for both how does the view know whether to submit a create or an update action? Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Andy Jeffries
2010-Mar-18 13:10 UTC
Re: how to disable a drop down list after selecting one value
> > this is ma code fragment > > = f.select :name_type, Setting.unroll(:name_type), { :selected > => (@name.name_type || "mathew").to_sym }, { :style => > "width:300px",:disabled => "true" } > > here name_type is the name of variable declared in d xml file with > that names.so what should b code 4 disabled >Try: = f.select :name_type, Setting.unroll(:name_type), { :selected => (@name.name_type || "mathew").to_sym }, { :style => "width:300px",:disabled => !@name.new_record? } Cheers, Andy -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tony Augustine
2010-Mar-19 05:27 UTC
Re: how to disable a drop down list after selecting one value
great sir.its working now.any way thnks. too got a logic butt not workn under some specific conditions. this code beats all of those Andy Jeffries wrote:>> >> this is ma code fragment >> >> = f.select :name_type, Setting.unroll(:name_type), { :selected >> => (@name.name_type || "mathew").to_sym }, { :style => >> "width:300px",:disabled => "true" } >> >> here name_type is the name of variable declared in d xml file with >> that names.so what should b code 4 disabled >> > > Try: > > = f.select :name_type, Setting.unroll(:name_type), { :selected > => (@name.name_type || "mathew").to_sym }, { :style => > "width:300px",:disabled => !@name.new_record? } > > Cheers, > > > Andy-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.