Skip to content
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

ufForm uses the largely unsupported set FormData method. #717

Open
Silic0nS0ldier opened this issue May 24, 2017 · 14 comments
Open

ufForm uses the largely unsupported set FormData method. #717

Silic0nS0ldier opened this issue May 24, 2017 · 14 comments
Labels
compatibility Compatibility issue with other framework, features frontend The frontend interface
Milestone

Comments

@Silic0nS0ldier
Copy link
Member

As documented at MDN, full support for FormData is rare among browsers. This includes the set method used in ufForm. An alternative should be implemented, that gets executed instead if feature detection reveals that the required function is missing.

@Silic0nS0ldier Silic0nS0ldier added compatibility Compatibility issue with other framework, features V4 labels May 24, 2017
@alexweissman
Copy link
Member

@x00x70 can you look in to this?

@ghost
Copy link

ghost commented May 24, 2017

i can look, but am completely stacked right now

@alexweissman
Copy link
Member

No rush!

@ghost
Copy link

ghost commented May 24, 2017

So i've looked into this. in its current form it might not be easy to implement. Edge, IE 10 and Safari do not have FormData methods beyond append() and hence cannot access/modify the underlying data in the object. Options:

  • re-implement this for every browser
  • add another function for just unsupported browsers (and browser detecton. seems ugly)
  • wait for browsers to catch up.
  • the set() function is the only thing we use which is not supported. We use the set function for handling the binary check boxes. If we re-implement how we capture checkbox input for binary values, then we no longer need the set()function. This might be a good start: https://stackoverflow.com/a/20570060/7335809

When i originally implemented the formData object, it was to enable image upload via ajax. re-implementing this without a formData object might be a difficult challenge, as i seem to recall i used the formData objects for a reason.

thoughts?

@lcharette
Copy link
Member

Does library like Dropzone use formData to process uploads? If they do, they probably don't support checkbox anyway and won't be of any help, but if they don't use formData, then they must use something else to handle uploads...

That, or handle checkbox the traditional way php side ? 😈

@lcharette
Copy link
Member

Another way could be to append each form input to an empty formData ?

See: https://stackoverflow.com/questions/5392344/sending-multipart-formdata-with-jquery-ajax

@alexweissman alexweissman modified the milestone: 4.x Jun 1, 2017
@alexweissman alexweissman modified the milestones: 4.x, 4.1.x Jun 18, 2017
@alexweissman alexweissman removed the V4 label Jul 14, 2017
@lcharette lcharette modified the milestones: 4.1.x, 4.2.0 Dec 16, 2017
@alexweissman alexweissman added the frontend The frontend interface label Dec 24, 2017
@alexweissman
Copy link
Member

It looks like .set is only used for the binaryCheckboxes feature anyway, right? I'd like to refactor this aspect of ufForm anyway, since right now we have binaryCheckboxes implemented in two different places.

I'd also like to generalize binaryCheckboxes to some kind of transform API as well, while we're at it.

@alexweissman
Copy link
Member

There does appear to be a polyfill, but I'm not sure how it's supposed to work client-side without Node.

@alexweissman
Copy link
Member

Actually, we may be able to solve this problem (and many others) simply by having ufForm as a wrapper around jQuery Form Plugin's ajaxSubmit method.

@stale
Copy link

stale bot commented Jun 28, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@alexweissman
Copy link
Member

Still an issue I think?

@alexweissman alexweissman reopened this Dec 1, 2020
@alexweissman alexweissman removed the wontfix This will not be worked on label Dec 1, 2020
@Silic0nS0ldier
Copy link
Member Author

Well, support for FormData in evergreen browsers has improved substantially since this issue was created. Working on this should only be necessary to support older browsers (e.g. IE11, which MS has since given an expiration date).

@alexweissman
Copy link
Member

Ok. There are still other reasons for rewriting/redesigning ufForm at some point. I'm not so sure about jQuery Form right now though, because apparently it's not fully compatible with jQuery 3 at the moment. It might be a situation where we can simultaneously rewrite ufForm and contribute to jQuery Form at the same time...

@Silic0nS0ldier
Copy link
Member Author

Evidently they'd appreciate the help: https://github.com/jquery-form/form#pull-requests-needed

@lcharette lcharette added this to the 6.0.0 milestone Nov 25, 2023
@lcharette lcharette moved this from Todo 6.0 to Not Started in UserFrosting Task Planner Apr 13, 2024
@lcharette lcharette moved this from Not Started to References in UserFrosting Task Planner Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Compatibility issue with other framework, features frontend The frontend interface
Projects
Status: References
Development

No branches or pull requests

3 participants