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

Assuming there are separate views for new and edit then just disable it in the edit view.

Colin

Colin Law wrote:

If you are using the same view for both how does the view know whether to submit a create or an update action?

Colin

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

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: