# Prototype ajax/javascript q

**URL:** <https://www.ruby-forum.com/t/prototype-ajax-javascript-q/54692>\
**Category:** Rails\
**Created:** [March 13, 2006, 8:58am UTC](https://www.ruby-forum.com/t/prototype-ajax-javascript-q/54692 "2006-03-13T08:58:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![costi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4491bb/32.png) [@costi](https://www.ruby-forum.com/u/costi)\
**Post date:** [March 13, 2006, 8:58am UTC](https://www.ruby-forum.com/t/prototype-ajax-javascript-q/54692/1 "2006-03-13T08:58:15Z")

</div>

I’m trying to send to my application the coords x,y on an “input type  
image” in a html form, but x,y variables are not present in the  
POST\_DATA (are not submitted). Any other field (hidden inputs) are being  
sent when I click on the image input form field.

I use rails 1.0 and prototype 1.4, browsers Seamonkey  
2.0, Firefox 1.x and Konqueror, Linux, and I’m just a newbie in ror.

Html code generated by rails:

In POST\_DATA I have ‘’.

Tried it without ajax:

In POST\_DATA i have matrix.x=572&matrix.y=443.

Hints, anyone? The code in the rhtml template is:

\<%= form\_remote\_tag(:update =\> “coords”,  
:url =\> { :action =\> “set” }) %\>

\<%= end\_form\_tag %\>

---

<div class="post-metadata">

**Author:** ![costi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4491bb/32.png) [@costi](https://www.ruby-forum.com/u/costi)\
**Post date:** [March 13, 2006, 3:02pm UTC](https://www.ruby-forum.com/t/prototype-ajax-javascript-q/54692/2 "2006-03-13T15:02:10Z")

</div>

My guess is that Form.serialize (in prototype.js) ignores   
You could modify Form.Element.Serializers (input) and add the desired  
behaviour for type “image”

Bogdan

---

<div class="post-metadata">

**Author:** ![costi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4491bb/32.png) [@costi](https://www.ruby-forum.com/u/costi)\
**Post date:** [March 13, 2006, 8:12pm UTC](https://www.ruby-forum.com/t/prototype-ajax-javascript-q/54692/3 "2006-03-13T20:12:32Z")

</div>

Cam pe la 03/13/2006 04:00 PM, Bogdan I. scrise:

> My guess is that Form.serialize (in prototype.js) ignores   
> You could modify Form.Element.Serializers (input) and add the desired  
> behaviour for type “image”

Your guesss is be right. But after some reading, i found out that x,y  
coordinates of the click are not available in the forms objects, so  
can’t use . I’ll try something else.

Form.Element.Serializers = {  
input: function(element) {  
switch (element.type.toLowerCase()) {  
case ‘submit’:  
case ‘hidden’:  
case ‘password’:  
case ‘text’:  
return Form.Element.Serializers.textarea(element);  
case ‘checkbox’:  
case ‘radio’:  
return Form.Element.Serializers.inputSelector(element);  
}  
return false;  
},

–  
They say money can’t buy happiness? Look at the smile on my face… ear  
to ear, baby!
