Hi Brian,
I assume you are trying to wait until the input element in your form exists,
so you can set the focus to it?
The whenReady() code uses document.getElementById(), but your input element
has no id attribute. It does have:
name="data"
But getElementById() requres an id attribute. You can add:
id="data"
to the input element (in addition to the name="data" and everything else
that's there now) to fix that.
> I have tried 'data' for 'fromAddress' and both 'iwform' and 'marker'
> for 'element', but without success.
There's no reason why you would need to change the word "element" in that
code. It's just a variable name with no significance to it.
-Mike
// == creates a draggable marker with an input form ==
function createInputMarker(point,ID) {
if(!noMore){
var marker = new GMarker(point,{draggable:true, icon:G_START_ICON});
marker.ID = ID + 0;
GEvent.addListener(marker, "click", function() {
lastmarker = marker;
marker.openInfoWindowHtml(iwform);
whenReady( 'data', function( marker) {
marker.focus();
});
});
noMore = true;
map.addOverlay(marker);
marker.openInfoWindowHtml(iwform);
whenReady( 'data', function( marker) {
marker.focus();
});
lastmarker=marker;
return marker;
}
}
> From: thebrianschott
>
> I found a fine answer to my question in a Michael Geary post
> but the link to which his post refers (in an earlier post in
> the thread) no longer exists and I have not figured out the
> detailed references required (fromAddress, element, and maybe
> others). Michael's post says the following.
>
>
> *****************************************
> Add this function to your code:
>
> function whenReady( id, callback ) {
> var interval = setInterval( function() {
> var element = document.getElementById( id );
> if( element ) {
> clearInterval( interval );
> callback( element );
> }
> }, 10 );
> }
>
> Then, in your resetPvaMarkerInfo() function, immediately
> after you call openInfoWindowHtml(), add this code:
>
> whenReady( 'fromAddress', function( element ) {
> element.focus();
> });
>
> The whenReady() function takes an element ID and repeatedly
> checks to see if that element exists. When the element
> becomes available, it calls the callback function with that
> element as an argument.
> *****************************************
>
> Look for the following code in my link twice near line 86.
> I have tried 'data' for 'fromAddress' and both 'iwform' and 'marker'
> for 'element', but without success.
>
> marker.openInfoWindowHtml(iwform);
>
> http://schott.selfip.net/~brian/mapswdelete/rideshare.html
>
> Help, please.
>
> Brian in Atlanta
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---