Displaying 20 results from an estimated 8000 matches similar to: "Helper in controller?"
2006 Mar 06
2
form_tag error -- not found, 404 -- action DOES exist!
Hi -- I''ve got a very strange error.
I have an action called ''commit_input'' on a controller called
''SiteVisitController''. This definately exists, and is called from the
functional test for it, and passes fine.
My problem is with the form that is supposed to call this action.
The form tag is:
<%=
2006 Apr 06
3
Inserting parent_id
I have two tables:
- projects
- lines
lines has a foreign key constraint to projects.id
When I''m creating a new line object, the database fails on insert with
the following error:
"PGError: ERROR: null value in column "project_id" violates not-null
constraint"
My code looks like this:
def create_lines
@project = params[:id]
@line =
2007 Jan 28
3
end_form_tag not generating </form>
I put the following code at the end of my index.rhtml:
<%= form_tag :action => ''reverse'' %>
<%= end_form_tag %>
and I get the following code generated:
<form method="post" action="/chapter3/reverse"/>
</body>
... no </form> tag
I''ve checked in ActionView::Helpers::FormTagHelper and the
2006 Dec 08
4
select_date method
Hi Everyone,
I used "select_date" method in my application and got 3 select boxes
for Date, Month and Year.
Code :
<td><%= text_field ''content'', ''title'' %></td>
<td><%= text_field ''content'', ''description'' %></td>
<td><%= select_date %></td>
2006 Aug 02
7
form_for not working with Markaby
I''m playing around with Markaby and I decided to write a little blog app.
I''m running into issues with forms however. If I use form_for the output of
the form gets swallowed. For example:
form_for :article, @article do |f|
f.text_field :title
f.check_box :published
f.text_area :description
f.text_field :pub_date
f.text_area :content
end
gets rendered as an empty form
2007 Apr 20
1
Problem with form_tag
Hi all!
I''ve seen this problem in several places in the list, but none of the
remedies suggested seem to be helping me much.
I have a view like so:
HELLO
<% form_tag :action => "create" do %>
<p>My pretty form!</p>
<p><%= text_field "foo", "bar" %></p>
<p><%= submit_tag "Do
2006 Jul 21
1
Passing a variable between methods
Hi,
I am trying to add search functionality to may application. I am
struggeling to pass my query to the controller and then show all my
search results in another view. How would I do this?
Model:
class Advert < ActiveRecord::Base
belongs_to :user
def self.search(query)
if !query.to_s.strip.empty?
tokens = query.split.collect {|c| "%#{c.downcase}%"}
2006 Aug 04
1
Need a better undersanding of form helpers
perhaps someone can take a little time to give me a better
understanding of how to use form helpers.
Here is what I''m working with in my app:
user model - (the table where a user registers their information)
it contains the following fields -
first_name
last_name
email
account_type (currently set to string but will probably be a select
box with options)
password_salt (I''m
2006 Mar 13
2
Newbie: Can''t get file to upload
Since I can''t get the fancy upload progress thing to work, I thought
that I would revert back to a regular file upload scenario.
I have a very simple file upload form set up. It appears that my file
parameter is coming into the controller as a string, not a file object.
Here''s my view:
<%= form_tag :action => ''save_HTML'',
:multipart
2006 Mar 13
0
Controller handling of Non-model fields
I''m a bit confused about how the Controller works for calls that aren''t
intended to be remote (non-Ajax).
Specifically, if I don''t want to interact with a Model.
Does ":action => whatever" always result in a call to the server? Or is
it handled like a javascript function (locally, on the client) in the
cases where no Model interaction is needed?
For
2006 Apr 22
3
Creating a select dropdown box with links to methods
What would be the best way to create a form select dropdown box and upon
"submit" have it directly go to a controller method view?
I have something that somewhat works, but I think there is probably a
much easier way to do it. As of now, I have the dropdown list which
when the form is submitted is handed to a controller method which
basically
I have my dropdown box:
<%=
2006 Jan 11
0
error_messages_for >> Cannot convert Array into String
Hi all
I have the following Model:
Member(id, username, first_name, last_name, hashed_password,
password_salt)
Now I want to allow users to register for an account using the following
form:
---
<%= form_tag %>
<%= error_messages_for ''member'' %>
<p><%= _(''Username'') %>: <%= text_field(''member'',
2006 May 12
1
Uploading a file with form_remote_tag problem.
params[uploaded_file] is not recognised when i try form_remote_tag like
this:
<%= form_remote_tag :url=>{:action => "save_file"} ,:html=>{:multipart
=> true} <%=text_field_tag "name"%>
<input type="file" id="uploaded_file_file"
name="uploaded_file[file]"/>
<input type="submit"
2006 Apr 10
0
Rails form error message oddness...
To get error messages for my form to show up I have to repeat myself in
the controller so that the render of the view including error messages
show up.
-------------------------
My Controller:
-------------------------
class ClientsController < ApplicationController
#---- index --------------------------------
def index
list
render :action => ''list''
end
2009 Jul 29
6
Doubt in nil object with ajax
hi this is my htnl
<html>
<head>
<%= javascript_include_tag :defaults %>
</head>
<body>
<%= form_tag nil, { :id => ''search_form'' } %>
<%= text_field ''recipe'', ''name'' %>
<%= end_form_tag %>
<div id="recipe">
</div>
<%= observe_form :search_form, :frequency =>
2006 Jul 27
1
Routes not working when submitting a form
Hi,
I have the following code, a very basic textfield with a submit button:
<%= form_tag({:controller => "job", :action => "index"}, :method =>
''get'') %>
<%= text_field_tag ''province'', @province %>
<%= submit_tag "search" %>
<%= end_form_tag %>
In my routes.rb file I have:
map.connect
2006 Feb 27
2
Multiple forms on a page
Hello all.
I have the following Code in a view:
<% @dishes.each do |dish| -%>
<tr>
<td><%= link_to dish.name, :controller => "restaurant", :action =>
"show_dish", :id =>"#{dish.id}" -%>
<% if dish.vegetarian? -%>
<%= image_tag("/images/vegetarian.gif", :class => "bevel", :size =>
"8x8")
2006 Aug 12
2
How to add # anchor to ferret generated url ?
I have the following action in my controller
def search
@query = params[:query] || ''''
unless @query.blank?
@results = Residence.find_by_contents @query
end
end
In my View I have
<div id="search-box">
<%= form_tag( { :action => ''search''}, :method => ''get'')%>
<input type="text"
2006 Aug 12
2
Strange form_tag behaviour
I am trying to use a GET form to produce a URL of the form:
.../project/show/123
If I use:
<%= form_tag ({ :action => ''show'', :id => @project.id}, :method => ''get''
) %>
...
<%= submit_tag ''go'' %>
<%= end_form_tag %>
I get a URL back of the form:
.../projects/show/559?project%5Bid%5D=673&commit=go
The
2006 May 28
4
File_column trouble, advice needed
Finally i have RMagick and the file_column plugin installed, but at the
time of uploading images i have trouble, i get "uninitialized constant
ArtImage" error and other errors, im following the instructions on
http://wiki.rubyonrails.com/rails/pages/HowToUseFileColumn but doesnt
seems to work, this its the code im using:
#----view
<%=