Jquery for dropdown and dynamic file upload

Hey everyone,

I began to use Yii to develop my project. It’s fairly easy and simple to use. However, I have some uncertainty on how to start on AJAX and javascript. Feel free to answer any of my questions.

Q1. How can I integrate 3rd party JS (i.e. Google Closure/Prototype) and where should I put my files?

Q2. Assuming, I want to use the Jquery on Yii, how can I create a dropdown for "Others" option. In other words, when the user select "Others", a textbox will appear on the side. Just wondering if there is any example of JS that I can learn on how to integrate with Yii.

Q3. Anyone know any example of how I can do dynamic upload of photos?

Thanks in advance.

Cheers,

Mickey

I’m using the EUploadify (http://www.yiiframework.com/extension/euploadify/) and Image (http://www.yiiframework.com/extension/image/) extensions for this purpose. They’ve worked really well together for me so far.

I’m also using the CFile extension (http://www.yiiframework.com/extension/cfile/) to simplify the file handling portions.

Together, I think it’s a pretty unstoppable combination ;)

Do you have a sample how it can be setup properly? At the moment, my JS script uploaded but I can’t seems to see that the AJAX call is being made from my FireBug. Is there any way I can print out the $files var in the actionUploadedFiles() ?

If your using Jquery Ajax function then you can add the success and error attributes to the call to see if that fails it will load those functions and you can either alert or dump the returned values. Another possible way of knowing what’s wrong is by logging the data at some point of the script. Those of course can be used if the Firebug does not log the ajax call.

I guess you know FirePHP?

http://www.firephp.org/

with this you can do output log information into the firebug extension, also form ajax called functions.

http://www.yiiframework.com/doc/api/CMultiFileUpload