Displaying 20 results from an estimated 10000 matches similar to: "Form Field Helpers... Do they need objects?"
2006 Aug 10
2
check_box form helper questions/issues
I''m using Rails 1.1.x and it looks like the check_box form helper
expects me to provide and object and method so it can determine if the
checkbox should be checked or not. I''m having a couple of issues with
this.
note: I''m using UserEngine and adding a HABTM so that:
class User < ActiveRecord::Base
has_and_belongs_to_many :foos
end
class foo <
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 Feb 13
2
how to find the helpers code ?
Hello,
i have the application set up on my radrails. I was looking at the view
generated by scaffold and i see a bunch of names, after looking up
internet i found that they are helpers and generate the HTML for us.
Now, i wanted to look at the helper code for start_form_tag, so that
based on that i could write some of my own helpers in my helper
classes... but i could not find the code
2008 Dec 16
5
More than one submit_tag in a single form
Hai everyone ,
I have a list of users(each user in a row)and an Approve button for each
user. I wish to change the status of the user to be approved when I
click on the Approve button of a user. When I tried getting all the
users in the params hash. I want to get the id of the user according to
which "Approve" button I clicked. How can I implement this one?
Thanks in advance.
--
Posted
2006 Apr 20
5
Integrating with Legacy Databases
This seems like it must have been asked before - I really _did_ try to
find it in the archives, so my apologies if it''s already out there.
Utilizing ActiveRecord, I would like to specify a prefix for the
column names in my table. For example, in ''Recipe 16 Integrating with
Legacy Databases'' (Rails Recipes, from PragProg, by Fowler) they deal
with integration with a
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
2005 Nov 22
3
Idiom for submit button?
What is the rails idiom for submit buttons on forms?
All other field types have helpers, but button_to creates its
own form, so should not be used. I''ve looked in "Agile Web Dev. with
Rails" but can''t see what I should do instead.
Is this "difficult" because it runs counter to AJAX type forms?
And, related, is there a way to ensure that hitting return in
2012 Oct 12
3
CheckBox with Value and Drop down menu
I am a newbie in Ruby. I would to ask from all the experts in Ruby on
how to create a checkbox with value as well as a dropdown menu. I want
it like this site
http://www.celiac.com/glutenfreemall/advanced_search.php. Their search
form is good and I want to learn every aspect in doing it. Hope you can
give me a step-by-step tutorial in doing it.
Thanks in advance.
--
Posted via
2006 May 03
1
nil.strip error While trying to post xml data over https.
I am trying to subit some xml data over https to access an API. My code
so far seems to generate a very non-helpful error in the guts of the
net/http library. This code produces a NoMethodError for nil.strip"
require ''net/http''
require ''net/https''
require ''uri''
url =
2006 Apr 12
2
Collection has next question
Hi,
I know about pagination but dont want to use that option if it all
possible.
How in a collection of posts can i check if the there is a next item in
the collection and then add that an object.
For instance:
//Returns all the posts into a collection called posts
@posts = Post.find(:all)
//Returns a specific post based on an id
@post = Post.find(params[:id])
//How can i return the next
2006 Jul 19
6
Howto: Check_box with a variable (no model)
Hi,
I would like to put a checkbox on a form where the input field is a
variable rather than a field in a model.
The normal way (with a model) would be:
<%= check_box(''client'', ''accept'', {}, "1", "0") %>
But since accept is a variable @accept and model client will not be
there, how do I make a check box work?
Regards,
Paul
2005 Dec 14
4
newbie q: Form element focus
This is probably a dumb question, but is there an easy way to set the
focus of a form to the first visible/editable element? I''ve been
googling lots and searching documentation and haven''t come up with
anything. Help would be appreciated.
--
Posted via http://www.ruby-forum.com/.
2007 May 17
4
How to mock helpers in view specs ?
Hi all,
I am mocking the following Rails view (inside a partial):
<%= render :partial => "forums/forum",
:collection => forum_category.forums.readable_by(current_user? ?
current_user : nil) %>
My spec fails with the following message:
1)
ActionView::TemplateError in ''forum_categories/index (anonymous user)
should only render forums accessible to anonymous
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.
2007 Oct 09
23
Testing layouts with RSpec on Rails
Hey guys,
Does anyone have any wisdom to share on the subject of speccing Rails
layouts?
Most of it''s plain old view specs stuff, but are there sensible ways
to verify things like the yield call? (Mocking doesn''t catch that)
Thanks,
Matt
--
Matt Patterson | Design & Code
<matt at reprocessed org> | http://www.reprocessed.org/
2006 Mar 14
7
Single form w/ relationships: how do I integrate it?
OK - I know this has been asked before, but I cannot find it in the
archives. Forgive me if I''m creating more noise than I should.
I want to know the easiest way to deal with this scenario:
I have articles. I have categories for the articles.
On the form where you write an article, there needs to be a free-form
field to entire the category.
The create() method will build the
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
2010 Feb 14
2
paperclip is making me crazy
seems pretty simple, my model...
has_attached_file :pic_1, :styles => { :thumb => "120x90" },
:url => "/:attachment/:id_:style.:extension",
:path => ":rails_root/public/system/:attachment/:id_:style.:extension"
my view...
<% form_tag(:action => ''create'', :html => { :multipart => true }) do -%>
<label
2006 Mar 25
1
Automatically Filling in form field tags
I have a form which is predominantly a customer form (first name, last
name, etc), if there is a form error and I render to the form from the
controller the customer details are filled in correctly.
The question I have is, I have some fields which are _tag fields not
related to the customer model, how do I get them populated when I render
back to the form on error?
Cheers,
Dan
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/.