Hi,
This is a select * from bestemmingen where bestemming_id=‘BCN’; of my
database
bestemming_id | naam | naam_en | landcode | airport_name |
alt_naam | dist_ams | stad_zoeknaam |
±--------------±----------±----------±---------±---------------±---------±---------±--------------+
| BCN | Barcelona | Barcelona | ES | Barcelona Arpt | NULL | 1240.3 | barcelona |
I want when the visitor is on the barcelona-page the destination input
is “pre-filled” with the value naam(name)+ bestemmings_id.
So in case of barcelona-page
html:
Has anyone experience with this…?
Grtz…remco
Roy P. wrote:
Will you know in your controller what the destination is? If so, you
could set the value there, and then use the hidden_field form helper to
create that input you want. Something like:
controller
place = Bestemmingen.find(params[:id])
@some_object = Search.new
@some_object.destination = “#{place.naam} (#{place.id})”
view
<% form_for @some_object do |f| %>
<%= f.hidden_field(:destination) %>
<% end %>
Something like that anyway…
HTH,
-Roy
Hi,
I don’t want this value in a hidden field, but i want that the value is
filled in…in a text-field. So the visitor can see the filled in value
in the form…
Grtz…remco
Will you know in your controller what the destination is? If so, you
could set the value there, and then use the hidden_field form helper to
create that input you want. Something like:
controller
place = Bestemmingen.find(params[:id])
@some_object = Search.new
@some_object.destination = “#{place.naam} (#{place.id})”
view
<% form_for @some_object do |f| %>
<%= f.hidden_field(:destination) %>
<% end %>
Something like that anyway…
HTH,
-Roy
Okay then–so same solution (set the attribute in the controller) just
use text_field instead of hidden_field.
HTH,
-Roy