开发者

Rails 3 - Simplemodal pop up with forms

I am trying to use Simplemodal as a pop up box on an index page and put a form to add a new user inside it. It's not working, says there is an undefined method. How do I make this开发者_开发问答 work? Does it have to do with :remote?

EDIT - Here's some code to hopefully explain a little better - from index.html.erb

<div id='basic-modal'>
   <input type='button' name='basic' value='Demo' class='basic'/>
</div>
   <!-- modal content -->
<div id="basic-modal-content">
      <%= render 'form' %>
</div>

My form is the standard scaffold form, my Client model has a place to add some basic information about a client. My controller is the standard controller that is generated with scaffold, and my application.html.erb adds the required .js files. When I take the

<%= render 'form' %>

out and put in just plain text, it works just fine. Does that help?


Although I haven't found the answer to using simplemodal for a modal box, I found this tutorial at Nettus which uses modalbox and facebox:

http://net.tutsplus.com/tutorials/ruby/how-to-build-an-unobtrusive-login-system-in-rails/

With a few changes for rails 3, this helped me put a form inside a modal box with no problems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜