Displaying 20 results from an estimated 10000 matches similar to: "single database field --> multiple fields on form"
2006 Apr 08
7
text_field and arrays
Hi,
I''m trying to do a bulk update on an array with the helper text_field.
I''m trying to create an inputfield for every object in the array, but
I''m not getting it right...
example:
class ClassA
@arrayB[]
end
HTML (code with error):
<% 0.upto(9) do |index| %>
<%= text_field ''ClassA'', ''arrayB[index]'' %>
non
2006 Jan 23
16
Adding form fields (extending a form) on the fly
Hello,
I just can''t seem to find a way to extend a form dynamically in ROR.
Say I am writing a recipe website. There is one form to enter the
recipe. There is room for N number of ingredients (let''s say a text
field for each ingredient name and selection list for the amount). What
if the user wants to add more than N ingredients as he types them in?
how do I do this without
2006 Jun 12
3
Multiple Form Fields with Same Model?
Hello,
I''m trying to create a form that will allow a user to submit a list of
phone numbers, but the list is dynamically created. Thus allowing my form
to submit an unknown number of phone numbers.
Here is some of the code I have been trying:
<%= collection_select( "phone[]", "phone_type_id",
PhoneType.find(:all, :order => "position"),
2006 Jul 27
2
setting initial text field values in a form
Hi,
I am trying to create a basic form in which I want one of the fields
initialized before displaying it.
My code (in a view) is as follows:
<%
if ( session[:user_id] != nil )
then
logged_in_user = User.find(session[:user_id])
end
%>
<% form_for :suggestion do |form| %>
<label for="suggestion_title">Topic:</label><br/>
<%=
2006 Mar 29
1
Help: Input of form 1 to hidden field in form 2?
Hi all I''m new to rails an i''m trying to build a step by step form /
process to gather data. For example:
form one:
User enters a 8 digit number
the submit button points to form 2.
form two:
the 8 digit number from form one becomes a hidden field in form 2.
The problem I have is that the entire hash from form 1 is showing up in
form two rather than just the input data.
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 Jan 13
5
Form field naming semantics question
Hi,
I have a question today regarding how the various form elements in
_form.rhtml are named.
I understand that for a database table "persons" with a column headed by
"name", then in _form.rhtml it will probably be like:
<p><label for="person_name">Name><br/>
<%= text_field ''person'', ''name''
2006 Feb 26
2
howto keep already entered form fields
Hi,
is there a way to keep the already entered form fields when the form is
re-displayed after some error has been detected and reported to the user
via flash?
Regards
IJD
--
Posted via http://www.ruby-forum.com/.
2006 Jul 06
3
Accessing form field contents
I have an HTML form on the screen, that is connected to a database
(standard Ruby way). I found that there are people that would rather not
fill in this information, but would rather search Amazon for the info.
Therefore, I added a link to the right of one of the fields that, when
pressed, will search Amazon for what ever you typed into that field.
So, how can I do that? At first I tried
2007 Sep 22
1
Rails newbie: passing a value to hidden form field, then getting it
Warning: I am as green as #00FF00 with rails :-)
I have an rhtml view that shows a survey: /views/survey/show.rhtml. I
have a Survey model, helper and controller. I''m using the
acts_as_commentable plugin to collect comments, and trying to save
user comments from users who have taken a survey (don''t ask -- it''s
just a test).
To save the comment, I need the id of the
2005 Dec 16
6
managing belongs_to fields in a form
Hi all,
I cannot find a clean way to create/edit an object that ''belongs_to''
another one, just by using form fields.
I always need to explicitely unassemble it, store the master id in a
hidden field, and then refetch the master from its id, and put it back
in the object.
To summarize:
I want to create a new member, for a given project
@project= ...
@member =
2006 Mar 17
1
How to update values in database in this form?
Hi,
This is my rHtml page & Corresponding actions & model pages:-
===listform.rHtml=================
<h1>Products List</h1>
<%= start_form_tag(:action => "add_to_cart")%>
<table>
<tr>
<%
i=0
%>
<th>
Product No.
</th>
<th>
Unit Price
</th>
<th>
Available Qty.
</th>
<th>
Demand Qty.
</th>
2006 Jun 15
1
Ok, I''m stumped on arrays of form fields
My Alert object has_many Links. I''ve got the whole system setup where,
once I have the Alert object created, I can use a nice form_remote to
show the user all the Links currently attached, and add more. But the
form itself starts out with 0 links.
What I''d like to do now is construct the form with a couple of default
"Place link here" objects in the array, and
2005 Dec 15
12
Adding multiple invoice items to an invoice on the same form
Hi Friends ,
Got a unique requirement .I am designing a invoice printing system
.So right now I have the NEW page for adding the invoice details to the
table .Now I have the requirement of adding Invoice Items In the same
form .I have added multiple text boxes to enter the values of the Items
using
<%= text_field ''invoiceitems[]'', ''item_price''
2006 Jun 20
1
Possible to check if form field is required?
Hi list,
is it possible to check if form field will be required when form is
submitted (through validates_presence_of or some other validates_*
method)? I could do this manually but it doesn''t seems to me very DRY.
For example, I would like to be able to dynamically add asterisk with
some helper method if city is required here:
City*: <%= text_field
2006 Jul 08
4
Hidden fields in forms
Please can someone show me the correct syntax for a hidden field in
forms, this is my code
<%= start_form_tag :action => ''create'' %>
<div class="form1">
<table width="auto" boader="8" cellspacing="5" cellpadding="5">
<% hidden_field ''line_item'', ''client_id'', :value
2006 Jun 23
2
Storing Array in Database
Hey all,
I''m storing an array of timestamps in a field in my database as an
array. When the items get saved, however, some minus signs are appended
to the text:
sample output:
---
- 1151971200
- 1152576000
- 1153180800
- 1153785600
- 1154390400
Is this normal behavior? When I retrive the value out of the database
and .to_a, the three minus signs (---) are counted as the first
2006 Jul 11
4
add method parameter for form helper
Hello,
Most of the form helpers are build using Object / Method without the
possibility of using a method parameter (as I know ...)
text_field(object_name, method, options = {})
how do you solve this problem ?
-> (I did my own helper and generate the html ... well I think there is
a better way;-)
-> do I have to overide text_field(object_name, method, parameters {},
options = {})
2006 Aug 16
4
Overwrite form helper methods and call old ones in new ones?
Hi all
All my forms should look the same, so I think always putting the right
div etc. tags around them is a violation of the DRY principle.
Until now my forms look like that:
<div class="text_field">
<label for="news_item_subject">Subject:</label> <%= text_field
"news_item", "subject" %>
</div>
Now I want the default
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