开发者

Ruby on Rails passing of parameters between views (not all being transferred)

I've been trying to trace this error for nearly 2 days now and I can't seem to understand what is going wrong. I'll explain:

I have 2 views (.html.erb format) ViewA has the following

<% form_tag (:action => 'ViewB') do %>

I have on this page a select_tag radius

text_field_tag searchQuery (disabled as is filled in already),

text_field_tag subSearch

text_field_tag LAT <%= text_field_tag 'LAT', "", :disabled => true, :size => 15, :id =>'LAT' %>

and another identical to LAT named LNG instead

and lastly a submit_tag Locate

When ViewB is being loaded, I am noticing the following from the ruby console:

  Parameters: {"subSearch"=>"Management Consultants", "commit"=>"Locate", "authenticity_token"=开发者_开发技巧>"XXJ+sfl2HkoInaj/1fNtIYpVLJ4NjTjJHY2oe18RPXs=", "radius"=>"5"} 

I cant understand why the other parameters are not being passed! Although they are disabled I believe this should effect them from being transmitted, (I have tried re-enabling them to no avail).

Does anyone have any ideas please? What am I doing wrong? I really require the Lat and Lng!


If you want to have the controls disabled and still submit the values, you could use hidden inputs in addition to the disabled text controls:

hidden_field_tag('LAT', '', :id => 'LAT_hidden')


As suggested by Phil Ross, the answer was to enable them! silly me!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜