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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:33:57+00:00 2026-05-15T18:33:57+00:00

I want to create a very simple search partial. It has a text box,

  • 0

I want to create a very simple search partial. It has a text box, to query, and search db. Can I create a remote_function call without using AJAX or JS? Can I keep it entirely “Rails-ee”?

<%= text_field_tag "search_term",'', :size => 10 %>
<%= button "search", :onclick => remote_function( :url => {:action => :fill_in_lots }, 
                                                  :with => "search_term" ) %>
  • 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-15T18:33:57+00:00Added an answer on May 15, 2026 at 6:33 pm

    This isn’t a problem, you need to use a technique called formal link. Instead of button you put a from with submit button. Below is a code of helper I use for this:

    def formal_link_to(*args, &block)
        options = html_options = name = nil
        if block_given?
          options = args.first
          html_options = args.second
          name = capture(&block)
        else
          name         = args.first
          options      = args.second || {}
          html_options = args.third
        end
    
        method = html_options.delete(:method) || "POST"
        method = method.to_s.upcase
        url = url_for(options)
    
        html = "<form class=\"formal-link\" action=\"#{url}\" method=\"post\">"
        html += "<input type=\"hidden\" value=\"#{form_authenticity_token}\" name=\"authenticity_token\" />" 
        html += "<input type=\"hidden\" value=\"#{method}\" name=\"_method\" />" 
        html += link_to(name, "#", html_options)
        html += "</form>"
    
        if block_given?
          concat(html)
        else
          return html
        end
      end
    

    You use this helper like a normal link_to, but you can pass extra options :method in second hash. Example:

    <%= formal_link_to "Fill in lots", { :action => "fill_in_lots" }, { :method => :post } -%>
    

    Remarks:
    1. This of course will make the full page reload, but it is inevitable without using JavaScript.
    2. I assumed action fill_in_lots is exposed to POST request. In case of GET you can use normal link_to helper.

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

Sidebar

Related Questions

No related questions found

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.