Prototype ajax/javascript q

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 %>

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

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!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs