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

  • Home
  • SEARCH
  • 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 7074719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:05:31+00:00 2026-05-28T06:05:31+00:00

In my app I have an imagemap split into several poly shapes. Each shape

  • 0

In my app I have an imagemap split into several poly shapes. Each shape has a corresponding checkbox (sat in a form with a submit button) and together they allow the user to filter results shown depending on what area of the imagemap has been selected.

Im using the dumbFormState plugin to persist the checkboxes after the form is submitted and the page reloads but the selected shapes in the imagemap loses their highlighted state.

How can I make the shapes persist their ‘checked’ state like the checkboxes on page reload?

Here is my javascript:

<script>
  jQuery(function(){ // ensure dom is loaded first
    jQuery('#filter_form').dumbFormState();
  });  

  $(function() {
    $('.map').maphilight();  

    $('#north, #east, #south, #west').click(function(e) {
        e.preventDefault();
        var $this = $(this);
        var data = $this.mouseout().data('maphilight') || {};
        data.alwaysOn = !data.alwaysOn;
        $this.data('maphilight', data).trigger('alwaysOn.maphilight');
    });
  });

  $(function() {
    $('area').click(function(){
      var name = $(this).data("areanum");
      var $checkbox = $('#' + name);
      $checkbox.attr('checked', !$checkbox.attr('checked'));
    });       
  });
</script>

index.html.erb

<div class="map_container">

  <%= image_tag("maps/mainmap.png", :width => "450", :height => "450", :class => "map", :usemap => "#mainmap", :alt => "") %>

  <map name="mainmap">
    <area id="north" data-areanum="area-42" shape="poly" 
      coords="158,43,152,49,164,86,165,112,153,153,139,169,145,171,161,176,236,201,241,202,251,166,253,142,257,132,294,102,269,85,240,68,227,53,213,28,202,27" alt="North"
      data-maphilight='{"stroke":false,"fillColor":"5F9EA0","fillOpacity":0.6}'
      onmouseover="document.body.style.cursor='pointer'" 
      onmouseout="document.body.style.cursor='default'" >

    <area id="east" data-areanum="area-44" shape="poly" 
      coords="296,103,258,133,254,143,252,166,242,203,263,209,272,204,322,226,340,250,360,241,356,230,357,222,378,214,395,195,394,188" alt=""
      data-maphilight='{"stroke":false,"fillColor":"5F9EA0","fillOpacity":0.6}'
      onmouseover="document.body.style.cursor='pointer'" 
      onmouseout="document.body.style.cursor='default'" >


    <area id="south" data-areanum="area-41" shape="poly" 
      coords="182,316,178,321,188,329,200,353,276,274,243,248" alt=""
      data-maphilight='{"stroke":false,"fillColor":"5F9EA0","fillOpacity":0.6}'
      onmouseover="document.body.style.cursor='pointer'" 
      onmouseout="document.body.style.cursor='default'" >


    <area id="west" data-areanum="area-48" shape="poly" 
      coords="286,276,276,275,200,354,218,390,323,341,325,321,321,312" alt=""
      data-maphilight='{"stroke":false,"fillColor":"5F9EA0","fillOpacity":0.6}'
      onmouseover="document.body.style.cursor='pointer'" 
      onmouseout="document.body.style.cursor='default'" >
  </map>              
</div>

<div class="filter_options_container">
  <%= form_tag '', :method => :get, :id => 'filter_form' do %>

    <fieldset class="filter_form_fieldset areas">
      <% Area.all.each do |a| %>
        <p class="area_check"><%= check_box_tag 'areas[]', a.id, false, :id => "area-#{a.id}" %>
        <label for="area-<%= a.id %>"><p1><%= a.name %></p1></label></p>
      <% end %>
    </fieldset>

    <div class="filter_form_button">
      <p2><input type="submit" value="Show me"/></p2>
    </div>
  <% end %>
</div>

Whats generated in the browser

<div class="map_container">

  <img alt="" class="map" height="450" src="/assets/maps/mainmap.png" usemap="#mainmap" width="450" />

  <map name="mainmap">
    <area id="north" data-areanum="area-42" shape="poly" 
      coords="158,43,152,49,164,86,165,112,153,153,139,169,145,171,161,176,236,201,241,202,251,166,253,142,257,132,294,102,269,85,240,68,227,53,213,28,202,27" alt="North"
      data-maphilight='{"stroke":false,"fillColor":"5F9EA0","fillOpacity":0.6}'
      onmouseover="document.body.style.cursor='pointer'" 
      onmouseout="document.body.style.cursor='default'" >

    <area id="east" data-areanum="area-44" shape="poly" 
      coords="296,103,258,133,254,143,252,166,242,203,263,209,272,204,322,226,340,250,360,241,356,230,357,222,378,214,395,195,394,188" alt=""
      data-maphilight='{"stroke":false,"fillColor":"5F9EA0","fillOpacity":0.6}'
      onmouseover="document.body.style.cursor='pointer'" 
      onmouseout="document.body.style.cursor='default'" >

    <area id="south" data-areanum="area-41" shape="poly" 
      coords="182,316,178,321,188,329,200,353,276,274,243,248" alt=""
      data-maphilight='{"stroke":false,"fillColor":"5F9EA0","fillOpacity":0.6}'
      onmouseover="document.body.style.cursor='pointer'" 
      onmouseout="document.body.style.cursor='default'" >


    <area id="west" data-areanum="area-48" shape="poly" 
      coords="286,276,276,275,200,354,218,390,323,341,325,321,321,312" alt=""
      data-maphilight='{"stroke":false,"fillColor":"5F9EA0","fillOpacity":0.6}'
      onmouseover="document.body.style.cursor='pointer'" 
      onmouseout="document.body.style.cursor='default'" >        
  </map>              
</div>

<div class="filter_options_container">
  <form accept-charset="UTF-8" action="" id="filter_form" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>    

    <fieldset class="filter_form_fieldset areas">
        <p class="area_check"><input id="area-41" name="areas[]" type="checkbox" value="41" />
        <label for="area-41"><p1>south</p1></label></p>    
        <p class="area_check"><input id="area-42" name="areas[]" type="checkbox" value="42" />
        <label for="area-42"><p1>north</p1></label></p>
        <p class="area_check"><input id="area-44" name="areas[]" type="checkbox" value="44" />
        <label for="area-44"><p1>east</p1></label></p>
        <p class="area_check"><input id="area-48" name="areas[]" type="checkbox" value="48" />
        <label for="area-48"><p1>west</p1></label></p>

    </fieldset>

    <div class="filter_form_button">
      <p2><input type="submit" value="Show me"/></p2>
    </div>
</form></div>

If I’ve left anything out of my question please comment.

Thanks for any help its much appreciated!

  • 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-28T06:05:31+00:00Added an answer on May 28, 2026 at 6:05 am

    You might want to serialize your data and save them to cookies or LocalStorage in window.onbeforeunload event.
    In document.onload you should check stored data, if there are any, you apply then remove them.

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

Sidebar

Related Questions

My app has a form which uses checkboxes to sort results by type and
My app has a table of venues and areas, where each area has many
When an app have been put into the background and later resumes to an
I have an Ipad app what has multiple OpenGL tile images, couple buttons in
My app have some events, each event can have some actions. These actions is
In my app have a window splitted by a QSplitter, and I need to
This is a continuation of the question here: JBoss - does app have to
I have app.config in m win application, and loggingConfiguration section (enterprise library 4.1). I
I have a command line app and have the code chdir(/var); FILE *scriptFile =
On my rails app I have a list of items (like a task list)

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.