Read text field value in controller

Hi, i’m newbie with rails

i’m try to pass the value of a text_field to the controller without a
submit all form.

this is the html.erb code

<% j = rel_issue.journals.find(:last, !:notes.nil?) unless j.nil? if j.notes.nil? %>
              <p><%= text_field :testo,relation.id.to_s %></p>

            <% else %>

              <p><%=text_field:testo,relation.id.to_s,value=>j.notes%></p>


            <%end
            end%>
  <%if rel_issue.status && !rel_issue.status.is_closed?%>

   <%= link_to_remote(image_tag('link_break.png'),
        {:url => {:controller => 'deda_roadmap', :action => 'evade',

:id => rel_issue.id, :project => @project}},
:submit => ‘testo_’+relation.id.to_s, :method =>
:post,:title => l(:label_evasion)) %>

        <% end %>
                  </td>

and this the controller code:

def evade
issue= Issue.find_by_id(params[:id])
parametro = “testo_”+issue.id.to_s
testo_nota = params[parametro]
if !testo_nota.nil?
ecc…

testo_nota is nil in controller and i don’t know why.

thanks for help.

On 16 August 2012 09:22, Paolo B. [email protected] wrote:

        if j.notes.nil? %>

:post,:title => l(:label_evasion)) %>
def evade
issue= Issue.find_by_id(params[:id])
parametro = “testo_”+issue.id.to_s
testo_nota = params[parametro]
if !testo_nota.nil?
ecc…

testo_nota is nil in controller and i don’t know why.

Have a look at the Rails Guide on debugging, it will show you
techniques that you can use to debug the code and work out where it is
going wrong.

Colin

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