Building a nearly 100% AJAX app - questions

2009-03-27 Thread logout

Hi, Bakers!

I've been digging in CakePHP over a month (I am new to PHP, SQL, CSS,
JavaScript, AXAJ, and almost whatever Web related programming You may
think of). In case you wander, I've been programming controllers in
pure C (some of you may heared of this ancient language).

So I had to read tons of electronic paper (oh, my poor eyes, and what
was that word 'pillow' standing for?)

But so far, so good. I had a lot of troubles (maybe I'll document them
some day) with making this AJAX thing to work properly and to find
ways to make my app look like and behave as a desktop one.

So I have one BIG question: should I stick with the Prototype library,
or should I invest some more time in mastering the jQuery and use it
instead? Prototype does the job for now, but I hear that jQuery is
simpler and more convenient to use. I must decide quickly, because the
clock is ticking and I have an application to build. The Ajax Helper
is helpful, but I guess not enough, according to some people.

Also, I want to ask if there is a better way to tickle the fields of
a form (i.e. to modify their content/value and properties after an
ajax request) than to return javascript by the view (which script is
thrown away after its evaluation/execution). I still use the MVC
paradigm for the job, but I need to set values and properties
dynamicly in the form, preserving the form's actual view and data
(with the ability to use the embeded validation mechanism, provided by
the model) until final submition.
What I mean is populating a combo with options based on the choice
made in another combo, enableing other fields when it is time for
them to be used, inserting other items in a list and evaluating some
totals to be put in some input fields automatically. And some choices
made should be validated at submission (like checking for empty
fields, for example). Also I don't want to do extra quering the
database and rendering the form over and over at every change, keeping
track of the work done so far (what's the point in doing ajax requests
then?).

So, as we know, putting logic in the view is a bad thing, but how you
execute dynamic scripts, if they are not in the returned content? And
by dynamac I mean script, that will do it's job after the ajax call
and then vanish into oblivion.

Or am I just too confused with this soup of technologies, trying to
consolidate them in the context of Cake... The next month or so my
life will still suck a lot.

P.S. Why there is a word nearly in the caption? Because only the
login form is not ajaxed, and the logged user/admin is redirected to
the main view. Everything else is happening in that main view.

P.S.S. Sorry for the long post...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Building a nearly 100% AJAX app - questions

2009-03-27 Thread mark_story

You're in for a long uphill battle :)  Ajax can get tricky and messy
very quickly as you've found out, and you have to deal with cross
browser issues.  So its not an easy fight by any means.  Both jQuery
and Prototype are good libraries and they offer much of the same
features. Its really a matter of personal choice and what tool you
think is going to work best for you.  The ajax helper is only intended
as way to sprinkle some javascript into your application.  Attempting
to build a large Javascript application with only the helper would be
foolish. If you are feeling lost and without structure, perhaps find
some more dynamic sites and pick apart their source.  Or look into
client side MVC implementations like Jamal or JsMVC.  There are also
extensive ui toolkits for dojo, YUI, and ExtJS which can help a lot as
well.

-Mark

On Mar 27, 11:04 am, logout stefano...@gmail.com wrote:
 Hi, Bakers!

 I've been digging in CakePHP over a month (I am new to PHP, SQL, CSS,
 JavaScript, AXAJ, and almost whatever Web related programming You may
 think of). In case you wander, I've been programming controllers in
 pure C (some of you may heared of this ancient language).

 So I had to read tons of electronic paper (oh, my poor eyes, and what
 was that word 'pillow' standing for?)

 But so far, so good. I had a lot of troubles (maybe I'll document them
 some day) with making this AJAX thing to work properly and to find
 ways to make my app look like and behave as a desktop one.

 So I have one BIG question: should I stick with the Prototype library,
 or should I invest some more time in mastering the jQuery and use it
 instead? Prototype does the job for now, but I hear that jQuery is
 simpler and more convenient to use. I must decide quickly, because the
 clock is ticking and I have an application to build. The Ajax Helper
 is helpful, but I guess not enough, according to some people.

 Also, I want to ask if there is a better way to tickle the fields of
 a form (i.e. to modify their content/value and properties after an
 ajax request) than to return javascript by the view (which script is
 thrown away after its evaluation/execution). I still use the MVC
 paradigm for the job, but I need to set values and properties
 dynamicly in the form, preserving the form's actual view and data
 (with the ability to use the embeded validation mechanism, provided by
 the model) until final submition.
 What I mean is populating a combo with options based on the choice
 made in another combo, enableing other fields when it is time for
 them to be used, inserting other items in a list and evaluating some
 totals to be put in some input fields automatically. And some choices
 made should be validated at submission (like checking for empty
 fields, for example). Also I don't want to do extra quering the
 database and rendering the form over and over at every change, keeping
 track of the work done so far (what's the point in doing ajax requests
 then?).

 So, as we know, putting logic in the view is a bad thing, but how you
 execute dynamic scripts, if they are not in the returned content? And
 by dynamac I mean script, that will do it's job after the ajax call
 and then vanish into oblivion.

 Or am I just too confused with this soup of technologies, trying to
 consolidate them in the context of Cake... The next month or so my
 life will still suck a lot.

 P.S. Why there is a word nearly in the caption? Because only the
 login form is not ajaxed, and the logged user/admin is redirected to
 the main view. Everything else is happening in that main view.

 P.S.S. Sorry for the long post...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---