<?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>dotvoid.com &#187; ajax</title>
	<atom:link href="http://www.dotvoid.com/tag/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotvoid.com</link>
	<description>Experiments and thoughts in PHP and javascript</description>
	<lastBuildDate>Tue, 11 Oct 2011 12:49:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>International PHP conference in Frankfurt 2007</title>
		<link>http://www.dotvoid.com/2007/11/international-php-conference-in-frankfurt-2007/</link>
		<comments>http://www.dotvoid.com/2007/11/international-php-conference-in-frankfurt-2007/#comments</comments>
		<pubDate>Mon, 05 Nov 2007 10:27:10 +0000</pubDate>
		<dc:creator>Danne</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[conference]]></category>

		<guid isPermaLink="false">http://www.commodi.com/?p=238</guid>
		<description><![CDATA[Yesterday was the first day of the International PHP Conference. I listened to Lars Jankowfsky in his session &#8220;Practising Agile Development&#8221;. Although different methodologies were mentioned it was mainly a one day session on how Extreme programming works. The session had a good mix of fun och seriousness. One of the reasons I wanted to [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday was the first day of the International PHP Conference. I listened to Lars Jankowfsky in his session &#8220;Practising Agile Development&#8221;. Although different methodologies were mentioned it was mainly a one day session on how Extreme programming works. The session had a good mix of fun och seriousness. One of the reasons I wanted to go to Frankfurt this year was the mix between technical and non technical sessions. I have to say that Lars one day session on XP was a very good start. As always me and others that do not use xdebug and unit tests frequently got a lot of well deserved bashing&#8230;</p>
<p>&#8220;<span style="font-style: italic;">Using your brain while developing is really helpful</span>&#8221; &#8211; Lars Jankowfsky. Maybe I should stop the bad habit of lazy coding while watching TV&#8230;</p>
<p>One thing that makes me happy is that they have added a session on Zend Framework. I look forward to that as I have begun to rely on Zend Framework quite a lot.</p>
<div id="attachment_239" class="wp-caption aligncenter" style="width: 650px"><img class="size-full wp-image-239" title="IPC 2007 and Ajax In Action" src="http://www.dotvoid.com/wp-content/uploads/2008/09/fs__media_mod_action.jpeg" alt="IPC 2007 and Ajax In Action" width="640" height="480" /><p class="wp-caption-text">IPC 2007 and Ajax In Action</p></div>
<div id="attachment_240" class="wp-caption aligncenter" style="width: 650px"><img class="size-full wp-image-240" title="Lars Jankowfsky during his session" src="http://www.dotvoid.com/wp-content/uploads/2008/09/fs__media_mod_action_002.jpeg" alt="Lars Jankowfsky during his session" width="640" height="480" /><p class="wp-caption-text">Lars Jankowfsky during his session</p></div>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://www.dotvoid.com/2007/11/international-php-conference-in-frankfurt-2007/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.dotvoid.com/2007/11/international-php-conference-in-frankfurt-2007/&amp;title=International+PHP+conference+in+Frankfurt+2007" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.dotvoid.com/2007/11/international-php-conference-in-frankfurt-2007/&amp;t=International+PHP+conference+in+Frankfurt+2007" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.dotvoid.com/2007/11/international-php-conference-in-frankfurt-2007/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.dotvoid.com/2007/11/international-php-conference-in-frankfurt-2007/&amp;title=International+PHP+conference+in+Frankfurt+2007&amp;summary=Yesterday%20was%20the%20first%20day%20of%20the%20International%20PHP%20Conference.%20I%20listened%20to%20Lars%20Jankowfsky%20in%20his%20session%20%22Practising%20Agile%20Development%22.%20Although%20different%20methodologies%20were%20mentioned%20it%20was%20mainly%20a%20one%20day%20session%20on%20how%20Extreme%20programming%20works.%20The%20session%20had%20a%20good%20mix%20of%20fun%20och%20seriou&amp;source=dotvoid.com" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-plaxo">
			<a href="http://www.plaxo.com/?share_link=http://www.dotvoid.com/2007/11/international-php-conference-in-frankfurt-2007/" rel="nofollow" class="external" title="Share this on Plaxo">Share this on Plaxo</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.dotvoid.com/2007/11/international-php-conference-in-frankfurt-2007/&amp;title=International+PHP+conference+in+Frankfurt+2007" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=International+PHP+conference+in+Frankfurt+2007+-+http://b2l.me/wvtxz&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.dotvoid.com/2007/11/international-php-conference-in-frankfurt-2007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silly web 2.0 application</title>
		<link>http://www.dotvoid.com/2005/11/silly-web-20-application/</link>
		<comments>http://www.dotvoid.com/2005/11/silly-web-20-application/#comments</comments>
		<pubDate>Tue, 22 Nov 2005 16:13:25 +0000</pubDate>
		<dc:creator>Danne</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[wysiwyg]]></category>

		<guid isPermaLink="false">http://www.commodi.com/?p=165</guid>
		<description><![CDATA[Sometimes people climb mountains because it&#8217;s cool. I can understand that.
Now ajax and web 2.0 is cool. So this ajax whois service wants to be web 2.0. In order to be web 2.0 it must be simple and things must be fetched asynchronously. The service is also using the captha technique &#8211; ajaxified. A service [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes people climb mountains because it&#8217;s cool. I can understand that.</p>
<p>Now ajax and web 2.0 is cool. So this <a href="http://www.ajaxwhois.com/">ajax whois service</a> wants to be web 2.0. In order to be web 2.0 it must be simple and things must be fetched asynchronously. The service is also using the captha technique &#8211; ajaxified. A service as basic as this, with only a search field, should allow the user to click &#8220;search&#8221; or &#8220;go&#8221; or whatever. Oh no. That&#8217;s not cool. Instead you have to wait for the forms to decide that you are finished typing. So stupid. If you are too slow with the captha form it is submitted anyway and then you have to start over again as the input field is cleared.</p>
<p>Just because something can be done doesn&#8217;t necessarily mean it is a good idea.</p>
<p>As a side note my wysiwyg editor, <a href="http://www.mesh.se/products.php">FireEditor</a>, is coming along nicely. It&#8217;ll soon be ready for a first release. As soon as the extension api is stable. It&#8217;ll be copyrighted to my <a href="http://www.mesh.se/">Swedish company Mesh</a> but under a free/gratis license.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://www.dotvoid.com/2005/11/silly-web-20-application/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.dotvoid.com/2005/11/silly-web-20-application/&amp;title=Silly+web+2.0+application" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.dotvoid.com/2005/11/silly-web-20-application/&amp;t=Silly+web+2.0+application" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.dotvoid.com/2005/11/silly-web-20-application/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.dotvoid.com/2005/11/silly-web-20-application/&amp;title=Silly+web+2.0+application&amp;summary=Sometimes%20people%20climb%20mountains%20because%20it%27s%20cool.%20I%20can%20understand%20that.%0D%0A%0D%0ANow%20ajax%20and%20web%202.0%20is%20cool.%20So%20this%20ajax%20whois%20service%20wants%20to%20be%20web%202.0.%20In%20order%20to%20be%20web%202.0%20it%20must%20be%20simple%20and%20things%20must%20be%20fetched%20asynchronously.%20The%20service%20is%20also%20using%20the%20captha%20technique%20-%20ajaxified.%20&amp;source=dotvoid.com" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-plaxo">
			<a href="http://www.plaxo.com/?share_link=http://www.dotvoid.com/2005/11/silly-web-20-application/" rel="nofollow" class="external" title="Share this on Plaxo">Share this on Plaxo</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.dotvoid.com/2005/11/silly-web-20-application/&amp;title=Silly+web+2.0+application" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Silly+web+2.0+application+-+http://b2l.me/wwzsd&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.dotvoid.com/2005/11/silly-web-20-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Announcing Toxic &#8211; an Ajax toolkit</title>
		<link>http://www.dotvoid.com/2005/05/announcing-toxic-an-ajax-toolkit/</link>
		<comments>http://www.dotvoid.com/2005/05/announcing-toxic-an-ajax-toolkit/#comments</comments>
		<pubDate>Tue, 24 May 2005 17:20:37 +0000</pubDate>
		<dc:creator>Danne</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ajax]]></category>

		<guid isPermaLink="false">http://www.commodi.com/?p=132</guid>
		<description><![CDATA[
The project is no longer available. Might be so in the future.
Recently I have been working hard on my SRSS (whatever) project. The result is nearly finished and has been dubbed Toxic.
Toxic is an AJAX toolkit, or framework, for creating rich web applications. It handles the tedious and repetetive tasks involved in integrating a client [...]]]></description>
			<content:encoded><![CDATA[<div class="preamble">
<p><em>The project is no longer available. Might be so in the future.</em></p>
<p>Recently I have been working hard on my SRSS (whatever) project. The result is nearly finished and has been dubbed Toxic.</p>
<p>Toxic is an AJAX toolkit, or framework, for creating rich web applications. It handles the tedious and repetetive tasks involved in integrating a client created using html and javascript with a server backend. It enables client side javascript to directly call class methods in PHP5 (or any other suitable language). It also enables the server side PHP to directly call client side javascript functions. Using Toxic you can get rid of much of the tedious work in form intensive rich web applications.</p>
<p>UPDATE: Toxic has been release here (<em>Project is dead and gone</em>).</div>
<div class="itemview">
<h3>Overview</h3>
<p>Toxic is an AJAX toolkit, or framework, for creating rich web applications. It handles the tedious and repetetive tasks involved in integrating a client created using html and javascript with a server backend. Currently there is only a PHP5 backend available. It should be fairly straightforward to add backends in other languages.</p>
<p>Toxic handles the communication that takes place between the client and server. It can also be used to automate validation and sending of form fields in an application.</p>
<p>One difference between Toxic and other frameworks is that you do not need to generate code in any way.</p>
<p>Toxic can:</p>
<ul>
<li>Directly call methods in PHP classes from javascript.</li>
<li>Bind form fields to method calls with automatic validation.</li>
<li>Create callbacks that directly call javascript functions from the backend.</li>
<li>Automatically transform javascript variables to PHP parameters.</li>
<li>Send any javascript variable or object with associated keys.</li>
<li>Automatically transform PHP exceptions into javascript exceptions.</li>
</ul>
<h3>Synchronous/asynchronous</h3>
<p>The default mode for Toxic is synchronous. In this mode any exceptions on the server side will be automatically translated into a javascript exception.</p>
<p>If you want a call to be asynchronous you only need to bind a callback to a method call. All further calls to that specific method will be done asynchronously. When calls are made asynchronous a default timeout is used. This can be changed by a public property in the RemoteObject class.</p>
<h3>Multiple requests</h3>
<p>It is possible to have one RemoteObject that process several asynchronous calls concurrently. Using this excessively is not tested and probably not a good idea.</p>
<h3>Hard v soft callbacks</h3>
<p>Toxic let you create callbacks in two different modes. Hard callbacks are used by default and are also the simplest. A hard callback gives you the ability to create a javascript function with your own parameters. This javascript function is then called directly from the server side without any fuzz.</p>
<p>A soft callback gives you more control in that your javascript function only receive one parameter, the RemoteResult object. This gives you access to all the data received as well as the native request object with all the HTTP headers.</p>
<h3>Serialization</h3>
<p>All data transferred between client and server is serialized in a slimlined XML format. Before any server side code parses the data the XML is validated against a DTD to enforce the correct format. The format is inspired by <a href="http://jpspan.sourceforge.net/">JPSpan</a>.</p>
<pre>&lt;!ELEMENT class (a*|i*|d*|b*|n*|s*|u*)*&gt;
&lt;!ATTLIST class name CDATA #REQUIRED
                method CDATA #IMPLIED
                error CDATA #IMPLIED&gt;
&lt;!ELEMENT a (a*|i*|d*|b*|n*|s*|u*)*&gt;
&lt;!ATTLIST a id ID #IMPLIED
            k CDATA #IMPLIED&gt;
&lt;!ELEMENT i EMPTY&gt;
&lt;!ATTLIST i id ID #IMPLIED
            k CDATA #IMPLIED
            v CDATA #REQUIRED&gt;
&lt;!ELEMENT d EMPTY&gt;
&lt;!ATTLIST d id ID #IMPLIED
            k CDATA #IMPLIED
            v CDATA #REQUIRED&gt;
&lt;!ELEMENT b EMPTY&gt;
&lt;!ATTLIST b id ID #IMPLIED
            k CDATA #IMPLIED
            v CDATA #REQUIRED&gt;
&lt;!ELEMENT n EMPTY&gt;
&lt;!ATTLIST n id ID #IMPLIED
            k CDATA #IMPLIED&gt;
&lt;!ELEMENT s (#PCDATA)&gt;
&lt;!ATTLIST s id ID #IMPLIED
            k CDATA #IMPLIED&gt;
&lt;!ELEMENT u (#PCDATA)&gt;
&lt;!ATTLIST u id ID #IMPLIED
            k CDATA #IMPLIED&gt;</pre>
<h3>Validation &amp; sanitizing</h3>
<p>Using Toxic does make things easier on the server side. You don&#8217;t have to deal with all the $_POST/$_GET variables. The XML serialization format is enforced by a DTD.</p>
<p>Still Toxic does not free the receiving method of the task to properly validate and sanitize incoming parameter values.</p>
<h3>GET, POST and rfc 2616</h3>
<p>What about <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html">rfc 2616</a> and HTTP status then? It is said that the GET method should never result in data being altered. Toxic use the POST method only. This could be called cheating but hey <img src='http://www.dotvoid.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . <a href="http://www.dotvoid.com/view.php?id=38">Read more on this topic&#8230;</a></div>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://www.dotvoid.com/2005/05/announcing-toxic-an-ajax-toolkit/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.dotvoid.com/2005/05/announcing-toxic-an-ajax-toolkit/&amp;title=Announcing+Toxic+-+an+Ajax+toolkit" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.dotvoid.com/2005/05/announcing-toxic-an-ajax-toolkit/&amp;t=Announcing+Toxic+-+an+Ajax+toolkit" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.dotvoid.com/2005/05/announcing-toxic-an-ajax-toolkit/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.dotvoid.com/2005/05/announcing-toxic-an-ajax-toolkit/&amp;title=Announcing+Toxic+-+an+Ajax+toolkit&amp;summary=%0D%0A%0D%0AThe%20project%20is%20no%20longer%20available.%20Might%20be%20so%20in%20the%20future.%0D%0A%0D%0ARecently%20I%20have%20been%20working%20hard%20on%20my%20SRSS%20%28whatever%29%20project.%20The%20result%20is%20nearly%20finished%20and%20has%20been%20dubbed%20Toxic.%0D%0A%0D%0AToxic%20is%20an%20AJAX%20toolkit%2C%20or%20framework%2C%20for%20creating%20rich%20web%20applications.%20It%20handles%20the%20tedious%20and%20re&amp;source=dotvoid.com" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-plaxo">
			<a href="http://www.plaxo.com/?share_link=http://www.dotvoid.com/2005/05/announcing-toxic-an-ajax-toolkit/" rel="nofollow" class="external" title="Share this on Plaxo">Share this on Plaxo</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.dotvoid.com/2005/05/announcing-toxic-an-ajax-toolkit/&amp;title=Announcing+Toxic+-+an+Ajax+toolkit" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Announcing+Toxic+-+an+Ajax+toolkit+-+http://b2l.me/wwfkc&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.dotvoid.com/2005/05/announcing-toxic-an-ajax-toolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote Scripting (AJAX) framework</title>
		<link>http://www.dotvoid.com/2005/03/remote-scripting-ajax-framework/</link>
		<comments>http://www.dotvoid.com/2005/03/remote-scripting-ajax-framework/#comments</comments>
		<pubDate>Wed, 30 Mar 2005 15:15:28 +0000</pubDate>
		<dc:creator>Danne</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[remote scripting]]></category>

		<guid isPermaLink="false">http://www.commodi.com/?p=45</guid>
		<description><![CDATA[
Spare time to spend on interesting projects is not plentiful nowadays. Even so I have managed to put quite a few hours into a small web application framework. My goal is to make it easier to develop web applications that heavily depend on client server communication. I really want to get rid of the painfully [...]]]></description>
			<content:encoded><![CDATA[<div class="preamble">
<p>Spare time to spend on interesting projects is not plentiful nowadays. Even so I have managed to put quite a few hours into a small web application framework. My goal is to make it easier to develop web applications that heavily depend on client server communication. I really want to get rid of the painfully boring and repetetive task of validating form data and sending it to a backend in PHP where the data has to be validated again. The framework is based on XMLHttpRequest for the communication between the client and the server. This kind of communication is commonly known as Remote Scripting. Some people (not me) likes to use the new, more catchy, acronym AJAX. Anyway, this is a sneak peak on how the framework will be used.</p></div>
<h3>Introduction</h3>
<p>First I had a look at JPSpan and other similar implementations. Impressive as JPSpan is, I thought it a bit too much for me. I don&#8217;t need, or want, transparancy between javascript and PHP classes. To be honest, I really don&#8217;t like hiding the communication between client and server as it mostly creates problems. Pretending that the network isn&#8217;t there usually gives birth to architectures with a huge amount of method calls over the network. It is better to work with data on the client side, validate it and then send it to the server for the real work. However I did like the serialization into a streamlined XML format and thus I have adapted that in my solution.</p>
<p>The framework which has the wonderfully dry working name of SSRS is getting more and more complicated. I started working on a simple synchronous http communication between javascript and PHP. Now I am ending up with a framework for binding form fields to method calls with automatic validation of data. Still I think it is going to be really useful when production ready.</p>
<h3>The HTML form</h3>
<p>What is it then and what you do you do with it you ask? To show it off a bit I&#8217;ll give you a simple example. The below form is an extremely simple user form. It features a readonly field for the unique user id which of course will be empty when we create new users. When I use this form to create a new user I don&#8217;t want the page to reload. It is unecessary slow. But I still want the User_id field populated when the user has been saved.</p>
<pre>&lt;form id="User" onsubmit="return saveUser();"&gt;
&lt;fieldset&gt;
    &lt;legend&gt;User details&lt;/legend&gt;

    &lt;label id="lbl_User_id"&gt;Userid&lt;/label&gt;
    &lt;input type="text" readonly="1" id="User_id" /&gt;

    &lt;label id="lbl_User_login"&gt;User login&lt;/label&gt;
    &lt;input type="text" id="User_login" /&gt;

    &lt;label id="lbl_User_email"&gt;Email&lt;/label&gt;
    &lt;input type="text" id="User_email" /&gt;
    &lt;a href="#" onclick="return saveUser();"&gt;Save&lt;/a&gt;
&lt;/fieldset&gt;
&lt;/form&gt;</pre>
<p>I have added an onsubmit handler and a link that both call the javascript function saveUser(). I could just as well have used a normal submit button.</p>
<h3>The PHP class</h3>
<p>To handle users I have created a User class implemented in PHP. The class have a save() method that takes id, login and email as parameters. The id is not mandatory. To be able to return more data than just a value, result data is always returned as key value pairs in an array. When errors or problems are encountered exceptions are thrown which automatically will be passed to the client as javascript exceptions.</p>
<pre>class User
{
  public function save($id, $login, $email)
  {
    if ($id == null || $id == 0)
      {
        error_log("Creating new user");
        // Validate data
        // Save user
        // Retrieve the new numerical user id in $id
        $id = 1; // For the example
        return Array('id' =&gt; $id);
      }
    throw new Exception("Updating a user is not implemented");
  }
}</pre>
<h3>Tying them together</h3>
<p>So what do I as a developer need to do to connect these two loose ends? Before we create the saveUser() function mentioned above we need to setup the form against SSRS. A few lines of javascript in an onload handler or an explicitly called init function is needed.</p>
<pre>var g_user = null;
var frm = null;

frm = new Array(
	new Array('User_id', 'number', '', '', false, '', ''),
	new Array('User_login', 'string', 'A unique login',
		'Login not valid or not unique', true, 4, 8, ''),
	new Array('User_email', 'email', 'Email address is required',
		'Email is not valid', true));

g_user = new RemoteObject('postHandler.php', 'User');
g_user.bindFields(frm);
g_user.bindParams('save', 'User_id', 'User_login', 'User_email');</pre>
<p>What the above essentially does is:</p>
<ol>
<li>Create the client object and tell it what server class to use and which URI to communicate with. The postHandler.php is the backend implementation.</li>
<li>Create a structure that describes field data types, help and error messages, max/min length, etc.</li>
<li>Bind the form to the client object and bind form fields as parameters to method calls.</li>
</ol>
<p>The framework can handle strings, numbers, decimals, emails, string lists and more. For each datatype it is possible to set various constraints. For some datatypes it is also possible to specify your own regular expression to use as validation.</p>
<p>When this is done we can create the actual saveUser() function.</p>
<pre>function saveUser()
{
  var result;
  try
    {
      result = g_user.execute('save');
      document.getElementById('User_id').value = result.item(0);
    }
  catch(ex)
    {
      alert(ex.message);
    }
  return false;
}</pre>
<p>That is all. As we have bound the form to the g_user object all the fields are validated prior to being sent to the server. The error messages specified for the fields above will be displayed if needed. Any exception on the server side will also be displayed in the same way. As the fields User_id, User_login and User_email are bound to the save method they will automatically be handed over the PHP method save() in the User class.</p>
<h3>Conclusion</h3>
<p>The data being sent between client and server is encoded in a simple streamlined XML format and is always validated against a DTD to ensure the data is encoded correctly. This does not mean that you don&#8217;t need to check the data on the server side but it does add an extra layer of data security. It is also a lot simpler to validate the parameters in a method, where it should be done, than filtering $_GET or $_POST arrays before calling PHP functions or methods.</p>
<p>The benefits of using a framework like this is that it lets the developer concentrate on the functionality. Another benefit is that it does not interfere with your choice of template engine. I have a few things left to iron out before I release the code.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://www.dotvoid.com/2005/03/remote-scripting-ajax-framework/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.dotvoid.com/2005/03/remote-scripting-ajax-framework/&amp;title=Remote+Scripting+%28AJAX%29+framework" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.dotvoid.com/2005/03/remote-scripting-ajax-framework/&amp;t=Remote+Scripting+%28AJAX%29+framework" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.dotvoid.com/2005/03/remote-scripting-ajax-framework/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.dotvoid.com/2005/03/remote-scripting-ajax-framework/&amp;title=Remote+Scripting+%28AJAX%29+framework&amp;summary=%0D%0A%0D%0ASpare%20time%20to%20spend%20on%20interesting%20projects%20is%20not%20plentiful%20nowadays.%20Even%20so%20I%20have%20managed%20to%20put%20quite%20a%20few%20hours%20into%20a%20small%20web%20application%20framework.%20My%20goal%20is%20to%20make%20it%20easier%20to%20develop%20web%20applications%20that%20heavily%20depend%20on%20client%20server%20communication.%20I%20really%20want%20to%20get%20rid%20of%20&amp;source=dotvoid.com" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-plaxo">
			<a href="http://www.plaxo.com/?share_link=http://www.dotvoid.com/2005/03/remote-scripting-ajax-framework/" rel="nofollow" class="external" title="Share this on Plaxo">Share this on Plaxo</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.dotvoid.com/2005/03/remote-scripting-ajax-framework/&amp;title=Remote+Scripting+%28AJAX%29+framework" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Remote+Scripting+%28AJAX%29+framework+-+http://b2l.me/wy3cx&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.dotvoid.com/2005/03/remote-scripting-ajax-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

