views:

333

answers:

0

I want Safari's form AutoFill feature to work on the forms in my web app. All of our form's submit events are prevented and instead we send data to the server via XHR (Ajax) POST.

The problem is, Safari's default for creating a new entry in it's AutoFill (autocomplete) "database" requires the form's submit event to fire and bubble all the way up. From my testing this is what I concluded and works for form GET and POST methods.

This issue is not present in Firefox; all of our forms retain the previous values that were "submitted" for each field. This is the desired behavior we want in Safari.

In our app a user will fill in the same form multiple times over multiple sessions. In some cases it would be useful for the browser to autocomplete (AutoFill in Safari's case) these fields for the user based on their previously submitted values.

I was wondering if anyone else has ran into this issue with Safari? And better yet if they have a solution (even if Safari-specific) to tell (or force) Safari to save form-field values into it's AutoFill database even if the form's submit event is prevented?

I've tried preventDefault() higher-up in the DOM, letting the submit event bubble-up to the form's parent DOM node; no difference in behavior. It's possible this is just a bug in Safari…