Re: Self Association parent_id doesn't display in view drop down

2013-03-20 Thread AD7six
$parentItems - $parents

AD

On Wednesday, 20 March 2013 03:28:09 UTC+1, mk wrote:

 Hi

 I am having some trouble getting a self association parent_id to show up 
 in the scaffolding drop down list of a view. 

 I have the following baked add action in my controller
 public function add() {
 if ($this-request-is('post')) {
 $this-Item-create();
 if ($this-Item-save($this-request-data)) {
 $this-Session-setFlash(__('The item has been saved'));
 $this-redirect(array('action' = 'index'));
 } else {
 $this-Session-setFlash(__('The item could not be saved. 
 Please, try again.'));
 }
 }
 $parentItems = $this-Item-ParentItem-find('list');
 $collections = $this-Item-Collection-find('list');
 $this-set(compact('parentItems', 'collections'));
 }

 This passes parentItems and collections to my view (add.ctp) but the view 
 outputs an empty dropdown box for parent_id

 fieldset
 legend?php echo __('Add Item'); ?/legend
 ?php
 echo $this-Form-input('parent_id');
 echo $this-Form-input('collection_id');
 echo $this-Form-input('name');
 ?
 /fieldset

 Does anyone have an idea what I am doing wrong? I have the following 
 associations setup in my model
 Item Model/Item.php - contains columns id, parent_id, lft, rght  name
 
 public $belongsTo = array(
 'ParentItem' = array(
 'className' = 'Item',
 'foreignKey' = 'parent_id',
 'conditions' = '',
 'fields' = '',
 'order' = ''
 ),

 public $hasMany = array(
 'ChildItem' = array(
 'className' = 'Item',
 'foreignKey' = 'parent_id',
 'dependent' = false,
 'conditions' = '',
 'fields' = '',
 'order' = '',
 ),

 I also see the parentItems array in the variables of the debug toolkit so 
 I know they are there... just need to know how to show the name for each 
 parent_id

 Thanks in advance for any help.



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Retrieve attachment from a Post - mailgun

2013-03-20 Thread AD7six
Show the result of debug ($this-request-data);

That will either answer the question for you or show the data isn't there 
to be accessed.

AD

On Tuesday, 19 March 2013 18:26:15 UTC+1, MDay wrote:

 hi there - hoping someone can help me with a simple issue I have having 
 with retrieving data from an HTTP Post.   I am using mailgun to post an 
 email message to a simple method in my application...  Everything is 
 working correctly except I can't get attachments out of the POST.  I 
 noticed that the encoding is set as multipart/form-data and the support 
 guys at mailgun indicated I had to use $FILES to retrieve the data from the 
 post.   I am a bit of a newbie, so now I am lost..

 Here is what my current code looks like:

 $subject = $this-request-data('subject');   //THIS WORKS

 $attachement_test1 = $this-request-data($_FILES['attachment-1']); 
  //THIS DOESN'T WORK

 $attachement_test2 = $this-request-data('attachment-1');//THIS DOESN'T 
 WORK EITHER

 $this-log(New Message);

 $this-log($subject);

 $this-log($attachement_test1);

 $this-log($attachement_test2);


 Snip from the mailgun docs:


 attachment-xstringattached file (‘x’ stands for number of the 
 attachment). Attachments are handled as file uploads, encoded as 
 multipart/form-data.



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Retrieve attachment from a Post - mailgun

2013-03-20 Thread nickmi...@gmail.com
You can if you use behind the scenes iframes, there's jquery plugins for this.


Sent from my HTC

- Reply message -
From: jeet bajaj bajaj...@gmail.com
To: cake-php@googlegroups.com
Subject: Retrieve attachment from a Post - mailgun
Date: Wed, Mar 20, 2013 05:01
You have not shown you code properly, as much as i am understanding you might 
be using ajax for submission of forms. Are you Posting form using Ajax??? If it 
is, then i will suggest you that ajax based form posting does not support file 
upload


On Tue, Mar 19, 2013 at 10:56 PM, MDay mdaytra...@gmail.com wrote:

hi there - hoping someone can help me with a simple issue I have having with 
retrieving data from an HTTP Post.   I am using mailgun to post an email 
message to a simple method in my application...  Everything is working 
correctly except I can't get attachments out of the POST.  I noticed that the 
encoding is set as multipart/form-data and the support guys at mailgun 
indicated I had to use $FILES to retrieve the data from the post.   I am a bit 
of a newbie, so now I am lost..


Here is what my current code looks like:

$subject = $this-request-data('subject');   //THIS WORKS

$attachement_test1 = 
$this-request-data($_FILES['attachment-1']);  //THIS DOESN'T WORK

$attachement_test2 = 
$this-request-data('attachment-1');//THIS DOESN'T WORK EITHER

$this-log(New Message);

$this-log($subject);

$this-log($attachement_test1);

$this-log($attachement_test2);


Snip from the mailgun docs:



attachment-x
string
attached file (‘x’ stands for number of the attachment). Attachments are 
handled as file uploads, encoded as multipart/form-data.




-- 

Like Us on FaceBook https://www.facebook.com/CakePHP

Find us on Twitter http://twitter.com/CakePHP

 

--- 

You received this message because you are subscribed to the Google Groups 
CakePHP group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.

To post to this group, send email to cake-php@googlegroups.com.

Visit this group at http://groups.google.com/group/cake-php?hl=en.

For more options, visit https://groups.google.com/groups/opt_out.

 

 






-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: HABTM Inner Join with 3 models

2013-03-20 Thread Jerome Walitzek
Hello,
I solved the problem now as follows

*JobsController.php*
...
$drivers = $this-Job-query(SELECT User.id, (CONCAT(vorname, ' 
',nachname)) AS name FROM users AS User INNER JOIN users_events AS Event ON 
User.id = Event.user_id WHERE Event.event_id = $jobid);
...

*edit.ctp*
$select_value = array();
$select_value[null] = '-- Make a selection --';
foreach($drivers as $driver) {
$key = $driver['User']['id'];
$value   = $driver[0]['name'];
$select_value[$key]= $value;
}

$mydata = $this-data;
if ( $mydata['Job']['driver_id'] != null ) {
foreach ( $select_value as $k = $v ) {
if ( $mydata['Job']['driver_id'] == $k ) {
$this_is_selected =  $k; 
}
}
} else {
$this_is_selected = 0;
}
echo $this-Form-input('driver_id', array(
'options' = $select_value,
'type' = 'select',
'label' = 'Driver'
));

*add.ctp*
$select_value = array();
$select_value[null] = '-- Make a selection --';
foreach($drivers as $driver) {
$key = $driver['User']['id'];
$value   = $driver[0]['name'];
$select_value[$key]= $value;
}

echo $this-Form-input('driver_id', array(
'options' = $select_value,
'type' = 'select',
'label' = 'Driver'
));


Okay it's not CakeLike, but it works flawlessly.

Nice Greetings

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




ajax Update in a page with 2 divs

2013-03-20 Thread Chris

hi guys,... how you all doing, can anyone help please,... 
I got an ajax form that submits and add bookmarks to a site and it's 
working,... 

Is it possible to Update in a page with 2 divs ? and how can I do that in a 
form: , 'update' = 'updateBookmark1',...? and where should I insert 
'updateBookmark2',... ?? 

thanks in advance, 


div id=updateBookmark1 this update confirmation /div
div id=updateBookmark2 this need to update content /div ,... kind of 
refreshing content in a page
 .
.
.

p style=float: left; margin: 0 0 0 35px;
?php echo $ajax-submit('Add', array('url'= 
array('controller'='bookmarks', 'action'='add'), 'update' = 
'updateBookmark1', 'complete' = 'javascript:resetBookmarkForm();' )); ?
?php echo $form-end(); ?
/p

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Retrieve attachment from a Post - mailgun

2013-03-20 Thread MDay
I just responded, but I  should have reiterated the flow the the 
application.   It's basically as follows:

1.  I send an email to mailgun
2.  Mailgun parses the message and POSTS it to my web page/controller over 
HTTP
3.  My application has a single controller (no models or views) with one 
method that currently only does this:
$this-log($this-request-data);
4.  I found a Ruby sample that seems to deal with this, but Cakephp is not. 
 I am wondering if the cake request object is not handling the FILES 
correctly. Here is that sample:

# enumerate through all attachments in the message and save
# them to disk with their original filenames:
for attachment in request.files.values():
attachment.filename
data = attachment.stream.read()
with open(attachment.filename, w) as f:
f.write(data)

5.  Here is some additional information on the attachment fields from 
mailgun.

attachment-xstringattached file (‘x’ stands for number of the attachment). 
Attachments are handled as file uploads, encoded as multipart/form-data.
content-id-mapstringJSON-encoded dictionary which maps Content-ID (CID) of 
each attachment to the corresponding attachment-x parameter. This allows 
you to map posted attachments to tags like img src='cid' in the message 
body.

6.   Here is a dump of the request object received when a new message is 
received.  Note that the [content-id-map] and [attachment-count] are both 
there.   The [attachment-1] is also referenced in the [content-id-map]

***
[recipient] = testrecei...@ducksoup.mailgun.org

[sender] = mdaytra...@gmail.com

[subject] = SUBJECT OF MESSAGE

[from] = mdaytrades mdaytra...@gmail.com

[Received] = from [192.168.0.12] 
(CPE0026f336fc30-CM0026f336fc2d.cpe.net.cable.rogers.com. [99.233.238.184]) 
by mx.google.com with ESMTPS id wn10sm4453782igb.2.2013.03.20.03.01.59 
(version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Mar 2013 
03:02:00 -0700 (PDT)

[X-Envelope-From] = mdaytra...@gmail.com

[Dkim-Signature] = v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; 
s=20120113; 
h=x-received:from:content-type:subject:date:references:to:message-id 
:mime-version:x-mailer; bh=z2IoCinGNl4lOcyJgDRZOTqqTbEmOXG+ftlhXIfSivI=; 
b=G2IaZ6gPn9GtugTTrIErSWuIyo4Ad9uiUcsp/XpoxXQFBJ5T0CEwNznldIXI15vQ4Q 
ND8G6wf1PGRWKURTD8nSb0TRSFInBqImAW5t3KnhXKt/WGEVNOajwfwTR3m2OiryZkG8 
C5qA8YHNWQHS8j9rzXP0RNxY3T8MN7YmtrWEdcybMpfgxFFjFdyB0IEF5+KDhaJ0Nc/u 
oCtdrsXU1rVZNp52uqdiCHrR/7Ca7rAwMP3rxQx6X7yXiBcSqu2Lp9pSmwkHhWnFoJcn 
WnLWbEVRQgsg+qKy8OJHIexEvdJa7Bwo/nSuPs+IIWyFKhQzLOqb8dXgDcDsuqVV2oPt 8BKw==

[X-Received] = by 10.42.88.145 with SMTP id 
c17mr13130362icm.47.1363773721513; Wed, 20 Mar 2013 03:02:01 -0700 (PDT)

[Return-Path] = mdaytra...@gmail.com

[From] = mdaytrades mdaytra...@gmail.com

[Content-Type] = multipart/alternative; 
boundary=Apple-Mail=_EC882749-B764-43DB-9769-3F4850B978F3

[Subject] = SUBJECT OF MESSAGE

[Date] = Wed, 20 Mar 2013 06:02:00 -0400

[References] = 8a01b27e-cd7d-4599-b1c5-f87bf8746...@gmail.com

[To] = testrecei...@ducksoup.mailgun.org 
testrecei...@ducksoup.mailgun.org

[Message-Id] = 9385ec89-5462-4ba1-93b9-9e4e8bec1...@gmail.com

[Mime-Version] = 1.0 (Mac OS X Mail 6.3 \(1503\))

[X-Mailer] = Apple Mail (2.1503)

[X-Mailgun-Incoming] = Yes

[message-headers] = [[Received, by luna.mailgun.net with SMTP mgrt 
8784990917749; Wed, 20 Mar 2013 10:02:02 +], [X-Envelope-From, 
mdaytra...@gmail.com], [Received, from mail-ie0-f180.google.com 
(mail-ie0-f180.google.com [209.85.223.180]) by mxa.mailgun.org with ESMTP 
id 51498919.7f7908037770-in1; Wed, 20 Mar 2013 10:02:01 - (UTC)], 
[Received, by mail-ie0-f180.google.com with SMTP id a11so1597996iee.39 
for testrecei...@ducksoup.mailgun.org; Wed, 20 Mar 2013 03:02:01 -0700 
(PDT)], [Dkim-Signature, v=1; a=rsa-sha256; c=relaxed/relaxed; 
d=gmail.com; s=20120113; 
h=x-received:from:content-type:subject:date:references:to:message-id 
:mime-version:x-mailer; bh=z2IoCinGNl4lOcyJgDRZOTqqTbEmOXG+ftlhXIfSivI=; 
b=G2IaZ6gPn9GtugTTrIErSWuIyo4Ad9uiUcsp/XpoxXQFBJ5T0CEwNznldIXI15vQ4Q 
ND8G6wf1PGRWKURTD8nSb0TRSFInBqImAW5t3KnhXKt/WGEVNOajwfwTR3m2OiryZkG8 
C5qA8YHNWQHS8j9rzXP0RNxY3T8MN7YmtrWEdcybMpfgxFFjFdyB0IEF5+KDhaJ0Nc/u 
oCtdrsXU1rVZNp52uqdiCHrR/7Ca7rAwMP3rxQx6X7yXiBcSqu2Lp9pSmwkHhWnFoJcn 
WnLWbEVRQgsg+qKy8OJHIexEvdJa7Bwo/nSuPs+IIWyFKhQzLOqb8dXgDcDsuqVV2oPt 
8BKw==], [X-Received, by 10.42.88.145 with SMTP id 
c17mr13130362icm.47.1363773721513; Wed, 20 Mar 2013 03:02:01 -0700 (PDT)], 
[Return-Path, mdaytra...@gmail.com], [Received, from 
[192.168.0.12] (CPE0026f336fc30-CM0026f336fc2d.cpe.net.cable.rogers.com. 
[99.233.238.184]) by mx.google.com with ESMTPS id 
wn10sm4453782igb.2.2013.03.20.03.01.59 (version=TLSv1 
cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Mar 2013 03:02:00 -0700 
(PDT)], [From, mdaytrades mdaytra...@gmail.com], [Content-Type, 
multipart/alternative; 

Re: Solution for CakePHP newbies who are stuck with messages like - Error: PostController could not be found

2013-03-20 Thread Wenke WANG
Thanks a lot!!!

On Saturday, November 24, 2012 3:53:19 PM UTC-5, Mike Pritchard wrote:

 I struggled with the problems described in messages from new CakePHP 
 users.  The Cake install looked OK, but when I went through the Blog Adding 
 a Layer tutorial I'd get these kinds of messages.

 Error: PostController could not be found
 Error: Create the class PostController below in file: 
 app/Controller/PostsController.php

 After reading lots of threads, going through the tutorial again and again, 
 reinstalling, checking mod_rewrite, etc., I finally figured it out.  So 
 hopefully this will help others.

 The Cakewalk tutorials omit to mention that the php files need to start 
 with ?php, and the snippets don't include the beginning. I assumed that 
 this was correct - part of the Cakewalk process. And also discovered that 
 the php files that start with ?php don't finish with ?.

 When I added the ?php to the beginning of relevant files in the tutorial, 
 everything started working!  I've been able to finish the tutorial and even 
 extend it a little.

 Onward and upward.
 MIke



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Cakephp 2.3 find('all')/paginate() performance question

2013-03-20 Thread Marco Vilera
Hey people,

I'm quite new to cakephp, have around a month developing a small app just 
for learning purposes.

Currently i'm having an issue, which while it's not really problematic, in 
this case. it's quite stressing me not finding a way to solve it.

Any of my paginate/find calls, are slowing my controller actions by around 
1-1.2 segs, no matter how many records I have in this table it could be 10 
records or 2000, it will always await around 1000 ms to render my view. 

I have tried several things I looked around in google, like using recursive 
= -1, disabling debug mode, properly indexing my database, using 
containable behavior, and none of this is improving my response time. Only 
thing that I haven't tried is to implement cache in find, since the way my 
app will work, it's not likely that 2 queries will be the same, or at least 
not the most used methods. 

My SQL queries are quite simple and will delay maximum around 10ms, most of 
them are around 2-3 ms according to debug_kit plugin.

Would love any kind of input, i'm falling in love with this framework but 
this issue is disturbing me.

P.S: English is not my native language, please if there is something you 
don't understand, let me know and i'll try to make it clear.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ajax Update in a page with 2 divs

2013-03-20 Thread Fábio Vanderlei
I would try :
?php echo $ajax-submit('Add', array('url'= 
array('controller'='bookmarks', 'action'='add'), *'update' =array( 
'updateBookmark1','updateBookmark2' )*, 'complete' = 
'javascript:resetBookmarkForm();' )); ?

Em quarta-feira, 20 de março de 2013 07h12min52s UTC-3, Chris escreveu:


 hi guys,... how you all doing, can anyone help please,... 
 I got an ajax form that submits and add bookmarks to a site and it's 
 working,... 

 Is it possible to Update in a page with 2 divs ? and how can I do that in 
 a form: , 'update' = 'updateBookmark1',...? and where should I insert 
 'updateBookmark2',... ?? 

 thanks in advance, 


 div id=updateBookmark1 this update confirmation /div
 div id=updateBookmark2 this need to update content /div ,... kind of 
 refreshing content in a page
  .
 .
 .

 p style=float: left; margin: 0 0 0 35px;
 ?php echo $ajax-submit('Add', array('url'= 
 array('controller'='bookmarks', 'action'='add'), 'update' = 
 'updateBookmark1', 'complete' = 'javascript:resetBookmarkForm();' )); ?
 ?php echo $form-end(); ?
 /p



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




CakePHP and Ajax request

2013-03-20 Thread Piotr Chabros
Hi

I am currently using ajax in multiple controllers in my application. I 
implemented the ajax functionality using the jQuery supported version.

$.ajax({
url:'getCountries',
type: POST,
dataType: html,
data:data= + result,
success: function(data){
//magic...
}
}
});

As you can see from the code above the url of this request is 
'getCountries'. This means that if the request is made from 
'http://localhost/appname/controllername/methodname' the request url will 
be  'http://localhost/appname/controllername/getCountries'. However if the 
url is different, say 
 'http://localhost/appname/controllername/methodname/7' (like in the edit 
view) or 
( 'http://localhost/appname/controllername/methodname/order:Model.field' 
(like in the pagination) then the request url will dramaticly change to 
 'http://localhost/appname/controllername/methodname/getCountries' in the 
first case and even worse in the second. How can I avoid that?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Self Association parent_id doesn't display in view drop down

2013-03-20 Thread mk
perfect... thanks. I knew it would be something simple after spending too 
many hours trying everything but that, 

On Wednesday, March 20, 2013 2:24:07 AM UTC-5, AD7six wrote:

 $parentItems - $parents

 AD

 On Wednesday, 20 March 2013 03:28:09 UTC+1, mk wrote:

 Hi

 I am having some trouble getting a self association parent_id to show up 
 in the scaffolding drop down list of a view. 

 I have the following baked add action in my controller
 public function add() {
 if ($this-request-is('post')) {
 $this-Item-create();
 if ($this-Item-save($this-request-data)) {
 $this-Session-setFlash(__('The item has been saved'));
 $this-redirect(array('action' = 'index'));
 } else {
 $this-Session-setFlash(__('The item could not be saved. 
 Please, try again.'));
 }
 }
 $parentItems = $this-Item-ParentItem-find('list');
 $collections = $this-Item-Collection-find('list');
 $this-set(compact('parentItems', 'collections'));
 }

 This passes parentItems and collections to my view (add.ctp) but the view 
 outputs an empty dropdown box for parent_id

 fieldset
 legend?php echo __('Add Item'); ?/legend
 ?php
 echo $this-Form-input('parent_id');
 echo $this-Form-input('collection_id');
 echo $this-Form-input('name');
 ?
 /fieldset

 Does anyone have an idea what I am doing wrong? I have the following 
 associations setup in my model
 Item Model/Item.php - contains columns id, parent_id, lft, rght  name
 
 public $belongsTo = array(
 'ParentItem' = array(
 'className' = 'Item',
 'foreignKey' = 'parent_id',
 'conditions' = '',
 'fields' = '',
 'order' = ''
 ),

 public $hasMany = array(
 'ChildItem' = array(
 'className' = 'Item',
 'foreignKey' = 'parent_id',
 'dependent' = false,
 'conditions' = '',
 'fields' = '',
 'order' = '',
 ),

 I also see the parentItems array in the variables of the debug toolkit so 
 I know they are there... just need to know how to show the name for each 
 parent_id

 Thanks in advance for any help.



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: bind model for saveAssociated

2013-03-20 Thread Hank
Did you ever find a solution to this?

On Tuesday, November 20, 2012 12:35:55 PM UTC-8, Sebastien Beausoleil wrote:

 Hi,

 Is it possible to bind on the fly a model to another to saveAssociated 
 those to at the same time?


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ajax Update in a page with 2 divs

2013-03-20 Thread Chris
thanks Fabio,... I'll try,... 

On Wednesday, March 20, 2013 5:20:36 AM UTC-7, Fábio Vanderlei wrote:

 I would try :
 ?php echo $ajax-submit('Add', array('url'= 
 array('controller'='bookmarks', 'action'='add'), *'update' =array( 
 'updateBookmark1','updateBookmark2' )*, 'complete' = 
 'javascript:resetBookmarkForm();' )); ?

 Em quarta-feira, 20 de março de 2013 07h12min52s UTC-3, Chris escreveu:


 hi guys,... how you all doing, can anyone help please,... 
 I got an ajax form that submits and add bookmarks to a site and it's 
 working,... 

 Is it possible to Update in a page with 2 divs ? and how can I do that in 
 a form: , 'update' = 'updateBookmark1',...? and where should I insert 
 'updateBookmark2',... ?? 

 thanks in advance, 


 div id=updateBookmark1 this update confirmation /div
 div id=updateBookmark2 this need to update content /div ,... kind 
 of refreshing content in a page
  .
 .
 .

 p style=float: left; margin: 0 0 0 35px;
 ?php echo $ajax-submit('Add', array('url'= 
 array('controller'='bookmarks', 'action'='add'), 'update' = 
 'updateBookmark1', 'complete' = 'javascript:resetBookmarkForm();' )); ?
 ?php echo $form-end(); ?
 /p



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.