Displaying 20 results from an estimated 3000 matches similar to: "beginner - default form values"
2006 Apr 17
2
Refreshing RHTML page with previously posted data?
All,
After a POST, I want to be able to redisplay a view with the data that
was previously entered when my controller action notices a validation
failure and calls render on the view that does the submit.
Example:
View x.rhtml - text field is filled in
Call controller action
Controller action fails validation calls render (:action => ''x'')
x.rthml shows up with blank text
2006 Mar 23
3
How to redisplay submitted data on validation error?
Hi!
If i have an object it''s easy.
But i''m making a simple contact form and i check if email address is
correct. If it''s not i redisplay the form with the info that there was
an error (should i use redirect_to or render :action? what''s the
difference?), but all previously submitted data is lost.
I tried creating variables using names of the form fields, but
2007 Jan 30
7
text_field_tag
can you use :confirm => ''great consequences'', :post => true within
text_field_tag options?
I''m trying to confirm with users that changing that particular field
will have great consequences.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
2006 Jul 15
4
updating multiple records with form
I have an app that has two models -- products and details. I''m building
a form that allows a user to create a new product and specify a
description, etc.
The form needs to allow for creation of multiple items in the details
model/table. for example, I have a block of form items that collect
info for the men''s version of the product -- inventory count for each
size, etc. And
2008 Apr 05
2
model select and non-model select_tag
Hello everyone, I''m just trying to understand some logical reasons
behind Rails syntax of "select" and "select_tag".
I know I can do this:
<%= form.select :card_type, supported_card_types,
{ :prompt => "Please Select..."} %>
which sets a model field in the params hash.
If I want to do the same for a non-model field,
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
2008 Jan 25
2
form formatting
If I want to use fbml elements and rails tags, is there a way to do
within a fb:editor?
if I do:
<% facebook_form_for(:task, at task,:url => create_task_path) do |f| %>
Assign Task To: <%= fb_friend_selector %>
<%=f.text_field :ttype, :label=> "Title"%>
<%=text_field_tag :newrnumdays, ndays, :label => "# Days"%>
2006 Jul 30
1
Insert multiple new child records with the parent
Hello,
I am implementing a classic invoice application. On the create new
invoice page
I want to allow users to add new line items using AJAX:
-----------------------------------------------------------------------------
Invoice Date [ ]
Client [ ]
Line Items
1. [ ] $[ ]
<add new line item>
<save> <cancel>
2006 Jun 02
4
Creating an array of params
I''ve got a bunch of text fields that I''d like to access as an array.
The code looks like this:
<%= text_field_tag "people[0][entry]" %>
<%= text_field_tag "people[1][entry]" %>
<%= text_field_tag "people[2][entry]" %>
So when I submit the form, I''d like to be able to use it like
params[:people].each {|p| p[:entry]}
2006 May 10
3
text_field_tag options
Hi all,
can someone explain to me how the options for helper text_field_tag
supposed to be written. I really tried a bunch of stuff without success.
For example I need a field with id "query", so I write
<%= text_field_tag :query %>
which works fine.
But what if I want the field only 5 characters big? I tried among other
<%= text_field_tag :query ,
2007 Feb 25
5
Dynamically uploading a list that's already in a form
I have the classic case of: Posts, and Categories. When the user submits
a post, he has a drop-down list of categories. I want to put a "Add
category" link next to the list of categories.
This is already inside a form, so a "link_to_remote" that creates a
small AJAX form inside the "submit post" form will not work because that
will mean to embed a form in another
2005 Dec 26
3
Override Validation?
Hi all,
is there a way to override the validation methods so as to avoid the
div.fieldWithErrors divs from being created on the redisplayed form?
Many thanks in advance,
Nicky
2006 Feb 04
1
Error when using form helper and child objects
Hi,
This is one problem that has gotten me stumped for quite a while. I have
an Item that has_many :DeliveryMethod, and what I seek to achieve is to
create a form that''d let me create an Item, as well as its
DeliveryMethods in 1 single form.
And so I tried something like:
<%= text_field_tag ''Item[DeliveryMethod][price]'', @Item.DeliveryMethod
?
2006 Jul 08
1
Ajax, RJS, and Standard Form Errors
Hi all,
I''m trying to take the standard scaffold and add a bit for ajax to it. I
have a two column page with the list on the left and the right side is
reserved for the create/edit actions. On a successful save my rjs executes
and updates the list view on the left and returns the right side to a "home"
page. However, if one of the model validations fail I use rjs ro
2006 May 19
1
pass text_field to controller when using periodically_call_r
Hi. Can anyone help with this? In a view, I have a text_field_tag(
:mytextfield ). I would like to pass the current value of that
text_field_tag to a periodically_call_remote - something like
periodically_call_remote( :url => { :action => :do_it, :thetextval =>
:mytextfield.value } ) - Any idea how can I pass and/or access the value
of the text_field_tag in my do_it controller?
2008 Feb 20
1
text_field_tag - different parameter name
Hi, I have one problem with validation
I am creating e-shop and I have products. This view look like this:
<% for product in @category.products %>
<div class="produktyBox">
<%= product.title %><br />
Price: <br />
<div style="color:red; font-size:large; font-weight:bold; margin-
bottom:5px"><%=
2006 Jul 01
3
best approach to add form elements dynamically
I am struggling with how to add dynamically add form elements to a form
based on user action. Now here is my situation:
I have model Project that has_many line_items
On the form to create a project I initially display form elements (some
drop downs and text boxes) for adding just one line_item. There is also
a button or a link on the page (not sure if this should be in the main
form or
2009 Feb 24
1
How do I clear values from text_field_tag after browser refresh????
Hi all,
I''m having an issue with text_field_tag. I want to reset the value of
the text_field when I refresh my browser, seems like a very simple
thing, however I''m having hard time finding the answer.
After I input some values, how do i reset the value to nil or empty??
my code is below
<%= text_field_tag ''login'', @login, :class =>
2010 Jul 26
1
form date helper with text year
I have a date where the year range is more then I want to define in a
select_date scaffold generated year range.
My idea was to have the year entered as a text field and the month and
day using something like:
<%= select_month @person.born,:prefix => :person ,:field_name =>
"born(2i)" %>
<%= select_day @person.born,:prefix => :person , :field_name =>
2007 Dec 14
3
using the session to pass a value from form to controller
I have a form in which a bunch of new users can be created with the same
password if desired. I''m trying to write the password into the session
and pull it out in the controller (besides avoiding putting it into
params, this also should let me keep it for repopulating the text field
if the creation fails for any reason and the user gets sent back to the
page with the form).
As part of a