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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:23:54+00:00 2026-05-15T11:23:54+00:00

I have a remote form like this and a checkbox in it. When I

  • 0

I have a remote form like this and a checkbox in it. When I select or deselect the checkbox I would like to

  1. set the value of a hidden field

  2. ajax submit this form to its designated url.

I tried $(‘search_form’).onsubmit(), but I get an error saying onsubmit is not a function. Using prototype. Whats the best way to do this?

<form onsubmit="new Ajax.Request('/searches/search_set?stype=1', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" method="post" id="new_search" class="new_search" action="/searches/search_set?stype=1">
  <div style="margin: 0pt; padding: 0pt; display: inline;">
    <input type="hidden" value="3TWSyMsZXI0nltz7zHAxuj1KX=" name="authenticity_token">
  </div>

  <a onclick="setSubmit(this);" href="#" class="submit-link-button fg-button ui-state-default fg-button-icon-left ui-corner-all" id="search_submit">
    <span class="ui-icon ui-icon-search"></span>'Search'
  </a>
  </div>   

  <input type="checkbox" value="Energy" onclick="refreshResults(this);" name="search[conditions][article_tag][0]" id="search_conditions_article_tag_0">
  • 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-15T11:23:55+00:00Added an answer on May 15, 2026 at 11:23 am

    Maybe you can try something like this :

    <form method="post" id="new_search" class="new_search" action="/searches/search_set?stype=1">
      <a href="#" class="submit-link-button fg-button ui-state-default fg-button-icon-left ui-corner-all" id="search_submit">
        <span class="ui-icon ui-icon-search">Search</span>
      </a>
      <input type="hidden" name="hidden_field_name" value="" id="hidden_field_id" />
      <input type="checkbox" value="Energy" name="search[conditions][article_tag][0]" id="search_conditions_article_tag_0" />
    </form>
    
    <script type="text/javascript">
      var Search = {
        send: function(event, element) {
          $('hidden_field_id').value = element.value;
          var form = element.up('form');
          new Ajax.Request('/searches/search_set?stype=1', {asynchronous:true, evalScripts:true, parameters:Form.serialize(form)}); return false;
          Event.stop(event);
        }
      };
      document.observe('dom:loaded', function(event) {
        $("search_conditions_article_tag_0").on("click", Search.send);
      });
    </script>
    

    Is that what you are looking for ?

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

Sidebar

Related Questions

I would like to have Ajax form in Rails so i'm using form_remote_tag. The
What I have is a remote form inside another remote form like this: <%=form_for
I have a Rails 3 form with :remote => true, like this: <%= form_for
I have a form like this: <form action='' onsubmit='void(0)' class=mainform> <label class=form3><input type=checkbox> One
I have form like this : <div id='add_field' class='locbutton'><a href='#' title='Add'>Add</a></div> <div id='remove_field' class='locbutton2'><a
I have a simple form that I would like to validate on form submission.
I have a nested form in a rails view that is called like this
I have an HTML form like this: form.html: <html> <body> your name is :<br><br>
I have an Event model with a finish_time field and a form checkbox called
I have rails app with a textarea form like <%= form_for Comment.new, :remote =>

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.