Hallo Forum,
ich habe ein kleines Problem mit HAML - vielleicht kann mir jemand helfen.
Ich arbeite an einer SINATRA-Application, die zum Rendern HAML verwendet.
Nun habe ich ein Formular, wo ich in einer Dropdown-Liste (Select Tag) Daten
von meinem Datamapper-Modell anzeigen und auswählen will.
Die Anzeige + Auswahl klappt soweit, aber beim erneuten Aufruf des Formulars
ist alles vergessen ;-(
1 2 3 4 5 6 7 8
|
%tr %td %label{:for => "pmodule"} Start with PDMS module: %td %select{:name => "pmodule"} - for pm in @pm %option{:selected => @pr.pmodule_name, :include_blank => true} #{pm.name}
|
P.S. @pm und @pr übergebe ich beim Aufruf der HAML-Seite
Hat jemand von euch eine Idee ?
Leider bin ich im Internet nur auf Lösungen zu Rails gestoßen, wie z.B.:
http://www.codeweblog.com/rails-use-of-select/ 1 2 3 4 5 6 7 8 9 10
|
api : select(object, method, choices, options = {}, html_options = {}) For example: <%= select( "payment", "id", { "Visa" => "1", "Mastercard" => "2"}) %>
api : select_tag(name, option_tags = nil, options = {}) Used as follows: <%= select_tag "payment", "<option>VISA</option>" %>
|
Vielen Dank im voraus,
Andreas