Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8048033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:17:57+00:00 2026-06-05T06:17:57+00:00

I stumbled on an apparent incompatibility between knockoutjs and jquery mobile when it comes

  • 0

I stumbled on an apparent incompatibility between knockoutjs and jquery mobile when it comes to form submit behavior.

Consider the following markup:

<form data-bind="submit: myKoSubmitAction">
   <!-- form fields here -->
</form>

The intention is that knockout prevents server post/get and instead calls myKoSubmitAction. jqm will also prevent standard submit behavior only for jqm the reason is that the form submit is replaced by an ajax request.

So while knockout (presumably) succeeds at preventing the standard server request, it fails to prevent jqm from sending an ajax request.

I found the answer to this problem in a google group and thought it should be on SO as well. See below

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:17:58+00:00Added an answer on June 5, 2026 at 6:17 am

    The best solution I have been able to find is the following custom ko binding:

    //This binding fixes apparent incompatibility between knockout and jqm
    ko.bindingHandlers.jqmsubmit = {
      init: function (el, accessor, allbindings, vm) {
        ko.bindingHandlers.submit.init(el, accessor, allbindings, vm);
        $(el).submit(function (e) {
            // prevent the submit behavior
            e.preventDefault();
            e.stopPropagation();
            return false;
        });
      }
    };
    

    To be used in the place of the standard submit ko binding:

    <form data-bind="jqmsubmit: myKoSubmitAction">
      <!-- form fields here -->
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I stumbled across some bizarre behavior in Firefox 12. Consider the following HTML: <!DOCTYPE
I stumbled across a really weird behavior recently. When I use a TActionMainMenuBar (or
I stumbled upon a very weird behavior inside a javascript closure. If a global
I stumbled upon the following construction in C++: bool result = false; for(int i
I stumbled upon an issue with event namespacing while developing a jQuery plugin. here
I stumbled across the following shortcut in setting up a for loop (shortcut compared
I stumbled across a pretty interesting behavior in Scala. scala> def foo(t: (Int, Int,
I stumbled across a strange behavior in Firefox. I have a dynamically created text,
I stumbled across the following warning when I was reading Code Like a Pythonista:
I stumbled on the same problem of nested templates described here . The following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.