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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:46:35+00:00 2026-05-26T01:46:35+00:00

I have a modal dialog box which is containing search field. when I select

  • 0

I have a modal dialog box which is containing search field. when I select element from drop down list, I got an error “element is null”. Can not understand why did I get this error. Following is my code.

<%= label_tag :Search_by %>
<select name="search" id="search" >
    <option value="0">Trainer</option>
    <option value="1">Venue</option>
    <option value="2">Country</option>
</select>

<div id="div_to_be_updated" style="float:right">
</div>

<%= observe_field 'search', :update => 'div_to_be_updated',:url => {:controller => 'events', :action=> 'pop_up_search' }, :with => "'is_delivery_address=' + escape(value)" %>

controller code::

def pop_up_search
  @trainers= Trainer.all
  @countries= Country.all

  if ["0"].include?(params[:is_delivery_address])
    render :partial => 'layouts/pop_up_trainer_search'
  else
    if ["1"].include?(params[:is_delivery_address])
      render :partial => 'calendar/pop_up_venu_search'
    else
      render :partial => 'layouts/pop_up_country_search'
    end
  end
end     

_pop_up_trainer_search.html.erb

<span style="text-align: right">
    <% form_tag "/calendar/pop_up_trainer_view" do %>
        <%= collection_select("event", "trainer_id", @trainers , :id, :name, {:prompt => true}) %>
        <%= submit_tag "search" %>
    <% end%>
</span>

Why did I get this error? Can anybody help me to correct this?

  • 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-26T01:46:36+00:00Added an answer on May 26, 2026 at 1:46 am

    Sounds like your error is happening on the client, not at the server.

    That means there’s a problem with your JS.

    That means that the observe_field is not being turned into good JS.

    Suggestions

    Examine the source of your web page, as it is sent from the server.

    • Look at the Javascript that is observing the #search element.
    • Check that there are no other elements with the search id
    • Use Firebug or other JS debugger to follow the Javascript flow when a new value is selected in the select field

    Added Since it works when in the main erb, but not the popup erb, a couple of ideas:

    1. Don’t re-use the search id in the popups. It should be a unique dom element. Different ways to handle this, one is to hide, not destroy the popup.
    2. Confirm that the JS is being called when the popup dialog is created. — Add an alert statement and see if it is evaluated.
    3. Does it work the first time the dialog is created, but not on later times?
    4. The JS debugger is your friend. Use it to carefully see what is happening on the browser. The Rails JS machinery is supposed to run JS that is in a partial but maybe there’s a problem there.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In WPF we have Window.ShowDialog() which allows showing a modal dialog box. In WinForms
I have a modal dialog box presented in Yahoo UI. The user selects a
Anyone have any experience creating a modal dialog box using AJAX and ASP.NET MVC?
I have a datagrid column with a button that opens a modal dialog box
I have a JInternalFrame window that needs to popup a modal dialog box when
I have an application where I can launch a modal dialog box over a
I like to have a popup modal dialog that need to show the list
I have two modal dialogs and each dialog has one edit box. I am
I have the following HTML code for dialog box: <div id=modal-dialog class=no-display> <div class=form>
I am invoking a jquery modal dialog in which I have a save button.

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.