Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ncri committed Nov 11, 2013
1 parent b094dc9 commit c9545cc
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ Links to add and remove fields can be added using the *add_nested_fields_link* a
= f.add_nested_fields_link :videos

Note that *remove_nested_fields_link* needs to be called within the *nested_fields_for* call and *add_nested_fields_link* outside of it via the parent builder.
There are 4 javascipt events firing before and after addition/removal of the fields in the *nested_form_fields* namespace. Namely:
fields_adding, fields_added, fields_removing, fields_removed

CoffeeScript sample:

$(document).bind "fields_added.nested_form_fields", (event,param) ->
switch param.object_class
when "video"
console.log "Video object added"
else
console.log "INFO: Fields were successfully added, callback not handled."

You can change the link text of *remove_nested_fields_link* and *add_nested_fields_link* like this:

Expand All @@ -76,6 +65,18 @@ You can change the type of the element wrapping the nested fields using the *wra
The default wrapper element is a fieldset. To add legend element to the fieldset use:

= f.nested_fields_for :videos, legend: "Video" do |ff|

There are 4 javascipt events firing before and after addition/removal of the fields in the *nested_form_fields* namespace. Namely:
fields_adding, fields_added, fields_removing, fields_removed.

CoffeeScript sample:

$(document).on "fields_added.nested_form_fields", (event,param) ->
switch param.object_class
when "video"
console.log "Video object added"
else
console.log "INFO: Fields were successfully added, callback not handled."


## Contributing
Expand Down

0 comments on commit c9545cc

Please sign in to comment.