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

On 18 March 2010 05:30, Tony A. [email protected] 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

Colin L. wrote:

On 18 March 2010 05:30, Tony A. [email protected] 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 both

On 18 March 2010 12:04, Tony A. [email protected] wrote:

no  one  view  for  both

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 J. 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs