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

  • SEARCH
  • Home
  • 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 6125019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:11:59+00:00 2026-05-23T16:11:59+00:00

What is the best way to handle forms in jqm? For example, lets say

  • 0

What is the best way to handle forms in jqm?

For example, lets say the user fills out a form and some of the data doesnt validate. Its not picked up by the JS validation but it does trigger some business logic meaning that the system cannot proceed.

In jqm, the form would be returned to the user and the framework would load it up and navigate to it. Expect, I don’t want it to be navigated to as its not a new state – I just want it to show the updated form with error message.
I don’t want to disable ajax either, as that adds an unnecessary full page reload.

Ideally, what I would like is a way to tell jqm not to transition or include the response in the history – rather just show it in place of what is there.

The only way I can see this working is to write my own little form handler and return JSON from the server, which includes an error state. If submission was good navigate to the next page, otherwise update the html in the view with the html returned as part of the JSON object which includes any error messages.

Seems there must be a better way though?

Thanks

  • 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-05-23T16:12:00+00:00Added an answer on May 23, 2026 at 4:12 pm

    Good question and I too would be interested to see what others have to say. For what it’s worth, in a recent app (which also had to work off-line), I went down your proposed route with my forms:

    1. Prevented the default submit action.
    2. Used an ajax call from a button, which checks data before submitting it either to a web service, or simply saving to the local database (depending on a status flag and whether we’re on-line or not).
    3. Ensure that all relevant success / fail messages trickle back up through the submit callback so that we can…
    4. … update the same html page with the results of the user submission.

    This works well, and the users are happy. However, it fits my particular set of circumstances—I didn’t want to use any querystring / location.hash stuff because (a) jQM sometimes freaks out with hashes and, (b) potentially the user will be off-line (and no web server means no querystring). Your mileage may vary of course.

    EDIT: code to update a page with messages
    For my app I wanted a list of messages to appear in the current page when required, so I have an empty unordered list (messages) in the relevant HTML page, which in turn sits inside a styled div (message-pane). Here’s a code snippet showing how the update happens (note the refresh call, which is required in jQM). You could trigger some code like this from your ajax handler:

    var list = $("#messages");
    list.append('<li>YOUR MESSAGE HERE</li>');
    list.listview('refresh');
    $("#message-pane").show();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the best way to handle data entered through dynamically generated controls in ASP.NET?
What's the best way to handle errors such as A potentially dangerous Request.Form value
What's the best way to thread work (methods) in c#? For example: Let's say
I'd like to know what the best way to handle form validation is where
I was hoping I could get some input on the best way to handle
Two questions: If the user says 'no' what is the best way to handle
What's the best way to handle translations for stock text in a SSRS .
What is the best way to handle a big team that has access to
What's the best way to handle a visitor constructing their own URL and replacing
Is this the best way to handle file moving in a windows service? we

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.