You are here: Forums Ask a Rails expert link_to image_tag problem...
Posted in Forums : Ask a Rails expert
Authority 0
Posting Rating 14
Sign in to rate this post
|
Hello In a page of my rails application I have the following code: ... As you can see, I am creating a text_field_tag with a dynamic ID. I tried like the following but it dont work… <%= link_to image_tag(“ok.jpg”, :border=>0), :controller => ‘entry’, :action => ‘setconfig’, :before => ‘busyMousePointer()’, :id => valconfig.id.to_i.to_s, :value => $F(valconfig.id.to_i.to_s), :only_path => false %> The problem is that the ID of the text_field_tag is dynamically generated (and it must be)... Thanks |
Authority 0
Posting Rating 14
Sign in to rate this post
|
I’m still not have found the solution for my problem… |
Authority 62
Posting Rating 100
Sign in to rate this post
|
Does the id really need to be dynamic or do you just need a dynamic name? Because in my experience, you hardly ever need dynamic ids like this. Maybe that helps. |
Authority 12
Posting Rating 98
Sign in to rate this post
|
Try generating the url at the onclick event and redirecting via location.href: <%= link_to image_tag(“ok.jpg”, :border => 0), ”#”, :onclick => “location.href = ’/entry/#{valconfig.id.to_s}/setconfig?value=’ + $F(’#{valconfig.id.to_s}’);” %> Hope that works. |
Authority 0
Posting Rating 14
Sign in to rate this post
|
Tanks for your help. I’m gonna try the location.href solution. Thanks. Best regards. |
Ask a Rails expert : json gem error
Ask a Rails expert : Problem with break
Ask a Rails expert : activesupport string first method error
Ask a Rails expert : url_for broken ?
Ask a Rails expert : map.routes.rb pls help
Ask a Rails expert : how to h tag in controller
Ask a Rails expert : Problem with Restful routing and partial form
Ask a Rails expert : will_paginate, search and ajax
Ask a Rails expert : Mass Deletes in Admin Section