Onchange Event for Disabled or ReadOnly field

P

pbd22

Hi.

I am having problems figuring out how to save data as it is being
dynamically updated inside a hidden input field. If more code is
needed please let me know (this is a repost - my post disappeared
after I posted a lot of code).

The function that updates the disabled input field, showPosition, is
called whenever a google maps marker gets moved and the coordinates
get written:

function showPosition(form, pos) {

var coords = document.getElementById('coords');
if (coords) coords.value = pos.toUrlValue();

}

What I want to do is save the point where the marker has been moved
(one marker per map for many maps) to an array.

In my file selector, I have the following loop which determines which
file has been selected and saves the marker position to its associated
array value.

var last_click;

for(i=2;i<=max_count.length;i++) {

if(i == active) {

video_location.onchange = function(){
arrLocation[last_click] = video_location.value;
}

last_click = i;

}
}


Of course, my problem is that the onchange event for the disabled
input field "video_location" will not fire. so, the last moved marker
position does not get saved.

I feel like it should be much easier, does anybody have suggestions/
alternate points of view on how to do this?

Thanks again.
 
G

Gregor Kofler

pbd22 meinte:
Hi.

I am having problems figuring out how to save data as it is being
dynamically updated inside a hidden input field. If more code is
needed please let me know (this is a repost - my post disappeared
after I posted a lot of code).

*Hidden* or *disabled*? Why would one disable a hidden field? Hide it,
keep it enabled. That's all.

(Why should onchange fire for something that's "impossible" to change?)

Gregor
 
G

Gregor Kofler

Gregor Kofler meinte:
pbd22 meinte:

*Hidden* or *disabled*? Why would one disable a hidden field? Hide it,
keep it enabled. That's all.

(Why should onchange fire for something that's "impossible" to change?)

Ooops sorry. Re-read it again. Why are you listening to onchange? If I
get it right this time, you need those values for server-side processing
(hence the hidden field). You could grab onsubmit and fill the hidden
field when the form gets send with whatever values you want.

Or: Since the disabled field has to be filled by some routine you could
just add the functionality of your onchange handler to this routine.

Gregor
 
P

pbd22

Gregor Kofler meinte:




Ooops sorry. Re-read it again. Why are you listening to onchange? If I
get it right this time, you need those values for server-side processing
(hence the hidden field). You could grab onsubmit and fill the hidden
field when the form gets send with whatever values you want.

Or: Since the disabled field has to be filled by some routine you could
just add the functionality of your onchange handler to this routine.

Gregor

--http://www.gregorkofler.at::: Landschafts- und Reisefotografiehttp://www.licht-blick.at ::: Forum für Multivisionsvorträgehttp://www.image2d..com ::: Bildagentur für den alpinen Raum

I am sorry, I meant readonly or disabled per the subject of the
thread. That is my mistake - apologies for the confusion. I can't add
the onchange handler because it is impossible to fire onchange
for readonly or disabled fields (that I know of).

I have obviously backed myself into a logical corner and I am guessing
the solution is easier than I am making it out to be. Other thoughts
appreciated.

Thanks.
 
G

Gregor Kofler

pbd22 meinte:
I can't add
the onchange handler because it is impossible to fire onchange
for readonly or disabled fields (that I know of).

Well, you can add it. But it will not fire - naturally.
I have obviously backed myself into a logical corner and I am guessing
the solution is easier than I am making it out to be. Other thoughts
appreciated.

As I already pointed out: You will need a script that changes the value
of your disabled field (since no user interaction is possible). Why not
add the lines of the "useless" onchange-handler routine to this script?

Gregor
 
R

rouche

pbd22 meinte:


Well, you can add it. But it will not fire - naturally.


As I already pointed out: You will need a script that changes the value
of your disabled field (since no user interaction is possible). Why not
add the lines of the "useless" onchange-handler routine to this script?

Gregor

--http://www.gregorkofler.at::: Landschafts- und Reisefotografiehttp://www.licht-blick.at ::: Forum für Multivisionsvorträgehttp://www.image2d..com ::: Bildagentur für den alpinen Raum

This is funny i came across this problem too.

The script changing the Disabled field for me is unaccessible because
its generated by an APEX popup Window.

I tryed to use the field.watch() on the value, wich works in Firefox,
but Internet Explorer dont support watching property GRRR.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top