Giter Club home page Giter Club logo

Comments (5)

blbradley avatar blbradley commented on July 28, 2024

I had this problem also. I used ':remote => true' in the form tag instead. My form returns a JSON response and prints flash messages based on that response. Let me know if you need to see an example.

from jquery-modal-rails.

dhoss avatar dhoss commented on July 28, 2024

I'd like to see it.

from jquery-modal-rails.

blbradley avatar blbradley commented on July 28, 2024

app/views/spree/shared/_login.html.erb

<%= form_for Spree::User.new, :as => :spree_user, :url => spree.create_new_session_path, :format => :json, :remote => true do |f| %>
  <div id="password-credentials">
    <p>
      <%= f.label :email, Spree.t(:email) %><br />
      <%= f.email_field :email, :class => 'title', :tabindex => 1 %>
    </p>
    <p>
      <%= f.label :password, Spree.t(:password) %><br />
      <%= f.password_field :password, :class => 'title', :tabindex => 2 %>
    </p>
  </div>
  <p>
    <label>
      <%= f.check_box :remember_me %>
      <%= f.label :remember_me, Spree.t(:remember_me) %>
    </label>
  </p>

  <p><%= f.submit Spree.t(:login), :class => 'button primary', :tabindex => 3 %></p>
<% end %>

and respond to javascript in your controller.

from jquery-modal-rails.

brendanhatton avatar brendanhatton commented on July 28, 2024

I also have this same issue - I would like to see a full working example if anyone has one available

from jquery-modal-rails.

brendanhatton avatar brendanhatton commented on July 28, 2024

I found that having remote:true in the link_to_modal actually prevented the behaviour I would have expected. When I removed this, it seems that supplying a url (rather than a div) is sufficient to have the modal content load on ajax behaviour that I was looking for.

My link is now:
<%= link_to_modal 'Contact Us', feedbacks_contact_path, :class=>"contact-link" %>
and the controller at the feedbacks_contact_path renders the contents of the modal window. Adding ':remote => true' to the form allows the submission to be ajax. I also realised there is a demo app included in the gem, and it some some working examples (but some which are no longer working also).

from jquery-modal-rails.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.