GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Facing issue in f.link_to_add in gem "nested_form" · Issue #353 · ryanb/nested_form

This repository was archived by the owner on Dec 12, 2021. It is now read-only.
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Facing issue in f.link_to_add in gem "nested_form" #353

Copy link
Copy link
Open
Open
Facing issue in f.link_to_add in gem "nested_form"#353
Copy link

Description

@dinshawraje
dinshawraje
opened on Jun 10, 2015
Issue body actions

Hi I am using gem "nested_form" and in my view I have given like this

<%= f.fields_for :tasks do |task_form| %>
  <%= task_form.text_field :name %>
  <div class="star-rating" ></div>   
  <%= task_form.text_field :rate %>
<% end %>
<p><%= f.link_to_add "Add a task", :tasks %></p>

In js file I have I have given this

$('.star-rating').raty({
    targetType : 'score',
    targetKeep : true

});

to show star rating I have used

gem 'jquery-raty-rails', github: 'bmc/jquery-raty-rails'
gem 'ratyrate'

so this add row but star rating is not shown I am attaching snapshot enter image description here

I have this type of design but when I click on Add A Task it does not render star-rating div it shows like this

enter image description here

I have included this in my js file

$(document).on('nested:fieldAdded', function(event){
  // this field was just inserted into your form
  var field = event.field; 
  // it's a jQuery object already! Now you can find date input
  var star = field.find('.star-rating');
  // and activate datepicker on it
  star.raty({
    targetType : 'score',
    targetKeep : true
    });
})

but still its not working.
Please guide how to render that div in nested-form.

Activity

  1. Startouf commented on Jun 28, 2015

    @Startouf
    Startouf
    on Jun 28, 2015
    More actions

    Does the javascript really fire on nested:fieldAdded ? If you add a line alert('it fires'), do you see the message when you click the add a task button ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.