zanoni
October 29, 2006, 1:28pm
1
I want to have a link in certain areas of my form that will say [+add]
and that will dynamically add a form element to that area.
For instance, if there are 2 text_fields, and user wants 3.
I know that there are some hide/unhide options , though I’m not sure how
that works, however I think if
there’s a way to add them would be better .
Any suggestions ?
Stuart
Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla
The te...
zanoni
October 29, 2006, 2:02pm
2
I’m running into an error that I’m unsure of how to proceed with:
So in the form I’ve added a link_to_remote
<%= link_to_remote “[+]”,
:update => ‘xtratitle’,
:url => {:action => “add_title_field”} %>
The action:
def add_title_field
render(:partial => ‘txtfield’)
end
The partial:
<%= text_field(:canlocation, :city, “index” => 1)%>
So all I really want to do is add a text field into the form. Maybe
link_to_remote is the wrong call.
I’m getting an error :
ActiveRecord::RecordNotFound in CanpositionsController#add_title_field
Couldn’t find Candidate without an ID
It looks like (this is a restful controller) that it’s hitting my
before_filter to find the candidate id.
Any ideas ?
TIA
Stuart
On 10/29/06, Dark A. [email protected] wrote:
Stuart
Dark ambient - Wikipedia
–
Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla
The te...
zanoni
October 29, 2006, 3:22pm
3
On 10/29/06, Dark A. [email protected] wrote:
render(:partial => 'txtfield')
end
The partial:
<%= text_field(:canlocation, :city, “index” => 1)%>
I got this to work, but odd that it only works once? In other words it
won’t
continue to generate text_fields.
Guess I’ll have to add another partial ?
Stuart
On 10/29/06, Dark A. [email protected] wrote:
Stuart
Dark ambient - Wikipedia
–
Dark ambient - Wikipedia
–
Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla
The te...
zanoni
October 29, 2006, 11:03pm
4
On Oct 29, 2006, at 7:51 AM, koloa wrote:
cant help but if you find the answer, please let me know.
id like to do something like this but with photos.
Ok so you don't need an ajax call for this it is overkill. All you
really need is some javascript to add a new form element. So here is
a js function that will insert a new text_field when you click a link.
<% form_for(:whatever, :url => whateverss_path) do |f| %>
<%= text_filed ‘whatever’, ‘foo’ %>
<%= link_to_function “[+] add”, “addNewTextField(‘buttons_info’,
‘canlocation’, ‘city’)” %>
<%= submit_tag "Submit" %>
<% end %>
Have fun with it.
– Ezra Z.
– Lead Rails Evangelist
– [email protected]
– Engine Y., Serious Rails Hosting
– (866) 518-YARD (9273)
zanoni
October 29, 2006, 4:51pm
5
cant help but if you find the answer, please let me know.
id like to do something like this but with photos.