map areas not passing Form object to java script


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: map areas not passing Form object to java script

Hybrid View

  1. #1
    mark hembree Guest

    map areas not passing Form object to java script


    I have a map with areas - each of those maps is currently using href to a
    form and passing a number with it. the resolving ASP page then processes
    the passed parameter.

    HOWEVER - I want to pass ALL of the fields on the form along with the number
    associated with the area of the map that was clicked to the resolving ASP
    page.

    I created an onclick javascript and it passes the # associated with the area
    on the map : onclick="mapckick(###)"

    the javascript in an alert statement passes the correct value from the onclick
    event.

    Yet when I tried to pass this.form to the javascript, the script displays
    "undefined" - I created an input field and placed the same code there and
    the object was passed to the function.

    My goal (as I stated up front) is to click on an area of a map and have the
    form post to another page AND pass other input fields on that form with it.

    My goal with the process above was to pass the value of the map to the script
    and have the script execute a form post - assuming that method would post
    ALL of the input fields as well as the value pass from the map area.

    ==============================
    function mapclick(form,ac){
    alert(form)
    alert(ac)
    }
    ==============================
    <form name="FX" method="POST" action="catprocX.asp">
    <map name="fl">
    <area shape="poly" coords="..." onclick"mapclick(this.form,813)">
    </map>
    </form>
    ================================

    this is what i tried (shortenned for this page)

    Any help is appreciated...

  2. #2
    christopher Guest

    Re: map areas not passing Form object to java script


    "mark hembree" <mhembre1@tampabay.rr.com> wrote:
    >
    >I have a map with areas - each of those maps is currently using href to

    a
    >form and passing a number with it. the resolving ASP page then processes
    >the passed parameter.
    >
    >HOWEVER - I want to pass ALL of the fields on the form along with the number
    >associated with the area of the map that was clicked to the resolving ASP
    >page.
    >
    >I created an onclick javascript and it passes the # associated with the

    area
    >on the map : onclick="mapckick(###)"
    >
    >the javascript in an alert statement passes the correct value from the onclick
    >event.
    >
    >Yet when I tried to pass this.form to the javascript, the script displays
    >"undefined" - I created an input field and placed the same code there and
    >the object was passed to the function.
    >
    >My goal (as I stated up front) is to click on an area of a map and have

    the
    >form post to another page AND pass other input fields on that form with

    it.
    >
    >My goal with the process above was to pass the value of the map to the script
    >and have the script execute a form post - assuming that method would post
    >ALL of the input fields as well as the value pass from the map area.
    >
    >==============================
    >function mapclick(form,ac){
    >alert(form)
    >alert(ac)
    >}
    >==============================
    ><form name="FX" method="POST" action="catprocX.asp">
    ><map name="fl">
    ><area shape="poly" coords="..." onclick"mapclick(this.form,813)">
    ></map>
    ></form>
    >================================
    >
    >this is what i tried (shortenned for this page)
    >
    >Any help is appreciated...


    Why don't you create a hidden form field "mapcoord", then use your onClick
    event to save the value to the hidden form field
    (form.mapcoord.value = ac). After you have written the value to your hidden
    form field, simply call form.submit. This way you will still have access
    to you request.form collection.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center