cakephp

save dynamically created form fields between page requests

I have a form in which the user can dynamically add/remove name/value pairs of fields eg: inventory list: [description text input field] [quantity text input field] [remove item button] [add item button] so basically the user can add more inventory items: inventory list: [description text input field] [quantity text input field] ...

Real-world testing of CakePHP controllers?

I'm writing a new application with CakePHP (just-released 1.2.4), using SimpleTest 1.0.1. I have read the relevant sections of the Cookbook, searched on the Bakery, and read Mark Story's postings on controller testing (the hard way and with mocks). Unfortunately, none of this talks about real-world testing of non-trivial controllers. Lo...

File upload problem with cakePHP

Hi all! I'm trying to upload a file with cakePHP. This is the view: echo $form->create(null, array('action' => 'upload', 'type' => 'file')); echo $form->file('img'); echo $form->submit('Enviar Imagem'); echo $form->end(); And this is the error I'm getting: Warning (2): Invalid argument supplied for foreach() [CORE/cake/dispatcher....

Problem while replacing the scaffolding layout in Cake PHP

I made a blog database and created some tables in it. I have wriTten the related models and controller files for CakePHP. Also, I have been successful in adding a test user to the blog database using Cake's scaffolding feature. So far so good. However, I am facing problems when getting into the Views part of Cake PHP. I created a...

Have a problem with redirecting a site ot another Subdomain in Cake PHP

I Have done a site but want to redirect it to another subdomain in other language.The site is done in CAKE PHP,so the problem i am facing is I have given the href to subdomain.But the URL is concatenated with the variable 'url' set in the config.php file of Cake Php.That's the reason why it's throwing error. Please suggest me how can I d...

Is there a default controller for the index page for a CakePHP installation?

Hi. I have just successfully installed CakePHP and I see that I can edit the home.ctp view but is there a default controller for the index page? To change the content of this page, create: APP/views/pages/home.ctp. To change its layout, create: APP/views/layouts/default.ctp. You can also add some CSS styles for your pages at: APP/web...

CakePHP - Problems with ErrorHandler not extending AppController

I had been wondering why my error page caused certain pages of my site not to render, but then I realized that it's because AppError extends ErrorHandler instead of AppController. This caused some variables that I set in AppController's beforeFilter method not to be sent to the view. Since I can't access session variables from AppError...

Is using Controller::render() in a Model::afterSave() possible with CakePHP?

I've got some sample code that I'd like to refactor as I need it to work after a record is saved. It currently works after the record is first rendered (using the afterFilter). What it does is render the view that I want with the layout and saves it to a file. function afterFilter() { parent::afterFilter(); if($this->params['pas...

Joomla and cakephp

I have a joomla instance and a cakephp instance in my site. what i want is tht to have a single login form for both joomla adn cake instance.is it possilbe?? is ther any plugins for tht?? ...

emailing url with uid

I have a 2-step form. The second step is quite lengthly and the visitor may want to complete it at a later time. What I have done is generate a uid with sha1 using a combination of details: firstname, email address, salt and I email the visitor the link eg: http://www.mysite.com/form/step2/[sha1 uid] so when they click the links they c...

Sessions in Cakephp

Hi, I am having a doubt in my application. In my application i m designing like a Form builder using CakePHP and JQUery and MYSQL. In my design page, i am designing the Form and on clicking the Save Form button below all my fields i have created, i am saving the Fields by first creating an entry in my Form Table which has(id, name,crea...

POST and Get in the same Ajax request

I am using a ajax post in my application like $.ajax({ type: "POST", url: "http://localhost/FormBuilder/index.php/forms/saveForm/"+user_id, data: "formname="+formname+"&status="+status, success: function(msg){ // alert( "Data Saved: " + msg); }//success });//ajax In the above ajax post i am saving the Form with the user...

Ajax post not returning value from cakephp controller

Hi, $.ajax({ type: "POST", url: "http://localhost/FormBuilder/index.php/forms/saveForm/"+user_id, datatype: 'json', data: "formname="+formname+"&status="+status, success: function(json){ alert( "id is : " + json.forms[0].id); }//success });//ajax The above code doesn't alerts me the id. why so.... My ...

trying to learn the syntax and structure of cakephp

I'm trying to write a cakephp app. I need to validate input based on availability. an example would be if someone is trying to take out a book from a library. I would reference the book to see if it's currently out, and if it is report that to the user. another example would be trying to book rooms at a hotel, the user would enter a dat...

new to mvc, dividing code question

I'm brand new to the MVC coding style and i'm having trouble deciding if i placed my code in the right place. I have a list of rates for an item, the rates have various time frames. what i want to do is display the highest rate per item for the current day. so say if item 1 has 3 rates, and 2 of them overlap today, it will choose the hig...

How to pass an array as a hidden field?

I am implementing an auto complete box using the Ajax.autocompleter method of the scriptaculous.js framework. This is the auto complete box and the div where the auto suggested entries are populated. <?php echo $form->create('Share', array('url' => '/forms/share')); ?> <label for="shareWith">Share Form with</label> <input type=...

cakephp remove "NULL" and "0" before/during saveAll

I have a form with a whole lot of "inventory" items, my data looks like this: $this->data['Inventory'][#]['description'] $this->data['Inventory'][#]['quantity'] $this->data['Inventory'][#]['category_id'] the thing is I don't know how to unset $this->data['Inventory'][#] if the quatity is either 0 or NULL. I can do this easily with a s...

Use of variable in the Ajax post

In my application I am using Ajax post like: $('#fb_contentarea_col3 #fb_contentarea_col1down2 #saveForm').live("click", function() { if (!$("#formName").val() == "") { if (saveDraft == 'on') status = "Incompleted"; else status = "Completed"; var formname = $("#formName").val(); $.ajax({ type: "POST"...

CakePHP form helper - HABTM multiple checkbox styling

I have two tables restaurants n cuisines which are related to each other as HATBM table cusinies have certain fixed entries - 54 number i restarurant can hve any number of cuisines. on baking the application this came with a multiple select. since i wanted check boxes i used array( 'type' => 'select', 'multiple' => 'checkbox') to conve...

Zend Framework career path tricks

I am a seasoned PHP developer (writing custom apps, templates, CMS, js), but only recently I dived into the world of frameworks like Zend Framework or Cake PHP. The trick is that I am working from home, which means Joomla or Drupal job is easy to find, even if you're a newbie. Which doesn't seem to be the case with ZF, per my initial mar...