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 6675923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:55:19+00:00 2026-05-26T03:55:19+00:00

I have a form I am submitting by jQuery, to auto-save it. This is

  • 0

I have a form I am submitting by jQuery, to auto-save it. This is in Ruby On Rails 3. My model is a Post that I want to auto-save. The post model is adapted to ignore certain validations if a boolean field (draft) is = true. (If draft is nil, then the validations run)

I use the following code to submit the form at intervals to autosave it.

 $(document).ready(function() {
   setInterval(function() {
     $('#post_form form[data-remote]').submit();
   }, 1000*60); // 1000ms * 60s = 1m
 });

When the form submits by this function, I want to include a variable :draft => true somehow, to ignore validations etc.. How can I add to this javascript to accomplish this? Or is that simply not possible?

If I would have to go into the code rails-wise and do another solution, please comment to let me know and I’ll post the relevant code.

Thanks guys!

  • 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-26T03:55:19+00:00Added an answer on May 26, 2026 at 3:55 am
    $(document).ready(function() {
       setInterval(function() {
         var draft = $('#draft');
         if(draft == null)
         {
            $('post_form').append('<input type="hidden" name="draft" id="draft" value="true" />');
           draft = $('#draft');
         }
         draft.val('true');
    
    
         $('#post_form form[data-remote]').submit();
       }, 1000*60); // 1000ms * 60s = 1m
     });
    

    I have updated your code, I have created hidden input text box with the value true and name draft.

    I hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that uses the excellent jQuery validation plugin. This is a
I have a jQuery post submitting a form to a controller create action, which
so i have form that I am submitting via jQuery form's ajaxSubmit it was
I have a form that is submitting comments. I want 'forward_to' to move to
I have a form I am submitting using jQuery's ajaxSubmit function from the Forms
I have a form that contains a bunch of checkboxes. Before submitting the form,
I have a form that I'm submitting with AJAX. A user fills out the
I have a Django form that needs to do some client-side validation before submitting
I want to interrupt and prevent a form from submitting using jQuery. Here's my
I have a form that I use JQuery, I don't think I need to

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.