<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Gemeinde Daten mit JSON in ein Formular holen"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/3.page</link>
		<description><![CDATA[Latest messages posted in the topic "Gemeinde Daten mit JSON in ein Formular holen"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Gemeinde Daten mit JSON in ein Formular holen</title>
				<description><![CDATA[ Ich habe ein Formular mit dem ich Gemeindedaten anlegen möchte.
Wenn eine PLZ eingegeben wurde sollen die Basisdaten wie LAT, LNG, Regierungsbezirk etc. von Geonames geholt werden und in die Formulafelder eingetragen werden.

Aber irgendwie funktioniert das nicht. Wo liegt der Fehler

Hier ist mal das Formular:
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
	print "&lt;h1&gt;Gemeindeverzeichnis - Basisdaten anlegen:&lt;/h1&gt;";		
	print "&lt;p&gt;&lt;b&gt;Gemeindebasisdaten neu anlegen&lt;/b&gt;:&lt;/p&gt;";

	print "&lt;form name='addnew' aktion='?do=gemeinde&aktion=save' method='post'&gt;";
	
	print "&lt;table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"&gt;";	
	print "&lt;LABEL for=\"Gemeindedaten\"&gt;Gemeinde: &lt;/LABEL&gt;";
	
	print "&lt;tr&gt;";
    print "&lt;td width=\"25%\"&gt;Gemeinde:&lt;/td&gt;";
    print "&lt;td&gt;&lt;input name=\"gemeinde\" type=\"text\"  size=\"45\"&gt;&lt;/td&gt;";
  	print "&lt;/tr&gt;";
	
	print "&lt;tr&gt;";
    print "&lt;td width=\"25%\"&gt;PLZ:&lt;/td&gt;";
    print "&lt;td&gt;&lt;input name=\"plz\" type=\"text\" size=\"10\" onblur=\"search1&#40;&#41;;\" &gt;&lt;/td&gt;";
  	print "&lt;/tr&gt;";
	
	print "&lt;div id=\"resultDiv\"&gt;&lt;/div&gt;";
	
	
	print "&lt;/table&gt;";
		
	print "&lt;table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"&gt;";
	print "&lt;LABEL for=\"Basisdaten\"&gt;Gemeinde - Basisdaten: &lt;/LABEL&gt;";	
	print "&lt;tr&gt;";
    print "&lt;td width=\"25%\"&gt;Staat:&lt;/td&gt;";
    print "&lt;td&gt;&lt;input name=\"Staat\" type=\"text\"  size=\"5\"&gt;&lt;/td&gt;";
  	print "&lt;/tr&gt;";	
	print "&lt;tr&gt;";
    print "&lt;td width=\"25%\"&gt;Bundesland:&lt;/td&gt;";
    print "&lt;td&gt;&lt;input name=\"Bundesland\" type=\"text\"  size=\"5\"&gt;&lt;/td&gt;";
  	print "&lt;/tr&gt;";	
	print "&lt;tr&gt;";
    print "&lt;td width=\"25%\"&gt;Regierungsbezirk:&lt;/td&gt;";
    print "&lt;td colspan=\"2\"&gt;&lt;input name=\"Regierungsbezirk\" type=\"text\"  size=\"45\"&gt;&lt;/td&gt;";
  	print "&lt;/tr&gt;";	
	print "&lt;tr&gt;";
    print "&lt;td width=\"25%\"&gt;Landkreis:&lt;/td&gt;";
    print "&lt;td&gt;&lt;input name=\"Landkreis\" type=\"text\" size=\"45\"&gt;&lt;/td&gt;";
  	print "&lt;/tr&gt;";	
	print "&lt;/table&gt;";
	
	print "&lt;table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"&gt;";
	print "&lt;LABEL for=\"Geocode Daten\"&gt;Gemeinde - GPS: &lt;/LABEL&gt;";
	print "&lt;tr&gt;&lt;td width=\"25%\"&gt;Latitude:&lt;/td&gt;&lt;td &gt;&lt;input name=\"lat\" type=\"text\" value=\"\" size=\"45\"&gt;&lt;/td&gt;&lt;tr&gt;";
	print "&lt;tr&gt;&lt;td&gt;Longtitude:&lt;/td&gt;&lt;td &gt;&lt;input name=\"lon\" type=\"text\" value=\"\" size=\"45\"&gt;&lt;/td&gt;&lt;/tr&gt;";				
	print "&lt;tr&gt;";
	print "&lt;/table&gt;";
	
	print "&lt;table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"&gt;";
	print "&lt;LABEL for=\"Infotext\"&gt;Gemeinde - Infotext: &lt;/LABEL&gt;";	
    print "&lt;td colspan=\"2\"&gt;&lt;textarea name=\"infotext\" cols=\"55\" rows=\"15\" id=\"infotext\"&gt;&lt;/textarea&gt;&lt;/td&gt;";
  	print "&lt;/tr&gt;";
	print "&lt;/table&gt;";

	print "&lt;table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"&gt;";
	print "&lt;LABEL for=\"Aktionen\"&gt;Aktionen: &lt;/LABEL&gt;";	
    print "&lt;td &gt; &lt;input type='submit' value='Ok'&gt;  &lt;/td&gt;";
  	print "&lt;/tr&gt;";	
	print "&lt;/form&gt;";	
	print "&lt;/table&gt;";
</pre>
		</div>

Hier ist das Javascript:
<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
	&lt;script type="text/javascript" src="jsr_class.js"&gt;&lt;/script&gt;

 	&lt;script type="text/javascript"&gt;
		
	// http://ws.geonames.org/findNearbyPostalCodes?postalcode=97708&country=de&maxRows=1
		
	// - &lt;code&gt;
  	// PLZ: &lt;postalcode&gt;97708&lt;/postalcode&gt; 
  	// Gemeinde: &lt;name&gt;Bad Bocklet&lt;/name&gt; 
 	// Land: &lt;countryCode&gt;DE&lt;/countryCode&gt; 
	// &lt;lat&gt;50.2667&lt;/lat&gt; 
 	// &lt;lng&gt;10.0833&lt;/lng&gt; 
  	// Bundesland: &lt;adminCode1&gt;BY&lt;/adminCode1&gt; 
  	// &lt;adminName1&gt;Bayern&lt;/adminName1&gt; 
 	// &lt;adminCode2&gt;&lt;/adminCode2&gt; 
  	// Regierungsbezierk: &lt;adminName2&gt;Unterfranken&lt;/adminName2&gt;
  	// &lt;adminCode3&gt;&lt;/adminCode3&gt; 
  	// &lt;adminName3&gt;Landkreis Bad Kissingen&lt;/adminName3&gt; 
 	// &lt;distance&gt;&lt;/distance&gt; 
 	// &lt;/code&gt;

 function search1&#40;&#41; {
  request = 'http://ws.geonames.org/findNearbyPostalCodesJSON?postalcode=' +  encodeURIComponent&#40;document.getElementById&#40;"iplz"&#41;.value&#41;  + '&country=DE&maxRows=1&callback=getLocation'; 
  aObj = new JSONscriptRequest&#40;request&#41;;
  aObj.buildScriptTag&#40;&#41;;
  aObj.addScriptTag&#40;&#41;;
  }

function getLocation&#40;data&#41; {

	var html = '&lt;u&gt;&lt;b&gt;Daten gefunden:&lt;/b&gt;&lt;/u&gt;&lt;br&gt;';


	for &#40;i=0;i&lt; data.length;i++&#41; {
	
		var name = data&#91;i&#93;;
		html = html + '' + name.lat +',' + name.lng + '&lt;br&gt; ' +name.placeName + name.postalCode+' &lt;br&gt;';
	}
	
	document.getElementById&#40;'resultDiv'&#41;.innerHTML = html;


  
}

 	&lt;/script&gt;

</pre>
		</div>]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1308.page#5520</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1308.page#5520</link>
				<pubDate><![CDATA[Thu, 5 Mar 2009 13:10:15]]> GMT</pubDate>
				<author><![CDATA[ maffy]]></author>
			</item>
			<item>
				<title>Re:Gemeinde Daten mit JSON in ein Formular holen</title>
				<description><![CDATA[ hast du eine url wo man sehen kann wie es umgesetzt wird? Mit den vorliegenden Informationen weiss man weder, was das Problem ist, noch wie das Programm im Detail umgesetzt wurde.

Marc]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1308.page#5537</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1308.page#5537</link>
				<pubDate><![CDATA[Sun, 8 Mar 2009 12:21:50]]> GMT</pubDate>
				<author><![CDATA[ marc]]></author>
			</item>
	</channel>
</rss>