Hi, thanks a lot for your reply. I understand your comments about mixing of rails and haml code, but "include_blank" isn't my big problem.
My problem is the "select mechanism", that means if I select an item and save, than this will be stored in the database (that's O.K.). But if I open the form again, the stored item will not pre-selected. Where is my mistake or how can I solve this ? On Jul 14, 7:17 pm, Raving Genius <[email protected]> wrote: > It seems like you're confusing a Rails' helper method (option_tag) > with regular HAML (%option). %option{}... is just telling HAML to > generate HTML (ie <option include_blank="include_blank">...</option>). > include_blank is not a valid HTML attribute, and even if it was, it > would belong to the select element, not option. :include_blank is an > option that some other Rails' helpers use to generate a blank option > element before generating the other option elements. I hope that helps > you understand what you posted. > > You have some potential solutions: > > * If you only need this in one or two places, just write it out. > Creating a partial/helper just isn't worth the effort. > * Create your own partials/helpers to use. If you only need a small > number of partials/helpers, I would recommend this. > * Figure out a way to incorporate ActionView so you can use Rails' > helpers. This would probably be more trouble than it is worth, but if > it is worth the trouble, why not upgrade your application to Rails? > > PS Ruby has a better looping syntax. Use @pm.each do |pm| > > On Jul 14, 4:02 am, wea_gruena <[email protected]> wrote: > > > > > Hallo, > > I'm new with HAML, a so called newbie ;-) > > > I have a problem with HAML an SINATRA inside a form. > > I want to use a select tag for display / selection of informations: > > > %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} > > > For Rails I've found informations like here (http://www.codeweblog.com/ > > rails-use-of-select/). > > > But for pure Ruby / Sinatra I've found nothing. > > > Can anybody help me ? > > > Thanks, > > Andreas -- You received this message because you are subscribed to the Google Groups "Haml" 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/haml?hl=en.
