在 Rails3 中是否有可能具有多部分形式 =>真&使用远程 =>真的 [英] Is it possible in Rails3, to have a multipart form => true & use remote => true

查看:12
本文介绍了在 Rails3 中是否有可能具有多部分形式 =>真&使用远程 =>真的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为包含 job_photos 的 @jobs 使用以下表单标签.

I'm using the following form tag for @jobs which have job_photos included.

<% form_for @jobs, :html => { :multipart => true }, :remote => true do |f| %>

表单非远程工作正常,但如果我添加远程 = > true,表单提交,返回 create.js 但不保存任何内容到数据库或错误?

The form works fine non-remote, but if I add the remote = > true, the form submits, returns create.js but doesn't save anything to the DB or error?

推荐答案

问题是您不能通过 AJAX 发布多部分表单.这不是 Rails 的限制.为了避免这种情况,您需要使用 iframe 技术(使用 responds_to_parent 插件可以更轻松)或使用 Flash 或 Silverlight 等技术.

The thing is that you cannot post a multipart form via AJAX. This is not a rails' limitation. In order to circumvent this, you need to use an iframe technique (which can be easier with responds_to_parent plugin) or use a technology like Flash or Silverlight.

这篇关于在 Rails3 中是否有可能具有多部分形式 =>真&amp;使用远程 =>真的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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