Re: retrieve related model data

2010-03-26 Thread sebb86
Jeremy Burns Hello again :) Code in the model of my port-table: (the $hasOne association from my origionally question was updated to the association below:) [code] public $hasMany = array( 'Port' = array( 'className' = 'Port', 'foreignKey' = 'uplink_id' ) ); [/code] I

Re: retrieve related model data

2010-03-26 Thread Jeremy Burns
Can you show me your entire $hasMany and $belongsTo declarations, and your find statement? Jeremy Burns jeremybu...@me.com On 26 Mar 2010, at 06:24, sebb86 wrote: Jeremy Burns Hello again :) Code in the model of my port-table: (the $hasOne association from my origionally question was

Re: retrieve related model data

2010-03-26 Thread sebb86
sure! :-) [code of model port] public $belongsTo = array( 'HardwareUnit' = array( 'className' = 'HardwareUnit' ), 'Vlan' = array( 'className' = 'Vlan' ), 'PortEmploymentGroup' = array( 'className' = 'PortEmploymentGroup'

Re: retrieve related model data

2010-03-26 Thread Jeremy Burns
The problem is (I think) that you are creating a self join but calling the joined model 'Port', which is the name of the current model. Try changing to this (I've used ParentPort and ChildPort but you can rename at will): public $belongsTo = array( 'HardwareUnit' = array(

Re: missing HABTM associated models

2010-03-26 Thread WebbedIT
By default a find with recursive will only fetch the data from the model and it's directly associated models. Therefore when running User-find() you will get User and Project but not Library as library has no direct link to User. To include the extra level of associations increase User-recursive

Js helper forms

2010-03-26 Thread Jeremy Burns
Does anyone have an example of how to create an Ajax form from start to end using the Js helper in 1.3? Which components/helpers to include, how to set up the view and the controller, how to get the right layout etc? The information is all out there somewhere, but in bits. I'd love to see a simple

Re: retrieve related model data

2010-03-26 Thread sebb86
Jeremy It works with a little modification :) great!!! The modification is to change ChildPort to ParentPort in the following code: [code] var $paginate = array( 'fields' = array('*'), 'recursive' = 2, 'limit' = 50, 'order' =

Re: Multiple Recordsets in Same View

2010-03-26 Thread Alper K . Tunç
Thank you Jeremy. I'll go through the reference links you provided. I like the philosophy of CakePHP more and more as I explore it. I'll send you a link for my question once I develop the page. Regards, Alper On Mar 26, 7:22 am, Jeremy Burns jeremybu...@me.com wrote: I'd recommend that you read

$html-link Path Problem

2010-03-26 Thread Alper K . Tunç
Hi all, I'm going over the QuickWall example in CakePHP Application Development book by Ahsanul Bari and Anupom Syam. In the example, there is a line where the questions are produced: ?php e($html-link($question['Question']['question'].'?', array('action' = 'show', $question['Question']['id'])));

Re: $html-link Path Problem

2010-03-26 Thread Jeremy Burns
Something looks wrong with your implementation; I'd expect to see http://localhost/quickwall/questions/show/1 (assuming you've set this up in the quickwall folder). It's a personal thing, but I'm not a fan of that book. Some of the code samples are wrong and it doesn't stick to conventions

CakePHP Ajax drop with multiple parameters

2010-03-26 Thread Bailey
Hi all, I've searched the google group and unfortunately cant find any info on this (or anywhere for that matter).. I'm trying to send PHP variables over an ajax dropRemote request but the action thats meant to be recieving the parameters is not picking it up. Basically I am trying to drag

Re: $html-link Path Problem

2010-03-26 Thread Alper K . Tunç
Thank you again Jeremy for the warning. There are not many books available about CakePHP and I borrowed this one from a friend. I guess I'll stick with the online examples. Alper On Fri, Mar 26, 2010 at 12:07 PM, Jeremy Burns jeremybu...@me.com wrote: Something looks wrong with your

Re: $html-link Path Problem

2010-03-26 Thread Alper K . Tunç
Hi Jeremy, What about the Beginning CakePHP: From Novice to Professional book by David Golding? Did you have any chance to review it? Alper On Fri, Mar 26, 2010 at 1:35 PM, Alper K. Tunç alpe...@gmail.com wrote: Thank you again Jeremy for the warning. There are not many books available about

saveAll rolling back my transactions

2010-03-26 Thread Ernesto
Hello. i have 2 models (Item and Order) joined together by a HABTM relationship. since i need some additional fields (quantity) in the join table i splitted the HABTM in 2x hasMany. after that i coded a Order add form wich gives me this data array Array ( [Order] = Array (

Re: form helper ESCAPING quotes character values?? a bug?

2010-03-26 Thread toka...@gmail.com
Hi euromark, I have tried now FALSE as well but it does the same... those quotes still brakes the html.. Thanks Tomas On 25 bře, 13:13, euromark dereurom...@googlemail.com wrote: escape should not be true but FALSE in this case On 25 Mrz., 08:41, toka...@gmail.com toka...@gmail.com wrote:

Re: $html-link Path Problem

2010-03-26 Thread Jeremy Burns
I have found this book to be by far the best. It covers all of the bases and does what it says on the tin. Second place goes to Practical CakePHP Projects. But you're right - CakePHP books are thin on the ground. Jeremy Burns jeremybu...@me.com On 26 Mar 2010, at 11:44, Alper K. Tunç wrote:

Re: cake schema run update gone crazy

2010-03-26 Thread Martin Westin
I'll update the thread with some findings after rooting through the code a bit. Looking at the source I found out that -f does not force 'generate' to create a new schema.. It is used To force generation of all tables into the schema... but not only that. It can also be used to force update to

non-interactive Schema Shell for deployment?

2010-03-26 Thread Martin Westin
I am almost there with the Schema Shell. Now just one thing remains. Being able to do run update -f without answering y or n to the questions. Is there a non-interactive mode for the Schema Shell? I can't see any option to do it. /Martin Check out the new CakePHP Questions site

Re: non-interactive Schema Shell for deployment?

2010-03-26 Thread Martin Westin
Found a shell-based way to automatically answer the question. http://www.unix.com/shell-programming-scripting/30246-how-give-variable-command-shell-script.html On Mar 26, 3:41 pm, Martin Westin martin.westin...@gmail.com wrote: I am almost there with the Schema Shell. Now just one thing

Need AJAX to terminate and reload entire page

2010-03-26 Thread Brenda
I'm using AJAX to update part of a page. On occasion, however, the user may make a change that necessitates reloading the entire page, not just the elements that are used with the AJAX call. If I do a redirect in the controller, it reloads the entire page into the ajax element. Is there a way in

Re: Need AJAX to terminate and reload entire page

2010-03-26 Thread Pablo Viojo
There's no way to controller the reload of the current page or a only a part from the controller. You should send an special reponse to the javascript (ie:a simple reload string could work), and at the client side do something like document.location=youurl Regards, Pablo Viojo pvi...@gmail.com |

Re: Need AJAX to terminate and reload entire page

2010-03-26 Thread Brenda
Thank you, Pablo. I'll give that a try. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to

Re: 3rd party app - installation issues

2010-03-26 Thread ltix
Thanks Jeremy Turns out all I needed to do was modify the main .htaccess. I had done this previously but had errors and wasn't aware of the errors. Fixed the errors and it is working. On Mar 25, 10:33 pm, Jeremy Burns jeremybu...@me.com wrote: Try installing it in /app/webroot/xxx, where xxx

different separators for $form-input(..., array('type' = 'radio'...

2010-03-26 Thread Gianluca
Hello everybody. I need to create few radio options, each one separated by different portions of html code. E.g.: input type='radio' id='data[User][Title]' value='1'Mr/input brinput type='select'... ...something... br input type='radio' id='data[User][Title]' value='2'Mrs/input p some other

Re: saveAll rolling back my transactions

2010-03-26 Thread Dr. Loboto
Check validation errors. If ItemsOrders items are validated after Order and fail transaction should be rolled back. Data stays added as you have non-InnoDB table orders that do not support transactions. On Mar 26, 6:28 pm, Ernesto e.fanz...@gmail.com wrote: Hello. i have 2 models (Item and

Re: different separators for $form-input(..., array('type' = 'radio'...

2010-03-26 Thread Gianluca
Hi again. I've found a solution to my problem. I ended up creating the input-radios one at the time, and inserting the html I need between them. What I was actually mistaking was not setting the attributes['value']. echo $form-

having trouble understanding associations

2010-03-26 Thread Johnny Ferguson
Looking here: http://book.cakephp.org/view/78/Associations-Linking-Models-Together I'm certain my issue is due to a personal lack of understanding. I'm trying to homebrew a simple app to keep track of my guitar practice. I have the following models: PracticeItem: a specific exercise to be

Re: retrieve related model data

2010-03-26 Thread cricket
On Mar 26, 4:51 am, sebb86 kahlc...@googlemail.com wrote: in addition: in my view i retrieve this data in a foreach loop with this code: [view code] td style=text-align:left?php if ($port['Port']['uplink_id'] != NULL) { ? ?php echo - port id ; echo $port['Port']['uplink_id']; echo (-

input radio always checked?

2010-03-26 Thread Gianluca
Hello everybody, In the app I am building I have these three radios: echo $form-input('RuleRecurrence.weekdayconditions', array( 'type' = 'radio', 'options' = array('always' = 'Sempre'), 'checked' = ($WeekdayCondition == 'always' ? true :

Radio button error message not showing up

2010-03-26 Thread aapljack
I am building a form with a set of radio buttons and am failing to get any kind of error message when they don't pass the validation. Here is the model code I have for validation.. var $validate = array( 'name' = array( 'rule' = 'notEmpty',

Re: having trouble understanding associations

2010-03-26 Thread Gianluca
Hello Johnny, class PracticeItem extends AppModel { } class PracticeInstance extends AppModel { var $belongsTo = 'PracticeItem'; } class PracticeSession extends AppModel { var $hasMany = 'PracticeInstance'; } tblPracticeInstances * id * practiceitem_id * practicesession_id *

Re: input radio always checked?

2010-03-26 Thread Gianluca
Once again, silly me. The several value are setting each time the value for the radio. So when the first one is created, value = 'always' and it is checked. When Cake parses the second input and creates it, it sets the value to 'exact', and the second one is checked. So I was finding always the

Re: having trouble understanding associations

2010-03-26 Thread Johnny Ferguson
It's a little difficult to wrap my head around, but I think I see what's going on. belongsTo is a many to one relation, so many PracticeInstance belong to 1 PracticeItem That defies my intuition, because it's more natural for me to think of a PracticeItem as belonging to a PracticeSession. The

isAuthorized() only useful in UsersController?

2010-03-26 Thread cricket
In AppController, I have: $this-authorize = 'controller'; I have several types of Users, each with a 'model' field set. I'd like to bar certain types of Users from accessing the forum. In ForumSectionsController, I have: function isAuthorized() { return $this-Auth-user('admin') ||

How to search - A very strange find

2010-03-26 Thread amarradi
Hello together Array ( [Model1] = Array ( [id] = 1 [title] =titletext [description] = description ) [Model2] = Array ( [0] = Array ( [id] = 2 [model1_id] = 1

Re: How to search - A very strange find

2010-03-26 Thread amarradi
I have to correct it because in the that have to be an other value  $this-set('variable', $this-Model1-find('first',array(                 'conditions' = array('Model1.id' = $id),                 'recursive' =  1,                 'fields' =

Re: CakePHP Ajax drop with multiple parameters

2010-03-26 Thread nurvzy
Why are you using ?var1=$hiddenFieldId? Why not just use: 'url' = '/purchases/addGuestToTable/'. $hiddenFieldId.'/'.draggedid.element.id Then in your purchases controller: function addGuestToTable($hiddenFieldId, $draggedId){ //Do what you want. } Hope that helps, Nick On Mar 26, 5:08 am,

Re: How to search - A very strange find

2010-03-26 Thread Martin Radosta
try 'recursive' = -1 On 03/26/2010 05:23 PM, amarradi wrote: I have to correct it because in the that have to be an other value $this-set('variable', $this-Model1-find('first',array( 'conditions' = array('Model1.id' = $id), 'recursive' =1,

Re: isAuthorized() only useful in UsersController?

2010-03-26 Thread nurvzy
isAuthorized() is only called if the action is not already allowed $this-Auth-allow('action_name'). In the controller you want to lock down do you have something along the lines of $this-Auth-allow('*') in your beforeFilter? Hope that helps, Nick On Mar 26, 1:45 pm, cricket

Re: How to search - A very strange find

2010-03-26 Thread amarradi
Thanks for the tip but i get this sql error Unknown column Model2.id' in 'field list' Because there is an array in Model2. [0] [1] I dont know how do i get an coorect dataset On 26 Mrz., 21:31, Martin Radosta martinrado...@gmail.com wrote: try      'recursive' = -1 On 03/26/2010 05:23

Re: How to search - A very strange find

2010-03-26 Thread amarradi
The Question is how do i get the information from an/the associated model Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this

Re: Need AJAX to terminate and reload entire page

2010-03-26 Thread Brenda
Thanks again, Pablo. That worked. For a brief moment, it displays my response message, and then reloads the page. I suspect maybe I need to tweak the jQuery to get that to go faster. I'm using ajaxForm from the jQuery form library. Check out the new CakePHP Questions site http://cakeqs.org and

Re: isAuthorized() only useful in UsersController?

2010-03-26 Thread cricket
I didn't, but I just realised the problem. In AppController, I had $this-authorize = 'controller' instead of $this-Auth-authorize = 'controller'. It works fine now. Thanks for responding, though. On Mar 26, 4:45 pm, nurvzy nur...@gmail.com wrote: isAuthorized() is only called if the action is

Re: How to search - A very strange find

2010-03-26 Thread cricket
Which fields from Model2 do you want? Do you want anything from Model2? On Mar 26, 4:57 pm, amarradi radis...@googlemail.com wrote: The Question is how do i get the information from an/the associated model Check out the new CakePHP Questions site http://cakeqs.org and help others with their

How to show fields from an related model

2010-03-26 Thread amarradi
Hello together, i have two models, hasOne(Model2) hasMany(Model1) connection now i try to search over an id in model1 the data in model2. i try it in this way $this-set('var1',$this-Model1-find('first', array( 'conditions' = array('Model1.id' = $id), 'recursive'

Re: How to search - A very strange find

2010-03-26 Thread amarradi
I want the title description and in the first version reservation_status i try it over contains or recursive 2 But no change On 27 Mrz., 00:39, cricket zijn.digi...@gmail.com wrote: Which fields from Model2 do you want? Do you want anything from Model2? On Mar 26, 4:57 pm, amarradi

Re: How to search - A very strange find

2010-03-26 Thread amarradi
I have to go to bed good night Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to

Random returns same results

2010-03-26 Thread Dave
I have this for my find all ; $count = 10; $params = array( 'conditions' = array( 'Entry.featured' = 1), 'fields' = array( 'Entry.id', 'Entry.title'), 'limit' = $count, 'order' = 'rand()', 'contain' = false); return $this-find('all', $params); So I have 100 dummy

Re: Undefined index

2010-03-26 Thread Ed Propsner
Yes, I did try that. There is a field for confirm password as well and that is all that is being presented to the controller. On Fri, Mar 26, 2010 at 1:29 AM, Jeremy Burns jeremybu...@me.com wrote: Have you debugged the data that is being presented to the controller function? Set debug to 2

Re: Undefined index

2010-03-26 Thread Ed Propsner
I'm not sure why but I'm relatively sure that it's not recognizing the form fields for username and password. On Fri, Mar 26, 2010 at 10:38 PM, Ed Propsner crotchf...@gmail.com wrote: Yes, I did try that. There is a field for confirm password as well and that is all that is being presented to

Help understanding containable

2010-03-26 Thread kramers
I am trying to figure out how to use containable properly. These are the model relationship: Client has many Account Account has many Bills Bills have many BillResources ResourceType hasMany BillResource BillResources belong to bill Bills belong to Account Account belongs to Client I am trying

Re: saveAll rolling back my transactions

2010-03-26 Thread Lucca Mordente
Maybe your database table engine does not support transactions. What engine are you using? Lucca Mordente On 26 mar, 09:28, Ernesto e.fanz...@gmail.com wrote: Hello. i have 2 models (Item and Order) joined together by a HABTM relationship. since i need some additional fields (quantity) in

Translation behavior and Model relations

2010-03-26 Thread trick-mueller.ch
Hi Forum I've a problem with my cake application. i've 2 tables (sites and articles). The relations in the model: sites belong to sites (self join) sites has many sites sites has many article articles belongs to sites I added the translation behavior to my model and put the db-fields in the

Re: Undefined index

2010-03-26 Thread Jeremy Burns
The reason I recommended that you examine the data array is that sometimes (and I often get confused with this myself) you need to double check exactly where the item you are looking for sits in the array. So if you can see the field you want, build the path to it by walking back up from it. If

Re: Undefined index

2010-03-26 Thread Ed Propsner
The only thing showing in the array is the field for 'confirm_password', [code] Array ( [User] = Array ( [confirm_password] = test ) ) [/code] I'm having the same issue with the the username field. It's acting like the field doesn't exist. On Sat, Mar 27,

Re: Undefined index

2010-03-26 Thread Jeremy Burns
So all you can get is $this-data['User']['confirm_password']... Are you expecting more fields to be in the array? Are the fields you want inside the form in the view? Jeremy Burns jeremybu...@me.com On 27 Mar 2010, at 05:00, Ed Propsner wrote: The only thing showing in the array is the

Re: How to search - A very strange find

2010-03-26 Thread Martin Radosta
|Your question is not clear, I guess you need this: $this-Model1-Behaviors-attach('Containable'); | $this-Model1-find('first', array( 'conditions' = array('Model1.id' = $id), 'contain' = array('Model2' = array('fields' = array('Model2.title',

Re: Undefined index

2010-03-26 Thread Ed Propsner
Yes, I'm expecting to see $this-data['User'][''password'] as well. Both fields exist and are displayed in the view. On Sat, Mar 27, 2010 at 1:09 AM, Jeremy Burns jeremybu...@me.com wrote: So all you can get is $this-data['User']['confirm_password']... Are you expecting more fields to be in

Re: Undefined index

2010-03-26 Thread Jeremy Burns
But are they inside the form in the view? Jeremy Burns jeremybu...@me.com On 27 Mar 2010, at 05:15, Ed Propsner wrote: Yes, I'm expecting to see $this-data['User'][''password'] as well. Both fields exist and are displayed in the view. On Sat, Mar 27, 2010 at 1:09 AM, Jeremy Burns

Re: Undefined index

2010-03-26 Thread Ed Propsner
Yup, I double checked to make sure I didn't somehow inadvertently end the form early but it's all good. The field before 'password' is 'username' and i'm using $ajax-observeField to display changes to the 'username' field but it's not doing anything and I'm guessing that it's' not seeing the field

Re: Radio button error message not showing up

2010-03-26 Thread Dr. Loboto
Use $form-input() instead of $form-radio() or use $form-error() together with $form-radio() On Mar 27, 1:05 am, aapljack brianmiddle...@gmail.com wrote: I am building a form with a set of radio buttons and am failing to get any kind of error message when they don't pass the validation. Here

Re: Undefined index

2010-03-26 Thread Jeremy Burns
You say they are being recognised OK, but they weren't in the $this-data array? Have you checked the actual page source to examine the form in the view? Only yesterday I debugged a similar problem where the browser was ending the form for me (I had embedded it incorrectly into a table). Jeremy

Re: Undefined index

2010-03-26 Thread Ed Propsner
Sorry, I'm new to Cake and was a bit confused. I was echoing the debug inside the controller that the ajax call uses. The only two fields that are being used in that controller are 'password' and 'confirm_password' ... only 'confirm_password' is displayed with the debug. Up until now I never