Displaying 20 results from an estimated 1000 matches similar to: "_form rendering question for adding multiple child objects"
2006 Feb 03
0
Instantiating multiple child objects
Hi,
I''ve been tinkering a bit with Ruby lately, and is truly amazed by its
automation, however some of it is a bit arcane for a newbie to
understand :|
Let''s say for instance I have a object Person which has_many
VehicleRegistrations, and I want to have a form that would enable me to
instantiate many VehicleRegistrations at once.
So supposing my form enables 2
2006 Jan 19
5
TIP: Using field_error_proc to add style attributes to form elements
I just put this up on the wiki, and thought I''d share in case it''s
useful to anyone else. This is handy if you don?t want to wrap your
input elements inside a div when an error occurs, but instead want to
add some sort of CSS style to fields with errors:
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
msg = instance.error_message
error_style =
2006 Jan 10
0
Changing scaffold''s text_field to a password_field causes white screen of death in mozilla?
I had posted earlier about ''silent failure of a controller'', what seemed to
be an intractable problem where I was getting failure of a particular action
in a controller while others worked. What was irritating was that there were
no useful messages. Nothing to the browser, nothing in logs, and even the
breakpoints wouldn''t hit. Finally by a process of elemination I found
2010 Aug 14
0
[rails3.0.0.beta4] extend form_tag to always include a hidden field
hi there,
I want every form in the site to add a hidden_field, basically I want them
to always submit the I18n.locale, I''ve tried to alias form_tag_html method
of ActionView::Helpers::FormTagHelper like this:
# in #{MY_APP_ROOT}/lib/action_view/helpers/form_tag_helper.rb
module ActionView::Helpers::FormTagHelper
def form_tag_html_with_locale(html_options)
form =
2006 Jun 24
1
select or select_tag ?
hello PPL,
I''ve seen now that the _form.rhtml generated by script/scaffold is
populated by
<%= text_field ''model'', ''field'' %> without _tag!
but only text_field_tag is to be found in the 1.1.2 documentation..
(like in the rest of Module ActionView::Helpers::FormTagHelper there
is _tag)
I''ve tried to use <%= select instead of
2006 Apr 05
1
FormTagHelper form names: possible?
Thank you to everybody that has helped me since I signed up. I''m flying
along thanks to you.
I have a question about the FormTagHelper "start_form_tag": I''ve been
trying to figure out how to get Rails to output a "name" attribute for
my form so I can hook in a Javascript to focus on a field inside of it
on load, but it doesn''t look like I can do
2008 May 30
1
Parameters for FormOptionsHelper select vs. FormTagHelper select_tag
I must be missing something when it comes to the parameter differences
between form FormOptionsHelper select and FormTagHelper select_tag.
Code that follows, works perfectly -
<%= f.select :unit, units_to_select(@product), :size=>"20"%>
The following code, does not. The helper function never even seems to
be called.
<%= select_tag "unit",
2006 Jan 21
1
text_area content with text_area and not text_area_tag ?
Hello,
Is it possible to fill the textarea content when using the text_area
function ?
Why there is 2 , + or - similar class : FormHelper and FormTagHelper ?
2005 Dec 19
0
ActionView::Helpers::FormHelper.text_field
Hi,
Is it possible to use the ActionView::Helpers::FormHelper.text_field with an
instance variable instead of a model. e.g.
In the controller:
def meth
@value = ''hi there''
end
In view:
<%= text_field ''value'', nil %>
It doesn''t work with what is above (doesn''t like the nil) and produces very
strange results replacing nil with
2006 Feb 27
2
submit_tag
How can i use the submit_tag method (from: actionView::FormTagHelper)
to create various submit buttons and chose the right action in accord to
the button that i pushed?
--
Posted via http://www.ruby-forum.com/.
2008 Jun 15
2
Add a class attribut into a form_tag
Hi, do you know how to add into this balise a class attribut:
<% form_tag :action => ''search'' do -%>
in order to do this in HTML:
<form action="/people/search" method="post" class="foo">
I had try to use the official documentation
(http://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html#M001036)
but that
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 Jun 19
3
Parent Child form using Partials
I am trying to make a simple application which consists of contacts and
their addresses.
class Contact < ActiveRecord::Base
has_many :addresses
end
class Address < ActiveRecord::Base
belongs_to :contact
end
I would like to be able to edit/add addresses from within the edit/add
of the contact. I scaffolded the contact and address objects and
modified the contacts/_form partial as
2006 Mar 27
0
Newbie stuff: Adding a New Library Class
Hi
I have been successful in playing around with model, views and controllers in Rails. Along the way, I learnt that some of the reusable stuff could be made library classes. I want to create a lib which will render a form and form elements.
I created a class Mylib.rb in /lib folder.
The class tructure looks like this
class Mylib
helper FormTagHelper
attr_accessor :name, :range,
2007 Nov 01
0
Using view helpers from a controller
Hi,
I want to access a view helper from a controller.
(Of course, you all want to know why??? -- See below.)
To be specific, I want to access methods such as
ActionView::Helpers::FormTagHelper -- form_tag and text_field_tag
from either a controller or from a new class (in models? or lib?).
If I create the new class then that class''s methods need to also be able
to access the
2006 Apr 29
1
can i alter the _form.rhtml without have troubles to validat
hello my name is reynaldo
and i have a problem
i alter the _form.rhtml to display a select option in the place a simple
text_box, and the application work very well, but in the moment that i
apply a validation in the model i get a error.
the code is the next
in the controller:
def new
@catelemento = Catelemento.new
@komandancias = Catcomandancia.find(:all)
end
in the
2006 Aug 07
0
select da tabella in _form.rhtml
Ben trovati.
Ho questa _form :
<%= error_messages_for ''requirement'' %>
<!--[form:requirement]-->
<p><label for="requirement[structure_id]">Struttura</label><br/>
<%=
@structures = Structure.find(:all, :order => "nome").map {|f|
[f.nome,f.id] }
select(:structure, :id, @structures)
%>
<p><label
2009 Feb 15
2
text_area_tag not escaping content by default
I stumbled on the fact that text_area_tag does not HTML escape its
content by default. For example:
text_area_tag "body", "</textarea><script>alert(''xss'');<script>"
If you try that, you''ll see that the content is inserted literally.
Considering the fact that the tag helpers all encode their attribute
values by default, does this
2007 Aug 05
0
Newbie - Question on Parent child updating
All,
I''ve just started Rails and Ruby a week or so ago. Please forgive me
for my ignorance. I started writing a small test application to test
some of my new knowledge and have hit a wall. Would like some best
practices.
I have 3 tables, as below...
CREATE TABLE `carts` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`quantity` int(11) NOT NULL,
PRIMARY
2005 Dec 16
4
Parent Child together in input form
Hi all,
I understand how rails is supposed to work when dealing with one entity
input form.
However, when I have a relation between two objects (composition):
Customer(1) --------> (1)Address
How can you create a inputform where both the properties of a Customer and
Address can be filled in?
Regards,
Harm de Laat
_______________________________________________
Rails mailing list