[TYPO3-ect] AJAX: serverside logic vs. clientside logic
R. van Twisk
typo3 at rvt.dds.nl
Fri Sep 15 05:36:23 CEST 2006
Elmar Hinz wrote:
> Hello,
>
> I fear I need to reopen the discussion about AJAX libraries, because
> some thoughts came into my mind, that I think are very important.
>
Don't fear... we are more than happy to have long threads about any
subject :)
> With xajax and prototype we compare two representatives of a lot of ajax
> libraries that follow two completly different philosophies.
>
Yes they do... But there purpose is also totally different....
You can do things with xajax you can't with prototype, and the other way
around.
> The xajax type does all logic on the server side with PHP.
> The prototype type does the logic on the client side with JS.
>
> Please correct my if I am wrong, I have no own experiences with prototype.
>
>
> 1.) What happens if JavaScript is turned off?
>
> The xajax type will do it's regular, full work as a traditional webpage,
> because the logic is on the servers side.
>
> The prototyp type will fully break and becomes unusable.
>
There are different philosophies on using JS at all. Some peopel want
website with cool JS,
but with the requirement that the webesite should function even though
JS is turned off.
Take typo3 for example, the be MUST have cookies and JS on, otherwise it
will break.
I also do think that xajax can break at some point. Take for example the
little whiteboard
or calculation example. The will NOT function when typoscript is off.
Also remember, xajax is mostly a ajax library, prototype is not, it just
contains a couple of ajax
helper functions.
>
> 2.) Form validation:
>
> We agree that we need form validation within the browser (AJAX) for the
> users comfort but also after submission of forms on the servers side for
> reasons of security. How many times do we need to program validation now?
>
> With the xajax type we need to program validation once, because the
> validation within the browser uses the PHP logic on the servers side.
>
> With the prototype type we need to program validation twice, once on the
> client side, once on the server side. The work doubles.
>
I don't see what your point is here....
Prototype is not a library that will do form validation, it can help GET
values from elements,
it can help to to get ALL form values and send it through ajax to a
server for server side validation.
Please don't compare xajax and prototype like this, they need to life
ALONG side of each other,
they are NOT replacements for each other.
>
> 3.) Accessibility:
>
> Some Screenreaders don't support javascript at all. Other screenreaders
> only support JS if it is specially used. DOM alterations are only
> allowed to happen behind the point of execution, because screenreaders
> read xhtml in a linear way.
>
> It is hard to program JS in this special way, that it is usable for
> screenreaders. It is easy to program a website in a way, that it works
> when JS is turned off.
>
> If we want to reach, that we can turn of JS for accessibility, we have
> no additional work with the xajax type.
>
> With the prototype type, we have to programm all the logic a second time
> with PHP on the servers side. Again the work doubles to gain
> accessibility with the prototype type.
>
I don't think you understand the prototype library well....
Also xajax will break a accessible site when you use ajax calls to get
additional data from the server.
I doubt that any screen reader will understand that as well.
Also I have seen that xajax user innerHTML which is depriciated.
>
> Conclusions:
> ============
>
> 1.) The logic should stay on the servers side whereever possible, which
> means that the xajax type should be the preferred type of AJAX for the
> overall usage.
>
YES logic needs to stay on server,
But this can be done both with prototype and xajax.
> 2.) There are very rare cases where clientside AJAX can enable some
> additional features. But this features can only be nice little addons.
> The pages fundamental functionality should never depend on clientside
> AJAX logic.
>
ofcourse!!! But that has nothing to do with using any library, xajax,
google libs, yahoo libs etc etc etc
That depends on teh designer of the website (if we talk about FE
websites) this has nothing to do
with any library. That is just up to the implementation of the website.
>
> The discussion is open again.
>
Thanks!! I will make popcorn... and get some beer and sink in my
relaxing chair....
Again,
prototype and xajax need to live NEXT to each other there are NOT
replacements.
Listen I did this:
I turned off javascript and tried this example :
http://www.xajaxproject.org/examples/multiply/multiply.php
Guess what, it didn't work....
I turned off javascript and tried these examples :
http://wiki.script.aculo.us/
Guess what, it didn't work....
Bottom line is you NEED javascript enabled on the client to function
properly,
a website NEEDS to be accessible without JS, no matter what library you use.
As a personal Note: xajax build the HTML server site and I have seen
some examples
it uses innerHTML which is depreciated by w3c. I have also seen some
examples
that build the HTML server site and pushes that as text inside of a
other tag (http://www.xajaxproject.org/examples/thewall/thewall.server).
This method is not allowed according to DOM specification. Using builder
would be a nicer method I think (to follow DOM).
Your point the last time that xajax doesn't take much JS, however when I
look at the graphity wall,
then I see lot of PHP introduced. So where prototype does things client
site, xajax has the same work server side.
xajax can't fade elements nicely, iterate over arrays, get values from
drop-down boxes etc etc etc,
something prototype can. But prototype CANNOT build your php code to
communicate with the server.
It is NOT a ajax framework, it's just a set of JS helper functions.
We just can't seem to convince you that prototype and xajax needs to
live along side each other,
not fight against each other. Really, there is a place for prototype
According to there sites, what is...
xajax: The easiest way to develop asynchronous /*Ajax*/ applications
with PHP
prototype: Prototype is a JavaScript framework that aims to ease
development of dynamic web applications.
You see, they really both do different things....
kind regards,
Ries
(with popcorn, beer and a relaxed chair waiting for a response)
>
> Regards
>
> Elmar
>
>
>
>
More information about the TYPO3-team-extension-coordination
mailing list