cakephp

at least one field must be filled, cakephp validation

I have 4 optional fields, but at least 1 field (any field) must be filled? any easy way to do this? ...

CakePHP edit multiple records at once

I have a HABTM relationship between two tables: items and locations, using the table items_locations to join them. items_locations also stores a bit more information. Here's the schema items_locations(id, location_id, item_id, quantity) I'm trying to build a page which shows all the items in one location and lets the user, through a ...

model access from layout file in CakePHP

I am working on a CMS using CakePHP and I want to create a dynamic menu which is the same on all the pages the user can access. So I figured out to create in the layout (since it shared among so many pages and view) but I don't seem to know how to acces the model and get the data from the database to construct the menu. any help is appre...

CakePHP joining Models between two tables, twice

I have a question about how to set up the relations between two models when they join to each other in two different regards. I'll give an example of the problem I've got: Users (id, name) Messages (id, message, from_user_id, to_user_id) (In my case, it's not users nor messages, but this hopefully illustrates the problem in a simpler...

$form->input to create a radio button using CakePHP

I am using jQuery and CakePHP for my application. In my application with the data that I have saved in the database, for example if the Field type column is text then I am generating a text box in my code using $form->input(); If it is a dropdown box, I am generating it using: echo $form->input($r['Attribute']['label'], array('id'...

Form helper for creating Radio button in Cakephp

hi, i am trying to create a Radio button using Cakephp like the one the result should resemble like <div data-attr="radio" id="1"> <label id="label1">Untitled1</label><br/> <input type="radio" value="option1" id="Radio11" name="Workexperience"/> <label for="Radio11">Option1</label> <inp...

CakePHP saveAll- Updating a row in mysql instead of saving as a new row

Hi, I'm trying to duplicate a particular entry in the form. I get all the column values by their form id, and trying to save it as a new row using saveAll. But instead of creating a new row, it is updating the existing entry. Here is my code: function duplicateForm($data) { $this->data['Form']['id']=$data['Form']['id']; ...

Set the options for the Field of Type Radio button in Form Helper in Cakephp

Hi, I am using a Form helper in CakePHP. like echo $form->input('field', array( 'type' => 'radio','legend'=>$r['Attribute']['label'], // 'after' => '--after--', // 'between' => '--between---', 'separator' => '--separator--', 'options' => array('1', '2') )); which generates me as <div class="input radio"> <fie...

Fix the options in Cakephp Form FIeld of type radio button

Hi, i am having Cakephp code like <?php foreach ($viewfields as $r): if($r['Attribute']['type']=='radio') { ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($){ $("#"+<?=$r['Attribute']['id'];?>).each(function() { type= "<?=$r['Attribute']...

querying inside $form->input() array

Hi, echo $form->input('field', array( 'type' => 'radio','legend'=>$r['Attribute']['label'], 'separator' => '--separator--', 'options' => array() )); How to query inside options to retrieve the options from the database for this corresponding Field.. like sending its attribute_id by $r['Attribute']['i...

cakephp acl aros_acos paradox

Hello, I'm trying to implement an authentication/authorization combo into my cakePHP site using Auth and Acl Components, but something odd is happening with my implementation. I've got the right acos, aros and aros_acos tables, and they seem to work at some level. I have mapped my actions like this: $this->Auth->mapActions(array('rea...

Alternative authentication sources in CakePHP (LDAP)

I'm working on a CakePHP project and am currently building the user authentication part of it. The problem is that my authentication information (ie: the passwords) are not stored in my database -- the authentication source is LDAP but my question applies equally to any non-database source. It appears as though Cake only handles passwor...

Using JQuery varaible inside $( php)

Hi , i am having a ajax post like var ht = $.ajax({ type: "GET", url: "http://localhost/FormBuilder/index.php/forms/viewChoices/"+attribute_id, async: false }).responseText; var myObject = eval('(' + ht + ')'); var data = myObject;var j=0; alert(data.choices);//alerts the choices as object $(""+<?php e...

Problem in executing Cron Jobs

i have done a bidding site in Cake PHP.The main problem I am facing is I need to run CRON JOBS on the server.But I dont' know why it is bugging me.I have craeted a controller called 'deamons' and there 4 different actions of it,which I want to run continuously on the server every minute,so that we can run the Autobidder set by each user ...

How to change the format of timestamp in CakePHP?

In my application,I retrieve a timestamp from the table which is of the format 2009-08-18 12:09:01. I need to change this to August 18th,2009 or 18 Aug,2009. How to achieve this in CakePHP? Are there any built in methods? ...

How can i stop cakephp to stamp execution time of the page?

Duplicate: http://stackoverflow.com/questions/1220855/how-to-remove-cakephps-trailing-timing-benchmark-comment cakephp stamps execution time as html comment at the bottom of the page, something like <!-- 4.031 s --> How can i stop cakephp to output this?? I need to avoid this print because in some ajax queries (that...

In Cakephp using a helper to set template variables

Is it possible to set a template variable in a helper? Ultimately what I'm trying to do is have a helper add in code to the header of the layout, for use with javascript and such. Ways I can think of that I'd prefer not to use: Passing in the view object: don't want to worry about having to call an extra function using the "global" k...

CakePHP Flash Messages Display Unwanted Number After

When I call $session->flash() in the view, the flash message does get displayed, however it also displays a number, usually 1, afterward it. See the html produced: <div id="authMessage" class="flash flash_error">Passwords do not match</div>1 What is this, why does it now always happen, and how do I get rid of it? ...

How to implement an equipment system in CakePHP

I'm attempting to create a CakePHP based web game mostly for practice as well as for the fun of it, but am running into a conundrum trying to figure out an equipment system. I have an Items table that contains all the possible information about an item, including an item_type field that contains an integer value determining what the ite...

CakePHP validation for dates

In CakePHP, is there a built-in way of validating a date to be within a certain range? For example, check that a certain date is in the future? If the only option is to write my own custom validation function, since it'll be pretty generic and useful to all my controllers, which is the best file to put it in? ...