similar to: ERb question: Embedding <%= %> in helper method calls

Displaying 20 results from an estimated 4000 matches similar to: "ERb question: Embedding <%= %> in helper method calls"

2006 Jul 14
7
Form validation - keepin correct fields displayed on refresh
All, I''m finally doing my first real form in Rails - the model object that I''m entering information for has 8 validations so far. If I type in good values for all the fields but one, I get the pretty validation, and the nice field highlighting, but all of the fields are cleared, forcing me to retype all of that info. That is a big drag. Is there a standard way to get the
2006 Aug 18
3
setting a value of text_field from a controller
Hi, I need to set up an initial value from controller. In my views I''ve something like <%= text_field "object", "name" %> and would like to do something like this from controller def index @object[:name] = ''default value'' end but still got an error. Object doesn''t have database model (and will not have) Thank you PS: now using
2006 Jul 15
7
:maxsize => 30 in form not working
Well, I''ve researched the books and the web to no avail (I tried the search here too but kept getting page not found.I''m doing what the examples say to do but I cannot get this work. The form allows entry of characters beyond the maxsize which causes the app to abend giving me the browser page showing a trace with the following info preceding the trace: Mysql::Error:
2006 Jun 13
2
Custom Primary Key, Using Primary Key in Form "gives before_type_cast" error?
Hi guys, I''ve got a problem here which i need help from the pro''s in this mailing list I have a legacy app where the User table has a custom structure where "User_id" (username) is the primary key as well as the username used to log in User.rb (model) class User < ActiveRecord::Base set_table_name "cmf901" set_primary_key "user_id" end
2006 Jul 11
4
checkboxes with a has_many :through relation
All, I''m populating a view with checkboxes in a list. I want to be able to assign to my has_many relationship using the post values of these checkboxes. Essentially, I want to populate the relationship table which will create the correct join values in my model. Here is my check_box_tag code: <%= check_box_tag("@current_job[target_list_ids][]",
2006 Jul 03
4
text_field doesn''t call overridden ActiveRecord getters
All, In a template, I have <%= text_field :target_list, :DateReceived, { :title => ''uploaded_at'', :class => ''target_list_info'', :disabled => ''true'' } %> Here is the DateReceived method on my
2007 Nov 18
2
Variable inside of another variable
Hi everyone, I''m building partial and I need to use a variable inside of another variable name: I''ve tried like this: <div class="form_row"> <label for="<%= field %>"><%= field_title || field.humanize %>:</ label> <%= form.text_field field, :size => User::field.upcase_SIZE,
2008 Jan 16
4
ActionController::InvalidAuthenticityToken in LoginController
Hi, I''m having a problem trying to get a login controller working. When I try and post to my login controller I get the following error: ActionController::InvalidAuthenticityToken in LoginController#login login_controller: class LoginController < ApplicationController def login case request.method when :post if @session[''user''] =
2006 Jul 13
4
Does text_field go directly to attributes hash in AR object?
All, I''m having a hell of a time figuring out what is going on here. I''m trying to override one of my getters so that I can format it a certain way in my form. But I can''t seem to get text_field to call the appropriate method on my object. So here''s my getter: public def FAX fax = read_attribute(:FAX) puts fax
2006 Jul 18
1
Auto-populating time portion of a datetime field from a form
I see that if I use the date_select helper in my view, then in the generated page, my selects are named obj[datetime_field(1i)] (and 2i and 3i for the other parts). These auto-populate the date portion of my datetime_field. I have another datetime field that I''m presenting the time from and I would like to use a similar scheme to autopopulate it. Currently, I''ve used the
2006 Jan 13
9
form_remote_tag breaks inside table
i guess its better form to keep form tags outside of table tags anyways, but it took a lot of trial and error to figure out thats why @params were no longer showing up after switching form_tag to form_remote_tag. not sure if this is a prototype ''bug'' or ''feature'' or what. but my next step was to switch to a seperate form tag for each row to reduce needless
2006 Apr 05
25
How to avoid bunch of <% %> ??
Hello, I would like to know is there is a way to avoid poluting the views with tons of <% %> ? Like this <%= start_form_tag() %> <%= text_field_tag(''category[title]'', category.title, {:size => 20, :maxlength => 128}) %> <% if not category.parent_id.nil? %> <%= select("category", "parent_id", Category.find(:all,
2006 Feb 02
4
Doubts on validation
Hi All, View ******** <tr> <td><b>Student: </b></td> <td><%= text_field "student", "fname", "size" => 40, "maxlength" => 40 %></td> </tr> <tr> <td><b>Program: </b></td> <td><select id="student_program_id"
2006 Jul 06
3
Understanding date_select naming conventions
I am using the date_select helper to generate date select elements in a form. I notice that the generated HTML shows that these selects have the following names: Month: current_job[StartDate(2i)] Day: current_job[StartDate(3i)] Year: current_job[StartDate(1i)] I''m assuming that the Xi identifiers somehow specify the appropriate date part from a date or time value. Can anyone
2008 Mar 19
5
object_transactions plugin w/2.x disables AR session store
All, Win XP Rails 2.0.2 object_transactions plugin (http://code.bitsweat.net/svn/object_transactions/) transaction-simple gem 1.4 (required by object_transactions plugin) AR SQL Server Adapter 1.0 SQL Server 2000 Using the object_transactions plugin with Rails 2.0.2 (and I assume based on what I''m seeing that this goes for Rails 2.x) disables the ability to save to an ActiveRecord based
2006 May 22
6
how HTML_Option works?
Hi all, all the form helpers can take a serie for options but I cant find any documentation about them. Any one can point me toward one? Or at least tell me how I can for example add a function that would be call with the onblur event from a input box? Thanks! -- Posted via http://www.ruby-forum.com/.
2006 Mar 18
9
Using <%= text_field %> within partials is problematic
All, Thanks for any help in advance. I have what I think is a very straightforward partial template and I can''t figure out why a text_field call within it doesn''t work. Here is my calling template: lists.rhtml <div id="target_lists"> <%= render(:partial => "target_lists", :collection => @target_lists) %> </div> In the partial
2006 May 09
1
Reusing a model to form and link_to.
Hy guys, Inside my app I have a form which contains user information. Sometimes a have a form with a text_field as above: <%= form_remote_tag(:html => { :action => url_for(:controller => "my_controller", :action => "my_action") }) %> <%= text_field(''my_object'', ''my_parameter'', :maxlength =>
2006 Mar 26
4
Updating query results in real time with AJAX
I have the following view template: <%= form_remote_tag :update => "new_item", :url => {:action => ''create''}, :before => %(Element.show(''spinner'')), :success => %(Element.hide(''spinner'')) %> <div id="new_item"> </div>
2010 Dec 14
4
Custom form error messages
Hi, What do I have to override in order to be able to have the error message of each field in front of the input field? I haven''t been able to find anything similar on google. All I''ve found is how to override the container around the input field. ActionView::Base.field_error_proc = Proc.new { |html_tag, instance| "<span