Rails和模式Jquery对话框形式 [英] Rails and modal jquery dialog form

查看:89
本文介绍了Rails和模式Jquery对话框形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是刚开始使用带有Rails的jquery模态对话框,并且想知道如何做到这一点:

I'm new to using jquery modal dialog boxes with rails and was wondering how I can :

  1. 显示一个jQuery模式对话框 1个字段(例如标题")
  2. 将此表单发布到Rails控制器(通过 ajax)
  3. 具有模式对话框形式 如果未填写字段,则重新显示 (在错误字段中显示正常的红色CSS)
  1. show a jquery modal dialog box with 1 field (eg "title")
  2. post this form to a rails controller (via ajax)
  3. have the modal dialog form redisplay if field is not filled in (with normal red css in error field)

欢迎使用任何教程或示例.

Any tutorials or examples welcome.

使用Rails 3和jQuery.谢谢您的时间.

Using Rails 3 and jQuery. Thanks for your time.

推荐答案

以下是我如何执行此操作的示例: https: //github.com/ramblex/modal-form .

Here's an example of how I'd do it: https://github.com/ramblex/modal-form.

您应该能够:

  1. 下载该应用
  2. 运行捆绑包
  3. rake db:migrate
  4. rails s
  5. 转到localhost:3000/articles,当您单击新建文章"链接时,将出现模式形式.

当标题字段保留为空时,将显示错误消息.否则,它应该创建该文章并显示它.

An error message should be shown when the title field is left empty. Otherwise it should create the article and display it.

希望有帮助.

这篇关于Rails和模式Jquery对话框形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆