inputEx - MapField Usage

Virtual Earth MapField creation

Use the following code to create a inputEx MapField for Virtual Earth.

			var id = 'container1';
			var api = 'virtualearth';
			var elExample1 = new Y.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api});

			var elButton1 = inputEx.cn('button', null, null, "getValue");
			Y.one(elButton1).on( 'click', function() {
				alert(Y.JSON.stringify(elExample1.getValue()) );
			});
			Y.one('#'+id).appendChild(elButton1);
		

Yahoo Maps MapField creation

Use the following code to create a inputEx MapField for Yahoo Maps.

			var id = 'container2';
			var api = 'yahoo';
			var elExample2 = new Y.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api});

			var elButton2 = Y.inputEx.cn('button', null, null, "getValue");
			Y.one(elButton2).on('click', function() {
				alert( Y.JSON.stringify(elExample2.getValue()) );
			});
			Y.one('#'+id).appendChild(elButton2);
		

Google Maps MapField creation

Use the following code to create a inputEx MapField for Google Maps.

			var id = 'container3';
			var api = 'google';
			var elExample3 = new Y.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px', api: api, apikey: "Nk0DZDzV34FM2CIAsdRAtUgQJRSsJO7x2l5tuDBduamC_gZWkzyTEqcUJxAWjtqxs9Wnxb0-"});

			var elButton3 = inputEx.cn('button', null, null, "getValue");
		 Y.one(elButton3).on('click', function() {
				alert( Y.JSON.stringify(elExample3.getValue()) );
			});
			Y.one('#'+id).appendChild(elButton3);
		

Default MapField creation

Use the following code to create a inputEx MapField for whatever the default API is. We should complete this example by making buttons to change the default and store that in cookies.

			var id = 'container4';
			var elExample4 = new Y.inputEx.MapField({parentEl: id, name: 'mapField', width: '800px'});

			var elButton4 = inputEx.cn('button', null, null, "getValue");
			Y.one(elButton4).on('click', function() {
				alert( Y.JSON.stringify(elExample4.getValue()) );
			});
			Y.one('#'+id).appendChild(elButton4);