-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Got working with nested forms #79
base: master
Are you sure you want to change the base?
Got working with nested forms #79
Conversation
Thank you for this, but I would rather not break ie 8 compatibility just yet. I'll keep this pull open in case we can figure out a solution. |
When I understand it correctly, we need forms to keep this gem compatible with IE <= 9? What are our options? I was thinking about inserting a hidden form somewhere on the page on the fly (e.g. as a child of the body tag). This way we don't have to nest forms anymore, but still keep the IE compatibility. Would this be possible? |
@@ -72,7 +98,6 @@ def policy_data | |||
{ | |||
expiration: @options[:expiration], | |||
conditions: [ | |||
["starts-with", "$utf8", ""], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed? If you use a Rails' form_tag it will create a hidden input element with this attribute by default.
After looking over the code, I actually don't think we will have problems with IE here. What issues did you run up against with IE? |
We dont have problems with IE if we still use the form as the s3_uploader. However if you us a file_field then it will not work. If we use a file field $uploadForm will have not attribute action. |
I found another neat workaround. Use a label for="id" where the input is in another form, the s3_upload_form and is positioned absolutely -9999px on the left. It works great in every browser except Firefox. Here's a crappy workaround for that though. # Hack for Mozilla to click label for file inputs.
if $.browser.mozilla
$(document).on "click", "label", (e) ->
$(@control).click() if e.currentTarget is this and e.target.nodeName isnt "INPUT" |
Hi, I need lil help. I am facing an error: |
Any progress on this topic? It would be so great if we come up with a solution for this topic... If we can't solve the IE issue at the moment, what about a temporary |
Just showing interest here. I'd like to see support for nested forms. Thanks @waynehoover and @anark |
I'd like to see this feature too. Btw. @maletor solution is not working for me. |
OK, I made it work for IE7-10, probably 6 too: |
I'd also like a built-in/documented way of handling file upload(s) in the context of a larger form. (likely setting a hidden field in the parent form, disabling submission while uploading...). |
+1 |
@sheerun would you be willing to send a pull based on your work? |
Well, I don't think it should be merged, it totally changes the way this plugin works (form -> field). It's rather proof of concept for new gem like s3_upload_field or something. |
@sheerun Wouldn't it make sense to have |
That's more likely, but I need find time to rewrite the code :) I'll try to do it in a week or so. Also I don't like that gem doesn't provide success, start, error, and progress callbacks (in constructor), they would be helpful. Maybe implement them too? I'd like to make some use of promises too. |
I've re-written gem and released it under https://github.com/sheerun/s3_file_field |
@sheerun can you clarify this section? specifically...how would a form look that uses the s3_upload_form helper and the code snippet below? thank you! Create a new view that uses the form helper s3_uploader_form: = form_for :user do |form| |
@gbenz Only data attributes on |
sorry, I'm missing something...my form looks like this: <%= form_for @post, :html => {:multipart => true} do |f| %> ...and I get the uninitialized constant: "NameError (uninitialized constant ActionView::Helpers::Tags)" for the s3_file_field Thank you! |
Uh. I tested it mainly on Rails 4. Please wait a while for fix. |
ok, thanks! |
@gbenz Thank you so much for report. As it turned out I tested it against Rails 4 two times ;/ I've just released |
works now. thanks! |
A solution for #74
This allows you to use s3 direct upload without requiring a separate form. To use with just an input tag within an existing form you will need to do a couple things.
Set the url for s3 uploader since it can no longer get it from the form
This requires a url to be set in your uploader config
You can then include a file input tag using the following helpers
However this will not work with the IE9 fix and I do not know anything about making it IE9 compatable