Displaying 20 results from an estimated 2000 matches similar to: "Using partials with form_for"
2011 Aug 02
2
removing instance variables in partials?
Hi,
I read some articles about why partials should not have instance
variables in them. But in "Ruby on Rails 3 Tutorial" the author starts
with this partial:
View:
<%= form_for(@user) do |f| %>
<%= render ''shared/error_messages'' %>
Partial:
<% if @users.errors.any? %>
...
...
I thought removing the @user instance variable from the partial
2007 Oct 20
14
Problems with form_for and partials
i''m having problem with a form_for situation where i''m trying to DRY
out the repeated parts of my forms and put them in common/form and
render the form elements via another partial in controller_name/_form.
Here''s the first form
# app/views/common/form
<% form_for ... do |f| -%>
<%= render :partial => "params[:controller]/form", :object => f
2007 Sep 25
21
form_for and partials
I love form_for, but I really hate
<% form_for :person, @person, :url => {...} do |f| %>
...
<%= render :partial => ''form'', :locals => {''f'' => f}
...
<% end %>
I''ve been thinking of instead allowing
<% form_for :person, @person, :url => {...} do |f| %>
...
<%= f.partial ''form''
2008 Dec 02
1
form_for with partial using do |@f|
Is it possible to pass this FormBuilder object to a controller and then
back to a partial?
I have a form rendering a partial that i would like to update with a
call to my controller based on user selectable parameters, but when the
AJAX comes back, i get this error message because i cannot pass a form
builder object between the controller and the view:
"undefined method
2010 Mar 20
4
Displaying an image in a Rails form_for
Hi,
I''ve got a public\images\DownArrow.jpg
and app\views\expenses\new.html.erb that want to present this image in
the following context:
<p>
<%= f.label :vendor %><br />
<%= f.text_field :vendor %>
<%= f.image "DownArrow.jpg" %>
<br>
<%= select_tag "test",
options_for_select(@current_vendors.collect {
2009 Feb 09
2
how to get form parameters while using fields_for with nested attributes
hi all..
i am trying to use *fields_for* to get and save nested attributes in a form.
i have a ''Partner'' model associated with an ''Address'' model.
partner has_many :addresses
although the form is displaying fine, but on submitting it the following
error is shown:
*can''t convert HashWithIndifferentAccess into Array*
on this line:
*@partner =
2012 Sep 08
4
dash symbol
In the example below, what is the dash doing between the class
attribute and array:
(field_helpers -
[:label, :check_box, :radio_button, :fields_for, :hidden_field, :file_field]).each
do |selector|
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2005 Dec 27
2
Rewriting FormBuilder
Hi,
I want to extend formbuilder to make it output a lable (I know about
labeled_form_helper made by technoweenie), my own formating, and a
couple of extra tags inside the form attribute. I was easily able to
extend form_remote_to. But when I continue to adjust the way elements
are handled I don''t know how to continue. I can''t find the method
text_field thats should is
2010 May 28
8
form helpers don't seem to work with RJS files...
I’ve been spending a great deal of time chasing this problem. Hopefully
someone sees something obvious I’m doing wrong. Basically anytime I try
to call fields_for from an RJS file or within a partial in the RJS file,
I get the following error. My goal is simply to load a partial into a
div. The fields in this partial require fields_for though. And that’s
where the problem lies.
2006 Apr 23
3
custom form builder
In the API docs I found this:
"You can also build forms using a customized FormBuilder class. Subclass
FormBuilder and override or define some more helpers, then use your
custom builder "
I couldn''t find any further documentation on this. Where can I read more
about this formbuilder class? For starters, where would I define a
subclass of this class?
TIA,
Jeroen
--
2006 Jul 11
0
Arbitrary elements in form_for?
I would like to use form_for in my project so that I can easily change
the style of many forms at once. However, it seems to me like
FormBuilders only support certain kinds of form elements(!). Surely
there must be a way to add arbitrary labels/form elements to a form.
Let''s say I had a form that looks like:
ID: (plain-text label)
Name: (text field)
Birthdate: (date chooser)
Picture:
2009 Aug 11
5
Dynamic drop-downs in a form_for using AJAX remote_function - Help
Hello -
I am fairly new to Ruby on Rails, but feel like I am learning quick.
I have what seems to be a fairly unique issue as I cannot find much
out there that describes what I''m seeing. Hopefully it''s a very
simple fix, and I simply can''t see the forest through all the trees!
I am attempting to create 2 related drop-down lists in the same
form_for, both using
2006 Aug 05
1
form_for and partials
I''m getting an error in the partial when i try
<% form_for :name do |form| %>
<%= render_partial "#{@current_stage}" %>
<% end %>
So I assume that form_for does not have scope in the partial?
If that is the case what are my solutions...
Do I have to stick a <% form_for in every partial, or do i just change all
my inputs back to text_field
2006 Apr 15
0
form_for, partials, and rjs
Hi there!
Im trying to use rjs templates to add form fields to an existing form.
So for example a user could fill out a form and optionally hit a
link_to_remote and get another set of identical fields to fill before
sending. This would mean he/she could add ex. more than one record in
the same form.
The original form was rendered with form_for and using a partial:
<% form_for :example,
2010 Feb 07
0
using form_for in a partial
Hello,
I would like a user to fill out a form (a long contract) and then email
it to them, including the new values.
So I was leaning towards a partial or layout so I didn''t have to write
the contract twice. But that''s where I run into problems. The only
difference between the form (contract) and the email are the form tags
will be replaced with their actual values. For
2009 Mar 05
1
error_messages with form_tag
Hi
Am facing a problem in accessing the error_messages.
Actually am using form_tag is there any way with which i can access
error_messages with form_tag.
I don''t want to use form_for.
Thanks in Advancve
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
2011 Jan 05
16
Nicedit (rich text editor)
Hello, I''m trying to use Nicedit to improve my text_areas in some views
of my project.
I have installed jquery:
ruby script/plugin install git://github.com/aaronchi/jrails.git
nicEdit plugin:
ruby script/plugin install
git://github.com/sergio-fry/Simple-nicEdit.git
Add js in layout:
<%= javascript_include_tag ''nicEdit'', ''nicEditInit'' %>
Use it
2011 Sep 13
3
Accessing Rails helper method with_output_buffer
Hi all,
I cannot figure out how to correctly use the with_output_buffer helper
method (located in ActionView::Helpers::CaptureHelper) inside a custom
FormBuilder.
Below follows a simplified example.
I''m trying to achieve the following behavior in an ERB as suggested in
the form_for helper docs in the Rails source:
==========
<%= form_for @object, :builder => MyFormBuilder do
2010 Aug 23
3
Unable to upload images using native rails file upload
I am a rails newbie and am trying to build my first app. I have a jobs
and categories controller and models respectively.
CONTROLLER:
def new
@job = Job.new
@catergory = Catergory.all
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @job }
end
end
#THIS IS A group of 10 RADIO_BUTTONS TO SELECT A CATEGORY FROM. BY
DEFAULT THE FIRST
2011 Jul 27
2
rails 3.0.9 usability problem
If there is an error with the submitted password on a form, then both
the password and password confirmation text fields should be highlighted
in red. The default seems to be to highlight only the password field.
Any suggestions on how to correct that? Because rails magically handles
the highlighting, I''m not sure how to intercept that.
--
Posted via http://www.ruby-forum.com/.
--