mogli
#1
Hallo zusammen,
wie bekomme ich den Controllername in ein onchange-event einer
collection_select eingebunden. Folgendes habe ich probiert, funktioniert
aber nicht:
<%= collection_select(:account, :account_id, Account.find(:all,
:conditions => “typ_id = 10000”), :id, :matchcode,{},
{:onchange => “document.location.href=’/” + <%=
controller.controller_name -%> + “/’ +
this.options[this.selectedIndex].value”, :selected =>
session[:account_id]})%>
mogli
#2
lass mal das <%= … -%> um controller.controller_name weg; du bist
schon im Ruby Code
-Alex
2009/4/7 Dieter S. [email protected]:
mogli
#3
Alex P. wrote:
lass mal das <%= … -%> um controller.controller_name weg; du bist
schon im Ruby Code
-Alex
2009/4/7 Dieter S. [email protected]:
OK, hätte mir auch auffallen können.
Allerdings funktioniert es dann immer noch nicht, habe folgendes
getestet:
“document.location.href=’/’ controller.controller_name ‘/’ +
this.options[this.selectedIndex].value”
“document.location.href=’/’ + controller.controller_name + ‘/’ +
this.options[this.selectedIndex].value”
“document.location.href=’/controller.controller_name/’ +
this.options[this.selectedIndex].value”
Wie sieht denn die richtige Variante aus, st du mir da nochmal helfen
mogli
#4
hm… bin mir nicht sicher… aber mach nicht #controller_path genau das?
Niko.
Am 07.04.2009 um 11:00 schrieb Dieter S.:
mogli
#5
Juhu, Lösung selber gefunden:
“document.location.href=’/” + controller.controller_name.to_s + “/’ +
this.options[this.selectedIndex].value”
Danke