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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:05:32+00:00 2026-05-31T10:05:32+00:00

Why would a form with the HTML data-remote=true process as HTML on the server

  • 0

Why would a form with the HTML data-remote=”true” process as HTML on the server side?

I just have a simple table filter in my index.html.erb file:

 <%= form_tag('by_subject', :remote => true,  :method => "get" ) do  %>
<%= select_tag( "subject_id", options_for_select(Subject.all.collect {|p| [ p.name, p.id ] })) %>
    <%= submit_tag "Search" %>
 <% end %>

The data-remote HTML seems there:

<form accept-charset="UTF-8" action="by_subject" data-remote="true" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>
<select id="subject_id" name="subject_id">
        <option value="1">Art</option>
        <option value="2">Business &amp; Tech</option>
        <option value="15">undefined</option>
        <option value="16">Music</option></select>
     <input name="commit" type="submit" value="Search" />
 </form>

But my controller action

def by_subject
@courses = Course.where(:subject_id => params[:subject_id])
respond_to do |format|
  format.html { raise "It rendered HTML again."  }
  format.js   { raise "Ah, it wants to render Javascript."  }
  format.json { render json: @courses }
end

Yields

It rendered HTML again.

...

Request

Parameters:

{"utf8"=>"✓",
 "subject_id"=>"16",
 "commit"=>"Search"}

Every time. I’ve tried all sorts of finessing.

Thanks!

And the env dump:

GATEWAY_INTERFACE: "CGI/1.2"
HTTP_ACCEPT: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
HTTP_ACCEPT_ENCODING: "gzip, deflate"
HTTP_ACCEPT_LANGUAGE: "en-us,en;q=0.5"
REMOTE_ADDR: "127.0.0.1"
SERVER_NAME: "localhost"
SERVER_PROTOCOL: "HTTP/1.1"

OK, I got several pages of Rack @env. Not sure how much is needed. The whole thing is here gist.

#<Rack::Request:0x4396260 @env={"SERVER_SOFTWARE"=>"thin 1.3.1 codename Triple Espresso", 
"SERVER_NAME"=>"localhost", "rack.input"=>#<StringIO:0x459f720>, "rack.version"=>[1, 0], "rack.errors"=>#<IO:<STDERR>>, 
"rack.multithread"=>false, "rack.multiprocess"=>false, "rack.run_once"=>false, 
"REQUEST_METHOD"=>"GET", 
"REQUEST_PATH"=>"/courses/by_subject", 
"PATH_INFO"=>"/courses/by_subject", 
"QUERY_STRING"=>"utf8=%E2%9C%93&subject_id=16&commit=Search", 
"REQUEST_URI"=>"/courses/by_subject?utf8=%E2%9C%93&subject_id=16&commit=Search", 
"HTTP_VERSION"=>"HTTP/1.1", 
"HTTP_HOST"=>"localhost:3000", 
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Windows NT 6.0; rv:10.0.2) Gecko/20100101 Firefox/10.0.2", 
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", 
"HTTP_ACCEPT_LANGUAGE"=>"en-us,en;q=0.5", 
"HTTP_ACCEPT_ENCODING"=>"gzip, deflate", 
"HTTP_CONNECTION"=>"keep-alive", 
"HTTP_REFERER"=>"http://localhost:3000/courses", 
"HTTP_COOKIE"=>"__utma=111872281.1794585154.1323696638.1326994528.1326997977.9; __utmz=111872281.1323696638.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _creditflex_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRkkiJWZhNDZhZmMyZDU4OTczMGM0NDNmMDBiMjhiMzc3YzNlBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTFhaFNlRUcyTmErSWZDQWtQdmF5WEg2L3RRNG00Q2tBRVZBUDJCdlZ0RWM9BjsARg%3D%3D--ec4ddf8986b88c6aae5429305fbf735527770d95", 
"GATEWAY_INTERFACE"=>"CGI/1.2", "SERVER_PORT"=>"3000", 
"SERVER_PROTOCOL"=>"HTTP/1.1", "rack.url_scheme"=>"http", 
"SCRIPT_NAME"=>"", "REMOTE_ADDR"=>"127.0.0.1", 
"async.callback"=>#<Method: Thin::Connection#post_process>, "async.close"=>#<EventMachine::DefaultDeferrable:0x45ab6f0>, 
"ORIGINAL_FULLPATH"=>"/courses/by_subject?utf8=%E2%9C%93&subject_id=16&commit=Search", 
"action_dispatch.routes"=>#<ActionDispatch::Routing::RouteSet:0x4893330 @named_routes=#<ActionDispatch::Routing::RouteSet::NamedRouteCollection:0x4893318 
@routes={:ckeditor=>#<Journey::Route:0x40b8490 @name="ckeditor", @app=Ckeditor::Engine, @path=#<Journey::Path::Pattern:0x40b8f58 @anchored=false, @spec=/ckeditor, @requirements={}, @separators="/.?", @names=[], @optional_names=nil, @required_names=nil, @re=/\A\/ckeditor/>, @verb=//, @ip=//, @constraints={}, @defaults={}, @required_defaults=nil, @required_parts=nil, @parts=[], @decorated_ast=nil, @precedence=1>, 
:response=>#<Journey::Route:0x4a74d10 @name="response", @app=#<ActionDispatch::Routing::RouteSet::Dispatcher:0x45fa8d8 @defaults={:action=>"new", :controller=>"responses"}, @glob_param=nil, @controllers={}>, @path=#<Journey::Path::Pattern:0x45fa098 @anchored=true, @spec=/responses/:id(.:format),

....

:by_subject_courses=>#<Journey::Route:0x5535e40 @name="by_subject_courses", @app=#<ActionDispatch::Routing::RouteSet::Dispatcher:0x5537580 @defaults={:action=>"by_subject", :controller=>"courses"}, @glob_param=nil, @controllers={"courses"=>#<ActiveSupport::Dependencies::ClassCache:0x3cc3fd8 @store={"CoursesController"=>CoursesController, "Subject"=>Subject(id: integer, name: string, created_at: datetime, updated_at: datetime, course_id: integer)}>}>, 
@path=#<Journey::Path::Pattern:0x5537388 @anchored=true, @spec=/courses/by_subject(.:format), @requirements={}, @separators="/.?", @names=["format"], @optional_names=nil, @required_names=nil, @re=/\A\/courses\/by_subject(?:\.([^\/.?]+))?\Z/>, @verb=/^GET$/, @ip=//, @constraints={:request_method=>/^GET$/}, @defaults={:action=>"by_subject", :controller=>"courses"}, @required_defaults=nil, @required_parts=nil, @parts=[:format], @decorated_ast=/courses/by_subject(.:format), @precedence=116>, 
:courses=>#<Journey::Route:0x553a028 @name="courses", @app=#<ActionDispatch::Routing::RouteSet::Dispatcher:0x553b270 @defaults={:action=>"index", :controller=>"courses"}, @glob_param=nil, @controllers={"courses"=>#<ActiveSupport::Dependencies::ClassCache:0x3cc3fd8 @store={"CoursesController"=>CoursesController, "Subject"=>Subject(id: integer, name: string, created_at: datetime, updated_at: datetime, course_id: integer)}>}>, 
@path=#<Journey::Path::Pattern:0x553b078 @anchored=true, @spec=/courses(.:format), @requirements={}, @separators="/.?", @names=["format"], @optional_names=nil, @required_names=nil, @re=/\A\/courses(?:\.([^\/.?]+))?\Z/>, @verb=/^GET$/, @ip=//, @constraints={:request_method=>/^GET$/}, @defaults={:action=>"index", :controller=>"courses"}, @required_defaults=nil, @required_parts=nil, @parts=[:format], @decorated_ast=/courses(.:format), @precedence=117>, ...

….

  • 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-31T10:05:33+00:00Added an answer on May 31, 2026 at 10:05 am

    So for all that, it was 1) a stupid typo and 2) I guess I don’t understand the asset pipeline yet.

    I thought I had my javascript covered like 3-4 times over. That is, the application layout had

       '<%= javascript_include_tag :defaults %>'
       '<%= javascript_include_tag "application" %>'
    

    and so did layouts/courses.html

    Only it didn’t and that was what it needed. I was missing the = in

    <%= javascript_include_tag "application" %>
    

    And no idea what was up with :defaults

    I also thought that if the script was in assets/application.js, it would be in my app. It wasn’t.

    I am so sorry for taking so much of people time for such a simple error.

    I did learn a lot about debugging AJAX. Thank you so much to all who helped. (here and vi irc)

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

Sidebar

Related Questions

I have a simple form and would like to add a custom jQuery validation
I have a form on my site which sends data to some remote site
How to create a tiff image using HTML form data in java? I have
I have a simple html form and some php that input the POST variables
I have a pretty simple HTML form where users can enter in information about
I would like to make a form in HTML where a user enters some
I would like to use a textarea in html form to get the delimited
I've got an input field on my plain html form that I would like
I have a long signup form and would like to hide a few fields
In a customised form I would have a create Purchase Menubutton which opens a

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.