<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>mysrc.de &#187; AJAX</title> <atom:link href="http://www.mysrc.de/category/ajax/feed/" rel="self" type="application/rss+xml" /><link>http://www.mysrc.de</link> <description>- jQuery, MooTools, HTML5, AJAX</description> <lastBuildDate>Tue, 14 Jun 2011 08:24:25 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <item><title>jQuery load function &#8211; Ajax the simple way (Part 1)</title><link>http://www.mysrc.de/jquery/jquery-load-function-ajax-the-simple-way-part-1/</link> <comments>http://www.mysrc.de/jquery/jquery-load-function-ajax-the-simple-way-part-1/#comments</comments> <pubDate>Tue, 08 Dec 2009 21:50:06 +0000</pubDate> <dc:creator>Stefan Huissel</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[api]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=1055</guid> <description><![CDATA[Mit der load Funktion lassen sich einfach HTML-Elemente einer Datei in die Aktuelle einfügen. Diese Funktion ist in erster Linie für den &#8220;import&#8221; von HTML-Code gedacht und entspricht damit nicht dem typischen Ajax-Request bei dem bspw. ein PHP Skript angesprochen wird, das Daten aus der Datenbank liest und/oder andere serverseitige Prozesse anstösst. Soviel erstmal zur [...]]]></description> <content:encoded><![CDATA[<p>Mit der <a
href="http://docs.jquery.com/Ajax/load">load</a> Funktion lassen sich einfach HTML-Elemente einer Datei in die Aktuelle einfügen. Diese Funktion ist in erster Linie für den<strong> &#8220;import&#8221; von HTML-Code</strong> gedacht und entspricht damit <strong>nicht dem typischen Ajax-Request</strong> bei dem bspw. ein PHP Skript angesprochen wird, das Daten aus der Datenbank liest und/oder andere serverseitige Prozesse anstösst.</p><p>Soviel erstmal zur Theorie, der Funktionsaufruf sieht wie folgt aus:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p1055code3'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p10553"><td
class="line_numbers"><pre>1
</pre></td><td
class="code" id="p1055code3"><pre class="javascript" style="font-family:monospace;"> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#someElement'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'/someFile #mydiv'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>So kurz so einfach. In das Element mit der id <strong>&#8220;someElement&#8221;</strong> wird der gesamte Inhalt eines divs mit der id &#8220;mydiv&#8221; geladen. Das geniale dabei ist, dass sich <strong>&#8220;mydiv&#8221;</strong> überhaupt nicht im aktuellen Dokument befindet, sondern in der Datei <strong>&#8220;someFile&#8221;</strong>.<br
/> Als<strong> zweiten Parameter</strong> kann man der load Funktion auch noch Daten als sogenanntes <strong>Key/Value Paar</strong> übergeben.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p1055code4'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p10554"><td
class="line_numbers"><pre>1
</pre></td><td
class="code" id="p1055code4"><pre class="javascript" style="font-family:monospace;"> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#someElement'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'someFile.php'</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'param'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'someValue'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>Das enspricht allerdings jetzt schon eher dem normalen Ajax-Request. Das oder die Key/Value Paare werden dem php-Skript als post-Paramter übergeben. Natürlich <strong>verliert man damit den Vorteil</strong> des vorigen Beispiels sich einfach DOM-Elemente aus einem anderen HTML-Skript zu holen. Aber falls man das Ergebnis eines Request einfach direkt <strong>ohne weitere Verarbeitung</strong> in ein Element einfügen möchte, ist das eine sehr einfache und komfortable Variante.</p><p>Im nächsten Teil wird es dann um die anderen fortgeschritten jQuery Ajax Varianten wie get, getJSON, etc. gehen.</p><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>12. August 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-form-plugin-do-some-ajax-magic-easily/" title="jQuery Form Plugin &#8211; Do some AJAX magic easily">jQuery Form Plugin &#8211; Do some AJAX magic easily</a></li><li>16. Mai 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-formulare-validieren-ein-uberblick/" title="jQuery Formulare validieren &#8211; Ein Überblick">jQuery Formulare validieren &#8211; Ein Überblick</a></li><li>16. Mai 2009 -- <a
href="http://www.mysrc.de/jquery/formulare-mit-jquery-die-umfassende-serie/" title="Formulare mit jQuery &#8211; die umfassende Serie">Formulare mit jQuery &#8211; die umfassende Serie</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/jquery/jquery-load-function-ajax-the-simple-way-part-1/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>jQuery Formulare validieren &#8211; Ein Überblick</title><link>http://www.mysrc.de/jquery/jquery-formulare-validieren-ein-uberblick/</link> <comments>http://www.mysrc.de/jquery/jquery-formulare-validieren-ein-uberblick/#comments</comments> <pubDate>Sat, 16 May 2009 02:51:04 +0000</pubDate> <dc:creator>Oliver Storm</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[Forms]]></category> <category><![CDATA[Formulare]]></category> <category><![CDATA[MooTools]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=573</guid> <description><![CDATA[Wie im vorigen Post angekündigt starten wir heute mit unserer Post-Reihe &#8220;Formulare mit jQuery &#8211; Die umfassende Serie&#8220;. Heute wollen wir mit Teil 1 &#8211; &#8220;Übersicht über aktuelle Form-Validaton Scripts&#8221; beginnen. Da es zahlreiche dieser Scripts gibt, und diese sich Teilweise nur minimal voneinander unterscheiden da sie meist auf dem bassistance-Plugin von Jörn Zaefferer basieren, [...]]]></description> <content:encoded><![CDATA[<p>Wie im <a
title="Formulare mit jQuery - die umfassende Serie" href="http://www.mysrc.de/jquery/formulare-mit-jquery-die-umfassende-serie/" target="_self">vorigen Post</a> angekündigt starten wir heute mit unserer Post-Reihe &#8220;<strong>Formulare mit jQuery &#8211; Die umfassende Serie</strong>&#8220;.</p><p>Heute wollen wir mit <strong>Teil 1 &#8211; &#8220;Übersicht über aktuelle Form-Validaton Scripts&#8221;</strong> beginnen.<br
/> Da es zahlreiche dieser Scripts gibt, und diese sich Teilweise nur minimal voneinander unterscheiden da sie meist auf dem bassistance-Plugin von Jörn Zaefferer basieren, werden wir versuchen euch hier nur die vorzustellen welche besonders im Bezug auf <strong>Funktionalität</strong>, <strong>Größe </strong>oder <strong>Einfachheit der Implementierung</strong> sind.</p><hr
style="margin: 10px 0pt; color: #cccccc; height: 1px;" /><a
title="bassistance - jQuery plugin: Validation" href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" target="_blank"><br
/> bassistance &#8211; jQuery plugin: Validation</a></p><p>Beim validation Plugin von bassistance kann man wohl vom offiziellen validation Plugin von jQuery sprechen. Dieses Plugin lässt nahezu keine Wünsche offen.<br
/> Das Plugin ist, für die vielzahl an Möglichkeiten die es bietet, mit nur <strong>24KB</strong> in der minified-Version nicht sonderlich groß. Es ist ab <strong>jQuery 1.2.6+</strong> verfügbar und kompatibel mit Version <strong>1.3.2.</strong></p><p>Es bietet alle nur erdenklichen Arten der Formular Überprüfung.</p><ul><li><strong>Validierung on the fly</strong> (beim Wechsel in das nächste Feld), validieren auf submit, validieren von Textfeldern, Textareas, radiobuttons und checkboxen.</li><li>Es besteht z.B. auch die Möglichkeit diese in Abhängigkeit voneinander zu prüfen. Bei einer Gruppe von checkboxen kann z.b. geprüft werden wieviele ausgewählt sein müssen usw.</li><li>Auch das prüfen von Selects und multiple-Selects ist ohne weiteres möglich.</li><li>Eingaben können auf Länge, Typ (E-Mail, Number, String&#8230;), Anzahl der gewählten Elemente usw. validiert werden.</li><li>Die Ausgabe der <strong>Error-Messages</strong> ist sehr flexibel gehalten. So können diese direkt am entsprechenden Formular-Element oder gesammelt, z.B. in einem div, ausgegeben werden. Ändert der User eine fehlerhafte Eingabe reagiert die Validierung und ändert die Error-Messages on the fly.</li><li>Mit dem Plugin können richtig ausgefüllte Formulare, auf submit, auch direkt per <strong>AJAX</strong> verarbeitet werden.</li></ul><p>Das einbinden des Scripts ist auch denkbar einfach.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p573code11'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p57311"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td
class="code" id="p573code11"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#FormularID&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">validate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
		rules<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
			firstname<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;required&quot;</span><span style="color: #339933;">,</span>
			lastname<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;required&quot;</span><span style="color: #339933;">,</span>
			username<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
				required<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
				minlength<span style="color: #339933;">:</span> <span style="color: #CC0000;">2</span>
			<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
			password<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
				required<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
				minlength<span style="color: #339933;">:</span> <span style="color: #CC0000;">5</span>
			<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
			confirm_password<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
				required<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
				minlength<span style="color: #339933;">:</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span>
				equalTo<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;#password&quot;</span>
			<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>Nun müsst ihr nur noch euren Formular-Elementen die entsprechende ID geben.</p><p>Eine Vielzahl von Demos und die Dateien zum Download findet ihr auf der offiziellen <a
title="bassistance - jQuery plugin: Validation" href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" target="_self">Website</a>.<br
/> <span
id="more-573"></span></p><hr
style="margin: 10px 0pt; color: #cccccc; height: 1px;" /><a
title="jVal - jQuery Form Field Validation Plugin " href="http://www.overset.com/2008/07/31/jval-jquery-form-field-validation-plugin" target="_blank"><br
/> jVal &#8211; jQuery Form Field Validation Plugin </a></p><p>Bei <strong>jVal</strong> handelt sich um eines der etwas schöneren Validation-Plugins.<br
/> Das Plugin funktioniert mit der aktuellen jQuery-Version 1.3.1 und hat nur 5.3KB.<br
/> Die <strong>Grundfunktionen</strong> des Plugins kurz im Überblick:</p><ul><li>Validieren von Inhalten innerhalb eines bestimmten Containers, basierend auf den Attributen des Input-Tags.</li><li><strong>Einfache Konfiguration</strong> der Validierungsmöglichkeiten.</li><li>Validierung aller Formular-Felder innerhalb eines Containers mit einem einzigen Funktionsaufrufs.</li><li>Validierung einzelner Formular-Felder wenn der User das Feld verlässt.</li><li>Verhindern der Eingabe von <strong>speziellen Zeichen</strong> in ein Feld mit Meldung an den User das dies nicht erlaubt ist.</li></ul><p>Das besondere an diesem Plugin ist wohl die animierte Ausgabe der Fehlermeldungen. Diese sliden mit einem Blur vom Feldende aus ein.</p><p><img
class="alignnone size-full wp-image-552" title="jVal" src="http://www.mysrc.de/wp-content/uploads/2009/05/jval1.jpg" alt="jVal" width="460" height="99" /></p><p>Für das Plugin werden neben der jVal.js und der jquery.js noch ein jVal.css sowie <a
title="jquery.corner.js" href="http://www.malsup.com/jquery/corner/jquery.corner.js" target="_blank">jquery.corner.js</a> von <a
title="Dave Methvin - jQuery Corner" href="http://methvin.com/jquery/jq-corner.html" target="_blank">Dave Methvin</a> benötigt. Mittels des sehr übersichtlichen css-Files lässt sich das Aussehen der Error-Messages ohne Probleme anpassen.</p><p>Das implementieren des Plugins ist, wie ich finde, nicht ganz optimal gelöst. Hat man sich jedoch erst einmal damit vertraut gemacht geht es doch reicht einfach von der Hand.<br
/> Die übergabe der Parameter findet, im Gegensatz zu den meisten anderen Plugins, nicht zentral statt sondern muss jedem Formular-Element mitgegeben werden.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p573code12'); return false;">View Code</a> HTML</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p57312"><td
class="line_numbers"><pre>1
</pre></td><td
class="code" id="p573code12"><pre class="html" style="font-family:monospace;">&lt;input id=&quot;f1&quot; size=&quot;20&quot; type=&quot;text&quot; /&gt;</pre></td></tr></table></div><hr
style="margin: 10px 0pt; color: #cccccc; height: 1px;" /><a
title="jQuery AlphaNumeric" href="http://itgroup.com.ph/alphanumeric/" target="_blank"><br
/> jQuery AlphaNumeric</a></p><p>AlphaNumeric von Paulo Marinas ist ein validation-Plugin welches sich speziell der <strong>Begrenzung der Eingabe</strong> widmet. AlphaNumeric baut auf dem <a
title="jQuery - numeric" href="http://www.texotela.co.uk/code/jquery/numeric/" target="_blank">Numeric Plugin</a> von Sam Collet auf, welches nur die Eingabe von Zahlen und Punkten erlaubt.<br
/> Mit AlphaNumeric habt ihr die Möglichkeit die Eingaben in Formularfelder so zu Filtern das nur <strong>bestimmte Typen</strong> eingegeben werden können.<br
/> Die <strong>Grundfunktionen </strong>des Plugins kurz im Überblick:</p><ul><li>Begrenzung der Eingabe ausschließlich auf Buchstaben</li><li>Begrenzung der Eingabe ausschließelich auf Zahlen</li><li>Begrenzung der Eingabe auf Zahlen und Buchstaben (keine Satz oder Sonderzeichen)</li><li>Erstellen eigener Regeln für die Eingabe</li></ul><p>Ein sehr nützliches Plugin wenn man die volle Kontrolle über seine Felder haben will.<br
/> Ein einfaches Beispiel für die Implementierung:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p573code13'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p57313"><td
class="line_numbers"><pre>1
2
</pre></td><td
class="code" id="p573code13"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.klasse1'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">alphanumeric</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.klasse2'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">alphanumeric</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>allow<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;., &quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>dann müsst Ihr nur noch euren Textfelder die entsprechende Klasse zuweisen und das war es schon.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p573code14'); return false;">View Code</a> HTML</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p57314"><td
class="line_numbers"><pre>1
2
</pre></td><td
class="code" id="p573code14"><pre class="html" style="font-family:monospace;">&lt;input class=&quot;klasse1 tb&quot; size=&quot;10&quot; type=&quot;text&quot; /&gt;
&lt;input class=&quot;klasse2 tb&quot; size=&quot;10&quot; type=&quot;text&quot; /&gt;</pre></td></tr></table></div><p>Alle Dateien zum Download sowie Demos findet ihr auf der offiziellen <a
title="jQuery AlphaNumeric" href="http://itgroup.com.ph/alphanumeric/" target="_blank">Website</a>.</p><hr
style="margin: 10px 0pt; color: #cccccc; height: 1px;" /><a
title="Form Validator" href="http://www.jeremy-fry.com/2008/10/20/form-validator" target="_blank"><br
/> Form Validator</a></p><p>Der Form Validator von Jeremy Fry überzeugt aufgrund seiner Schlicht- und Schönheit. Zudem ist er extrem einfach zu implementieren. Das Plugin hat nur <strong>5KB</strong> und läuft mit jQuery <strong>1.3.2</strong></p><p>Formularfelder werden <strong>on the fly validiert</strong> und werden, je nach Eingabe, &#8220;grün&#8221; oder &#8220;rot&#8221; umrahmt.<br
/> Zusätzlich kann man direkt angeben welche php-Datei zur Verarbeitung aufgrufen werden soll.<br
/> Sind alle Eingaben valide und klickt man auf Submit, so fadet das Formular aus und verarbeitet die Eingaben via AJAX und gibt das Ergebniss zurück.<br
/> Speziell validiert werden können E-Mailadressen, Telefonnummern, Postleitzahlen, Namen und Datumseingaben.<br
/> Das zugehörige CSS ist sehr übersichtlich und kann problemlos angepasst werden.</p><p><img
class="alignnone size-full wp-image-564" title="formvalidator" src="http://www.mysrc.de/wp-content/uploads/2009/05/formvalidator.jpg" alt="formvalidator" width="460" height="126" /></p><p>Ein einfaches Beispiel für die Implementierung:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p573code15'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p57315"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td
class="code" id="p573code15"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#myform'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">FormValidate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
		phpFile<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;send.php&quot;</span><span style="color: #339933;">,</span>
		ajax<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		validCheck<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>Anschließend nur noch euren Textfeldern die entsprechnden Klassen zuweisen.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p573code16'); return false;">View Code</a> HTML</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p57316"><td
class="line_numbers"><pre>1
2
</pre></td><td
class="code" id="p573code16"><pre class="html" style="font-family:monospace;">&lt;input id=&quot;form_name&quot; class=&quot;is_required&quot; name=&quot;Name&quot; type=&quot;text&quot; /&gt;
&lt;input id=&quot;form_email&quot; class=&quot;vemail&quot; name=&quot;Email&quot; type=&quot;text&quot; /&gt;</pre></td></tr></table></div><p>Eine Demo sowie alle Dateien zum Download findet Ihr auf der offiziellen <a
title="Form Validator" href="http://www.jeremy-fry.com/2008/10/20/form-validator" target="_blank">Website</a>.</p><hr
style="margin: 10px 0pt; color: #cccccc; height: 1px;" />Sicher könnte man diese Liste um etliche andere  Plugins erweitern. Allerdings solltet Ihr mit  den oben vorgestellten Plugins so ziemlich <strong>alle Anforderungen</strong> die man an eine <strong>Formular-Validierung </strong>haben kann abdecken können. Es gibt noch ein paar weitere Plugins die ab und an nützlich sein können, die euch hier aber nur kurz in einer Linkliste an die Hand geben möchte.</p><ul><li><a
title="Simple jQuery form validation" href="http://www.willjessup.com/sandbox/jquery/form_validator/form_validate.html" target="_blank">Einfache jQuery form validaton mit JSON return</a></li><li><a
title="Validation Plugin" href="http://www.consulenza-web.com/jquery_plugins/validation.html" target="_blank">jQuery Formular zum Filtern versch. Eingaben</a></li><li><a
title="Stunning ajax form validation" href="http://www.drsoft.com/b/Stunning_ajax_form_validation-54" target="_blank">Formular-Validierung mit jQuery und AJAX</a></li><li><a
title="A simple AJAX (JQuery) Contact Form with PHP Validation" href="http://www.bitrepository.com/a-simple-ajax-contact-form-with-php-validation.html" target="_blank">Einfaches jQuery (AJAX) Formular mit PHP-Validierung</a></li><li><a
title="How to Mask Input with jQuery?" href="http://webdeveloperplus.com/jquery/how-to-mask-input-with-jquery/" target="_blank">Formular Eingaben mit jQuery maskieren</a></li><li><a
title="Customizing jQuery Validation" href="http://blogs.teamb.com/craigstuntz/2009/01/15/37923/" target="_blank">jQuery Validierung customizen</a></li></ul><p>Der Vollständigkeit wegen sollt hier auch noch das <a
title="jQuery Form Plugin" href="http://malsup.com/jquery/form/#code-samples" target="_blank">Form Plugin von Malsup</a> erwähnt werden, welches sicher eines der, wenn nicht dass, <strong>umfangreichsten Formular Plugins für jQuery</strong> ist. Welches unteranderem auch validierungs Möglichkeiten bietet. Dieses Plugin werden wir euch in Teil 4 &#8220;Übersicht über aktuelle jQuery-Plugins zum verarbeiten von Formulardaten per AJAX&#8221; näher vorstellen werden.</p><p>Sollte der ein oder andere von euch der Meinung sein wir hätten ein wirklich relevantes Plugin vergessen freuen wir uns immer über Kommentare oder eine E-Mail.</p><hr
style="margin: 10px 0pt; color: #cccccc; height: 1px;" /><strong><br
/> Randnotiz</strong></p><p>Auch wenn es in diesem Post eigentlich um Formulare mit jQuery geht möchte ich euch noch kurz ein validation-Script für<strong> MooTools</strong> vorstellen.<br
/> <a
title="MooTools.Floor FormCheck" href="http://mootools.floor.ch/en/labs/formcheck/forum-registration/index.htm" target="_blank">MooTools.Floor FormCheck</a>. Dieses Plugin ist meiner Meinung nach eines der schönsten validierungs-Plugins die es moment gibt und ist unsere erste Wahl bei Projekten in denen wir MooTools nutzen.</p><p><img
class="alignnone size-full wp-image-535" title="MooTools.Floor FormCheck" src="http://www.mysrc.de/wp-content/uploads/2009/05/mootoolsfloor.jpg" alt="MooTools.Floor FormCheck" width="460" height="89" /></p><p>Das Plugin beherrscht alle gänigen validierungs-Formen hat aber ein paar schöne Besonderheiten.<br
/> So erscheinen die Fehlermeldungen schön in Form von Tooltips am Formularelement.<br
/> Ausserdem slided das Plugin, auf Submit, die Seite an die Stelle an welcher der Fehler angezeigt wird.<br
/> Das ganze könnt ihr euch in dieser <a
title="MooTools.Floor FormCheck - Demo" href="http://mootools.floor.ch/en/labs/formcheck/forum-registration/index.htm" target="_self">Demo </a>anschauen.</p><hr
style="margin: 10px 0pt; color: #cccccc; height: 1px;" />Ich hoffe euch mit diesem Post einen ersten Überblick über Formular Validierung verschafft zu haben.</p><p>Verpasst nicht die Folgeteile dieser Serie und aboniert unser <a
title="mySrc.de - RSS Feed" href="http://www.mysrc.de/feed/" target="_self">RSS-Feed</a>.</p><hr
style="margin: 10px 0pt; color: #cccccc; height: 1px;" />Formulare mit jQuery &#8211; die umfassende Serie:</p><ul><li>Teil 1: <a
title="jQuery Formulare validieren - Ein Überblick" href="http://www.mysrc.de/jquery/jquery-formulare-validieren-ein-uberblick/" target="_self">Übersicht über aktuelle Form-Validaton Scripts.</a></li></ul><hr
style="margin: 10px 0pt; color: #cccccc; height: 1px;" /><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>12. August 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-form-plugin-do-some-ajax-magic-easily/" title="jQuery Form Plugin &#8211; Do some AJAX magic easily">jQuery Form Plugin &#8211; Do some AJAX magic easily</a></li><li>16. Mai 2009 -- <a
href="http://www.mysrc.de/jquery/formulare-mit-jquery-die-umfassende-serie/" title="Formulare mit jQuery &#8211; die umfassende Serie">Formulare mit jQuery &#8211; die umfassende Serie</a></li><li>19. November 2010 -- <a
href="http://www.mysrc.de/jquery/praxistipp-suchfeld-leeren-on-focus-jquery/" title="Praxistipp: Suchfeld leeren on focus (jQuery)">Praxistipp: Suchfeld leeren on focus (jQuery)</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/jquery/jquery-formulare-validieren-ein-uberblick/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Formulare mit jQuery &#8211; die umfassende Serie</title><link>http://www.mysrc.de/jquery/formulare-mit-jquery-die-umfassende-serie/</link> <comments>http://www.mysrc.de/jquery/formulare-mit-jquery-die-umfassende-serie/#comments</comments> <pubDate>Sat, 16 May 2009 02:48:38 +0000</pubDate> <dc:creator>Oliver Storm</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[Web-Development]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[Forms]]></category> <category><![CDATA[Formulare]]></category> <category><![CDATA[upload]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=512</guid> <description><![CDATA[Wie wichtig das Thema Fomulare und jQuery ist, fällt uns beim regelmäßigen überfliegen unserer Blog Statistiken immer wieder auf. Viele der Suchanfragen über Google beinhalten Keywords die mit jQuery und Formularen zu tun haben. Auch die Seiten welche mitunter die meisten Zugriffe haben gehen in diese Richtung. Wir wollen dem ganzen Rechnung tragen und starten [...]]]></description> <content:encoded><![CDATA[<p>Wie wichtig das Thema Fomulare und jQuery ist, fällt uns beim regelmäßigen überfliegen unserer Blog Statistiken immer wieder auf. Viele der Suchanfragen über Google<strong> </strong>beinhalten<strong> Keywords</strong> die mit <strong>jQuery und Formularen</strong> zu tun haben.<br
/> Auch die Seiten welche mitunter die meisten Zugriffe haben gehen in diese Richtung.<br
/> Wir wollen dem ganzen Rechnung tragen und starten heute eine langfristige und ausführliche Serie zum gesamten Thema <strong>&#8220;Formulare und jQuery&#8221;</strong>.<br
/> Die Serie wird aus mehreren Teilen bestehen und sich wie folgt aufgliedern:</p><ul><li><a
title="jQuery Formulare validieren - Ein Überblick" href="http://www.mysrc.de/jquery/jquery-formulare-validieren-ein-uberblick/" target="_self">Übersicht über aktuelle Form-Validaton Scripts.</a></li><li>Überblick über die wichtigsten Funktionen die jQuery für die Validierung bietet.</li><li>Tutorial &#8220;Eigenes Validation-Script mit jQuery erstellen&#8221;.</li><li>Übersicht über aktuelle jQuery-Plugins zum verarbeiten von Formulardaten per AJAX.</li><li>Tutorial &#8220;Eigenes jQuery-Plugin zum verarbeiten von Formulardaten per AJAX inkl. Dateiupload&#8221;.</li><li>Überblick über die wichtigsten Funktionen die jQuery zum modifizieren von Formularen bietet.</li><li>Übersicht zum Thema &#8220;customized Forms&#8221;. Schönere Formulare mit jQuery.</li><li>Übersicht zum Thema &#8220;weiterführende Formulartechniken&#8221;.  Autocomplete, In Place Editing, Date Picker, ToolTips, doppeltes versenden verhindern und ein paar weitere Kleinigkeiten.</li></ul><p>Zum Abschluss der Serie werden wir euch noch unser <strong>neues Formular-Plugin</strong> vorstellen an dem wir momentan mit Hochdruck arbeiten. Soviel vorab.</p><p>Heute wollen wir gleich mit <strong>Teil 1 &#8211; &#8220;<a
title="jQuery Formulare validieren - Ein Überblick" href="http://www.mysrc.de/jquery/jquery-formulare-validieren-ein-uberblick/" target="_self">Übersicht über aktuelle Form-Validaton Scripts</a>&#8220;</strong> beginnen.</p><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>12. August 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-form-plugin-do-some-ajax-magic-easily/" title="jQuery Form Plugin &#8211; Do some AJAX magic easily">jQuery Form Plugin &#8211; Do some AJAX magic easily</a></li><li>16. Mai 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-formulare-validieren-ein-uberblick/" title="jQuery Formulare validieren &#8211; Ein Überblick">jQuery Formulare validieren &#8211; Ein Überblick</a></li><li>14. Mai 2009 -- <a
href="http://www.mysrc.de/jquery/ajax-datei-upload-mit-jquery/" title="Ajax Datei-Upload mit jQuery">Ajax Datei-Upload mit jQuery</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/jquery/formulare-mit-jquery-die-umfassende-serie/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Ajax Datei-Upload mit jQuery</title><link>http://www.mysrc.de/jquery/ajax-datei-upload-mit-jquery/</link> <comments>http://www.mysrc.de/jquery/ajax-datei-upload-mit-jquery/#comments</comments> <pubDate>Thu, 14 May 2009 21:50:32 +0000</pubDate> <dc:creator>Stefan Huissel</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[Forms]]></category> <category><![CDATA[Plugin]]></category> <category><![CDATA[upload]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=487</guid> <description><![CDATA[Eine geschickte und schnelle Methode um den Upload von Dateien in Formularen zu erledigen ist wie so oft Ajax. Ein nettes Plugin dafür gibt es auf http://valums.com/ajax-upload/, welches zudem auch Multiple Uploads unterstützt. Das Plugin glänzt nicht nur durch seine einfache Handhabung, auch lässt sich damit das lästige Problem der Gestaltung von Uploadformularfeldern, also &#8220;input [...]]]></description> <content:encoded><![CDATA[<p>Eine geschickte und schnelle Methode um den Upload von Dateien in Formularen zu erledigen ist wie so oft <strong>Ajax</strong>. Ein nettes Plugin dafür gibt es auf <a
href="http://valums.com/ajax-upload/" target="_blank">http://valums.com/ajax-upload/</a>, welches zudem auch <strong>Multiple Uploads</strong> unterstützt.<br
/> Das <strong>Plugin </strong>glänzt nicht nur durch seine einfache Handhabung, auch lässt sich damit das lästige Problem der <strong>Gestaltung</strong> von <strong>Uploadformularfeldern</strong>, also &#8220;input type=&#8221;file&#8221;..&#8221; in den Griff bekommen. Auf diese Felder greift das CSS oft nicht wie es sollte usw.</p><p>Auf was ihr allerdings achten solltet ist, dass die Dateien, die mit dem Plugin schon hochgeladen wurden, bevor <strong>der Submit abgesetzt</strong>, bzw. <strong>vor dem Abschicken des Formulars</strong> auf dem Server liegen, während die restlichen POST Daten eben erst auf Click eines Absenden Buttons an ein Skript weitergereicht werden. Kurz gesagt, wenn Upload <strong>mit Ajax</strong> und das <strong>Formular</strong> als Method Attribut <strong>GET/POST</strong> hat, muss man aufpassen. Das heißt es sollte überprüft werden ob die hochgeladenen Bilder auch tatsächlich genutzt werden und der User nicht nur einfach wild Dateien hochgeladen hat ohne Das Formular auszufüllen.</p><p>Screeshot der Demo:<br
/> <img
src="http://www.mysrc.de/wp-content/uploads/2009/05/ajax_upload.png" alt="ajax_upload" title="ajax_upload" width="450" height="145" class="alignnone size-full wp-image-494" /></p><p>Kurz zu den Bestandteilen des Codes:</p><p>- Der HTML Teil</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p487code20'); return false;">View Code</a> HTML</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p48720"><td
class="line_numbers"><pre>1
2
3
</pre></td><td
class="code" id="p487code20"><pre class="html" style="font-family:monospace;">&nbsp;
&lt;!-- Anlegen eines einfachen Divs auf das später die Upload Funktion gelegt wird --&gt;
&lt;div id=&quot;upload_button&quot;&gt;Upload&lt;/div&gt;</pre></td></tr></table></div><p>- Der Javascript Teil (weitere js-Dateien werden nicht benötigt)</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p487code21'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p48721"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td
class="code" id="p487code21"><pre class="javascript" style="font-family:monospace;">&nbsp;
<span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;ajaxupload.3.1.js&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
    $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #003366; font-weight: bold;">new</span> AjaxUpload<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'upload_button'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>action<span style="color: #339933;">:</span> <span style="color: #3366CC;">'upload.php'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div><p>Der Ajaxupload kann auch durch Callback-Funktionen und andere Parameter eingestellt werden. Der Code auf der englischen Website ist selbsterklärend. Fragen könnt ihr auch hier stellen.</p><p>- Nach abesenden der Daten an &#8220;upload.php&#8221; geht es an die serverseite Verarbeitung</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p487code22'); return false;">View Code</a> PHP</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p48722"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td
class="code" id="p487code22"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000088;">$uploaddir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/var/www/uploads/'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$uploadfile</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$uploaddir</span> <span style="color: #339933;">.</span> <a href="http://www.php.net/basename"><span style="color: #990000;">basename</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'userfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//move_uploaded_file ist die Standard PHP-Funktion um Dateien auf dem Server zu verarbeiten</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/move_uploaded_file"><span style="color: #990000;">move_uploaded_file</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'userfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tmp_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$uploadfile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;success&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// Als echo keinesfalls false benutzen. Führt zu Konflikten mit dem Ajax-Request</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;error&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div><p>Auf der Valums Website gibt es ebenfalls Beispiele für Ruby sowie Coldfusion.</p><p>Die Demo findet ihr <a
href="http://valums.com/wp-content/uploads/ajax-upload/demo-jquery.htm">hier</a></p><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>12. August 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-form-plugin-do-some-ajax-magic-easily/" title="jQuery Form Plugin &#8211; Do some AJAX magic easily">jQuery Form Plugin &#8211; Do some AJAX magic easily</a></li><li>16. Mai 2009 -- <a
href="http://www.mysrc.de/jquery/formulare-mit-jquery-die-umfassende-serie/" title="Formulare mit jQuery &#8211; die umfassende Serie">Formulare mit jQuery &#8211; die umfassende Serie</a></li><li>4. September 2009 -- <a
href="http://www.mysrc.de/jquery/praxistip-output-element-des-jquery-validate-plugin-andern/" title="Praxistip: Output Element des jQuery Validate Plugin ändern">Praxistip: Output Element des jQuery Validate Plugin ändern</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/jquery/ajax-datei-upload-mit-jquery/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>jQuery &#8211; Was sollte man bzgl. Performacne beachten</title><link>http://www.mysrc.de/jquery/jquery-was-sollte-man-bzgl-performacne-beachten/</link> <comments>http://www.mysrc.de/jquery/jquery-was-sollte-man-bzgl-performacne-beachten/#comments</comments> <pubDate>Wed, 29 Apr 2009 13:07:22 +0000</pubDate> <dc:creator>Oliver Storm</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[jQuery]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=451</guid> <description><![CDATA[Ich bin soeben über einen schönen Artikel zum Thema Performance und jQuery gestolpert. In dem Artikel geht es darum was man beachten sollte um optimale Performance mit jQuery zu erzielen. Es werden Themen wie warum man ID als selektor nutzen sollte, oder warum man besser Tags als Klassen nehmen sollte usw. angeschnitten. jQuery Performance Rules [...]]]></description> <content:encoded><![CDATA[<p>Ich bin soeben über einen schönen Artikel zum Thema Performance und jQuery gestolpert.</p><p>In dem Artikel geht es darum was man beachten sollte um optimale Performance mit jQuery zu erzielen.<br
/> Es werden Themen wie warum man ID als selektor nutzen sollte, oder warum man besser Tags als Klassen nehmen sollte usw. angeschnitten.<br
/> <a
title="jQuery Performance Rules" href="http://www.artzstudio.com/2009/04/jquery-performance-rules/" target="_self">jQuery Performance Rules</a></p><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>1. Dezember 2010 -- <a
href="http://www.mysrc.de/html5/jquery-mobile-der-eitenaufbau/" title="jQuery Mobile &#8211; Der Seitenaufbau">jQuery Mobile &#8211; Der Seitenaufbau</a></li><li>25. November 2010 -- <a
href="http://www.mysrc.de/jquery/jquery-mobile-web-apps-mit-jquery/" title="jQuery Mobile &#8211; Web-Apps mit jQuery">jQuery Mobile &#8211; Web-Apps mit jQuery</a></li><li>19. November 2010 -- <a
href="http://www.mysrc.de/jquery/praxistipp-suchfeld-leeren-on-focus-jquery/" title="Praxistipp: Suchfeld leeren on focus (jQuery)">Praxistipp: Suchfeld leeren on focus (jQuery)</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/jquery/jquery-was-sollte-man-bzgl-performacne-beachten/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Formulare mit AJAX und jQuery &#8211; Ein kleines Tutorial</title><link>http://www.mysrc.de/jquery/formulare-mit-ajax-und-jquery-ein-kleines-tutorial/</link> <comments>http://www.mysrc.de/jquery/formulare-mit-ajax-und-jquery-ein-kleines-tutorial/#comments</comments> <pubDate>Sun, 19 Apr 2009 14:52:54 +0000</pubDate> <dc:creator>Stefan Huissel</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[JS-Framework Tutorials]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[Forms]]></category> <category><![CDATA[Tutorial]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=394</guid> <description><![CDATA[AJAX ist eine vom Prinzip her sehr einfache Technologie. Request mit JS abschicken, Anfrage mit serverseitigem Skript verarbeiten und Ergebnis wieder im Browser ausgeben bzw. anzeigen. Allerdings steckt der Teufel wie immer im Detail. Dieser Post ist eine kleine Anleitung wie man AJAX mit einem Formular einsetzen kann. Weit einfacher ist dies mit der Verwendung [...]]]></description> <content:encoded><![CDATA[<p>AJAX ist eine vom Prinzip her sehr einfache Technologie. Request mit JS abschicken, Anfrage mit serverseitigem Skript verarbeiten und Ergebnis wieder im Browser ausgeben bzw. anzeigen. Allerdings steckt der Teufel wie immer im Detail. Dieser Post ist eine kleine Anleitung wie man <strong>AJAX mit einem Formular</strong> einsetzen kann. Weit einfacher ist dies mit der Verwendung eines JS-Frameworks, hier jQuery.</p><p>So zunächste einmal der Standardaufbau in HTML für ein Formular.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p394code26'); return false;">View Code</a> HTML</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p39426"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td
class="code" id="p394code26"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;block&quot;&gt;
&lt;div class=&quot;done&quot;&gt;
&lt;b&gt;Vielen Dank. Wir haben Ihre Anfrage erhalten&lt;/b&gt;
&lt;/div&gt;
	&lt;div class=&quot;myForm&quot;&gt;
	&lt;form method=&quot;post&quot; action=&quot;saveData.php&quot;&gt;
	&lt;div class=&quot;input&quot;&gt;
		&lt;label&gt;Name&lt;/label&gt;
		&lt;input type=&quot;text&quot; name=&quot;name&quot; class=&quot;text&quot; /&gt;
	&lt;/div&gt;
	&lt;div class=&quot;input&quot;&gt;
		&lt;label&gt;Email&lt;/label&gt;
		&lt;input type=&quot;text&quot; name=&quot;email&quot; class=&quot;text&quot; /&gt;
	&lt;/div&gt;
	&lt;div class=&quot;input&quot;&gt;
		&lt;label&gt;Kommentar&lt;/label&gt;
		&lt;textarea name=&quot;kommentar&quot; class=&quot;text textarea&quot; /&gt;&lt;/textarea&gt;
	&lt;/div&gt;
	&lt;div class=&quot;input&quot;&gt;
&nbsp;
		&lt;input type=&quot;submit&quot; id=&quot;submit&quot;/&gt;
		&lt;div class=&quot;loading_icon&quot;&gt;&lt;/div&gt;
	&lt;/div&gt;
	&lt;/form&gt;
	&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;</pre></td></tr></table></div><p>Nichts besonderes. Jedes Input Feld ist noch mit einem beschreibenden Label versehen. Zur einfacheren Gestaltung sind die einzelnen inputs mit ihren Labeln in einem div gehüllt. Die Divs mit der Klasse &#8220;loading_icon&#8221; und &#8220;done&#8221; sind zum Startzeitpunkt unsichtbar.<br
/> Das CSS dazu könnte man so umsetzen:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p394code27'); return false;">View Code</a> CSS</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p39427"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre></td><td
class="code" id="p394code27"><pre class="css" style="font-family:monospace;">body<span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.loading_icon</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">ajax-loader.gif</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #933;">1px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.done</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">iconIdea.gif</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #933;">2px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">70%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
.<span style="color: #000000; font-weight: bold;">clear</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span><span style="color: #993333;">both</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
.<span style="color: #993333;">block</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.input</span> <span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">2px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.input</span> label <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">75px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">700</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.input</span> input.<span style="color: #993333;">text</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">270px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.input</span> <span style="color: #6666ff;">.textarea</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">120px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">270px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.input</span> <span style="color: #cc00cc;">#submit</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div><p>So. Nun können  wir uns endlich um den AJAX-Request kümmern. Schauen wir uns an wie wir die Daten nun weiter verarbeiten und an das PHP-Skript weiterleiten.</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p394code28'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p39428"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre></td><td
class="code" id="p394code28"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">//click event für submit button</span>
  <span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#submit'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">//Daten von den HTML Feldern in JS-Vars übersetzen</span>
  <span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066;">name</span> <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[name=name]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> email <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[name=email]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> website <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[name=website]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> comment <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'textarea[name=comment]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">//die Daten sollen per GET an das PHP Skript weitergeleitet werden. Dafür bauen wir einen </span>
  <span style="color: #006600; font-style: italic;">//String</span>
  <span style="color: #003366; font-weight: bold;">var</span> data <span style="color: #339933;">=</span> <span style="color: #3366CC;">'name='</span> <span style="color: #339933;">+</span> <span style="color: #000066;">name</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;email='</span> <span style="color: #339933;">+</span> email.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&amp;comment='</span>  <span style="color: #339933;">+</span> encodeURIComponent<span style="color: #009900;">&#40;</span>kommentar.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">//alle Textfelder deaktivieren</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.text'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'true'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">//Icon während des Requests einblenden</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.loading_icon'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">//Request abschicken</span>
  $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//Ort des Skriptes in dem die per GET übertragenen Daten verarbeitet werden sollen</span>
	url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;saveData.php&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #006600; font-style: italic;">//Angabe der GET Methode, auch POST wäre möglich. Allerdings nur sinnvoll</span>
        <span style="color: #006600; font-style: italic;">//bei größeren Datenmengen</span>
	type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;GET&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #006600; font-style: italic;">//Daten die gesendet werden sollen			</span>
	data<span style="color: #339933;">:</span> data<span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">//bei Antwort des Requests (Response)</span>
	success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>reqCode<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//wenn saveData.php true bzw. den Status 1 zurückliefert</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>reqCode<span style="color: #339933;">==</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">//verstecken des Formulars</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.form'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #006600; font-style: italic;">//anzeigen der Erfolgsmeldung</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.done'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">//wenn der Request eine Form von false zurückschickt, Fehler ausgeben.</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
                        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Fehler beim Abschicken des Formulares.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">//der return wird benötigt, damit das Formular nicht tatsächlich abgeschickt wird und         </span>
        <span style="color: #006600; font-style: italic;">//sich nicht wie ein normales Form mit Seiten Refresh verhält.</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>All magic is done <img
src='http://www.mysrc.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> &#8230;</p><p><a
href="http://www.mysrc.de/demo/form_example/" target="blank">Demo</a></p><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>12. August 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-form-plugin-do-some-ajax-magic-easily/" title="jQuery Form Plugin &#8211; Do some AJAX magic easily">jQuery Form Plugin &#8211; Do some AJAX magic easily</a></li><li>30. Juni 2009 -- <a
href="http://www.mysrc.de/allgemein/jquery-mypass-password-hiding-iphone-style/" title="jQuery myPass &#8211; password hiding iPhone-Style">jQuery myPass &#8211; password hiding iPhone-Style</a></li><li>16. Mai 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-formulare-validieren-ein-uberblick/" title="jQuery Formulare validieren &#8211; Ein Überblick">jQuery Formulare validieren &#8211; Ein Überblick</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/jquery/formulare-mit-ajax-und-jquery-ein-kleines-tutorial/feed/</wfw:commentRss> <slash:comments>27</slash:comments> </item> <item><title>uploadify &#8211; a file upload plugin for jQuery</title><link>http://www.mysrc.de/jquery/uploadify-a-file-upload-plugin-for-jquery/</link> <comments>http://www.mysrc.de/jquery/uploadify-a-file-upload-plugin-for-jquery/#comments</comments> <pubDate>Tue, 07 Apr 2009 07:47:38 +0000</pubDate> <dc:creator>Oliver Storm</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[upload]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=317</guid> <description><![CDATA[Wer kennt das nicht!? Die Suche nach einem geeigneten Upload-Script oder Plugin gestaltet sich manchmal doch schwerer als vermutet. Trotz der Vielzahl an Scripts und Plugins die es gibt, geht es zumindest mir so das immer der ein oder andere Wunsch offen bleibt. Z.B. Kein ladebalken, oder keine Unterstüztung von mehreren Dateien usw. Deshalb möchte [...]]]></description> <content:encoded><![CDATA[<p>Wer kennt das nicht!? Die Suche nach einem geeigneten <strong>Upload-Script</strong> oder Plugin gestaltet sich manchmal doch schwerer als vermutet.<br
/> Trotz der Vielzahl an Scripts und Plugins die es gibt, geht es zumindest mir so das immer der ein oder andere Wunsch offen bleibt.<br
/> Z.B. Kein ladebalken, oder keine Unterstüztung von mehreren Dateien usw.</p><p>Deshalb möchte ich euch kurz <a
title="uploadify - jQuery File Upload Plugin" href="http://www.uploadify.com/" target="_blank">uploadify</a> vorstellen. Ein<strong> jQuery-Plugin</strong> welches zum einen leicht zu integrieren ist und zum anderen alles besitzt was man sich so wünscht.<br
/> Upload von einem odere mehreren Files, Ladebalken, und eine unglaubliche Anzahl von Einstellmöglichkeiten.</p><p>Der einzige Wehrmutstropfen, wenn überhaupt, ist die Tatsache das der Loader Flash benötigt.</p><p>Ein kleines Beispiel für die Implementierung:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p317code30'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p31730"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td
class="code" id="p317code30"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#fileInput'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fileUpload</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
          <span style="color: #3366CC;">'uploader'</span>  <span style="color: #339933;">:</span> <span style="color: #3366CC;">'uploader.swf'</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">'script'</span>    <span style="color: #339933;">:</span> <span style="color: #3366CC;">'upload.php'</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">'cancelImg'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'cancel.png'</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">'auto'</span>      <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
          <span style="color: #3366CC;">'folder'</span>    <span style="color: #339933;">:</span> <span style="color: #3366CC;">'/uploads'</span>
     <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>Eine Demo des ganzen findet man <a
title="uploadify - Demo" href="http://www.uploadify.com/demo/" target="_blank">hier</a>.</p><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>16. Mai 2009 -- <a
href="http://www.mysrc.de/jquery/formulare-mit-jquery-die-umfassende-serie/" title="Formulare mit jQuery &#8211; die umfassende Serie">Formulare mit jQuery &#8211; die umfassende Serie</a></li><li>14. Mai 2009 -- <a
href="http://www.mysrc.de/jquery/ajax-datei-upload-mit-jquery/" title="Ajax Datei-Upload mit jQuery">Ajax Datei-Upload mit jQuery</a></li><li>8. Dezember 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-load-function-ajax-the-simple-way-part-1/" title="jQuery load function &#8211; Ajax the simple way (Part 1)">jQuery load function &#8211; Ajax the simple way (Part 1)</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/jquery/uploadify-a-file-upload-plugin-for-jquery/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>QFocuser &#8211; AJAX widgets mit der Tastatur ansteuern</title><link>http://www.mysrc.de/javascript/qfocuser-ajax-widgets-mit-der-tastatur-ansteuern/</link> <comments>http://www.mysrc.de/javascript/qfocuser-ajax-widgets-mit-der-tastatur-ansteuern/#comments</comments> <pubDate>Wed, 04 Mar 2009 09:58:12 +0000</pubDate> <dc:creator>Oliver Storm</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[usability]]></category> <guid
isPermaLink="false">http://www.mysrc.de/?p=142</guid> <description><![CDATA[Das Navigieren durch Applikationen mittles der Tastatur ist ein wichtiger Bestandteil in allen Bereichen der useability und accessibility. Daniel Steigerwald hat sich der Problematik angenommen, welche entsteht sobald mehr als ein AJAX widget auf einer Seite vorhanden sind und eine kleine eigenständige Bibliothek namens QFocuser geschrieben. Momentan liegt QFocuser in der Version 0.95 vor und [...]]]></description> <content:encoded><![CDATA[<p>Das <strong>Navigieren durch Applikationen mittles der Tastatur</strong> ist ein wichtiger Bestandteil in allen Bereichen der useability und accessibility.<br
/> Daniel Steigerwald hat sich der Problematik angenommen, welche entsteht sobald mehr als ein AJAX widget auf einer Seite vorhanden sind und eine kleine eigenständige Bibliothek namens QFocuser geschrieben.</p><p>Momentan liegt QFocuser in der Version 0.95 vor und läuft auf IE6/7, FF2/3, Safari, Webkit, Opera und Chorme.</p><p>Die <strong>wichtigsten Features von QFocuser</strong> im Überlick:<ul><li>erlaubt es dem Widget key events abzufangen wenn es den focus bekommt</li><li>Der Fokus kann für jedes Element aktiviert werden</li><li>löst focus und blur events aus (so das z.b. eine Tabellenzeile nicht länger gehighlighted bleibt wenn man ausserhalb der Tabelle klickt)</li><li>Ermöglicht es das Widget über Tab anzusteuern</li></ul><p><a
href="http://daniel.steigerwald.cz/qfocuser/default.htm" target="_blank">Eine Demo des ganzen findet man hier.</a></p><p>Beispielcode:</p><div
class="wp_codebox_msgheader"><span
class="right"><sup><a
href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span
style="color: #99cc00">?</span></a></sup></span><span
class="left"><a
href="javascript:;" onclick="javascript:showCodeTxt('p142code32'); return false;">View Code</a> JAVASCRIPT</span><div
class="codebox_clear"></div></div><div
class="wp_codebox"><table><tr
id="p14232"><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td
class="code" id="p142code32"><pre class="javascript" style="font-family:monospace;">  <span style="color: #003366; font-weight: bold;">var</span> focuser <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> QFocuser<span style="color: #009900;">&#40;</span>widgetContainer<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066;">onFocus</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>focusedEl<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> .. <span style="color: #660066;">add</span> highlighted <span style="color: #003366; font-weight: bold;">class</span> or whatever <span style="color: #009900;">&#125;</span>
                <span style="color: #000066;">onBlur</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>focusedEl<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> .. <span style="color: #660066;">remove</span> highlighted <span style="color: #003366; font-weight: bold;">class</span> or whatever <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// attach your own keys listeners</span>
        $<span style="color: #009900;">&#40;</span>focuser.<span style="color: #660066;">getKeyListener</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'keydown'</span><span style="color: #339933;">,</span> e.<span style="color: #660066;">g</span>. <span style="color: #660066;">handleArrows</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #006600; font-style: italic;">// when your widget decided to set the focus (and then receive key events)</span>
        focuser.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span>tableRowForExample<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>zu finden ist das <a
href="http://code.google.com/p/qfocuser/" target="_blank">gesamte Projekt bei Google Code</a>.</p><h3  class="related_post_title">Ähnliche Artikel</h3><ul
class="related_post"><li>8. Dezember 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-load-function-ajax-the-simple-way-part-1/" title="jQuery load function &#8211; Ajax the simple way (Part 1)">jQuery load function &#8211; Ajax the simple way (Part 1)</a></li><li>16. Oktober 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-accessible-ria-widgets-fur-jedermann/" title="jQuery &#8211; Accessible-RIA &#8211; Widgets für jedermann">jQuery &#8211; Accessible-RIA &#8211; Widgets für jedermann</a></li><li>12. August 2009 -- <a
href="http://www.mysrc.de/jquery/jquery-form-plugin-do-some-ajax-magic-easily/" title="jQuery Form Plugin &#8211; Do some AJAX magic easily">jQuery Form Plugin &#8211; Do some AJAX magic easily</a></li></ul>]]></content:encoded> <wfw:commentRss>http://www.mysrc.de/javascript/qfocuser-ajax-widgets-mit-der-tastatur-ansteuern/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
