Re: Cake or IE9?

2013-06-30 Thread Reuben
The next thing I would try is enabling debugging with the Ajax call, and 
see what error you get back from the server.  

Hopefully, this is a scenario you are reproducing in a development 
environment.  Any useful errors are probably being blocked by debug=0 in 
the  _ajaxSetup() call.

While you're in the development environment, definitely make sure that the 
is('ajax') portion of the code is actually getting executed, with a few 
well placed CakeLog::debug() calls.

On Monday, 1 July 2013 10:47:51 UTC+10, advantage+ wrote:
>
> Will play around even more.
>
>  
>
> Using newest version of jQuery.
>
> The ajax response / headers are set in the $this->_ajaxReturn($response);and 
> it works fine in every other browser. It returns a JSON encoded 
> response.
>
> My current code even works in IE8, its just 9 that does not want to 
> co-operate with me.
>
>  
>
> I will try .on() and see how that goes.
>
>  
>
> In the js snip :
>
>  
>
> $("a.portfolio").click(function(e){
>
> e.preventDefault();
>
> var link = $(this).attr("href");
>
>  
>
> $.ajax({
>
> type: "GET",
>
> url: link,
>
> //cache: false,
>
> dataType: "json", 
> 
>
>
> success: function(response) 
> {
>
> 
>
> alert(
> response);
>
> 
>
>  
>
>  
>
> There is never a response from the server in IE9 it never comes back with 
> anything. Just sits there waiting for something I suppose.
>
>  
>
> Thanks for your time. See how it goes J
>
>  
>
> *From:* cake...@googlegroups.com  [mailto:
> cake...@googlegroups.com ] *On Behalf Of *Reuben
> *Sent:* Sunday, June 30, 2013 8:28 PM
> *To:* cake...@googlegroups.com 
> *Subject:* Re: Cake or IE9?
>
>  
>
> Here are the things I would be looking at first.
>
>  
>
> 1. Consider the version of jQuery you are using.  In newer releases of 
> jQuery, .live() is deprecated, or just doesn't work.  If this is working 
> for you, then you may be using an older version of jQuery, and that may 
> have issues with IE9. The newer way is to use .on() for event handling, but 
> if you go too new, then IE8 gets knocked off the list of supported browsers.
>
>  
>
> 2. You shouldn't need to use Firebug Lite to inspect the DOM, JS and 
> Network in IE9.  Typically, I use Chrome, but the inspectors in IE9 are 
> pretty good.  Having said that, if a response isn't getting sent, that 
> might be a server side issue, but likely because your Ajax request isn't 
> invoking an Ajax response.  You may want to compare Request-Type, 
> Application-Type, Content-Type or X-Requested-with, or whatever it is that 
> indicates to CakePHP that an Ajax request is coming in, and an Ajax 
> response is required.
>
>  
>
> 3. If you can see that a response is being sent from the server, then 
> you're probably looking at a JS/IE9 issue.
>
> On Monday, 1 July 2013 06:41:08 UTC+10, advantage+ wrote:
>
> The request is being sent / response via regular ajax view. It works in 
> all browsers using this approach except IE9. 
>
> I check Firebug Lite in IE and the same request gets sent but it never 
> returns anything it just sits there with the little spinner in FB lite. 
>
> So that’s why I am wondering if it’s a cake / ie9 issue or just an issue 
> with my JS script.
>
>  
>
>/
>
>* VIEW METHOD
>
>* ***
>
>*
>
>* 
>
>* 
>
>* 
>
>/
>
>public function view($slug = null) {
>
>   
>
>   $portfolio = $this->Portfolio->getPortfolioBySlug($slug);
>
>   
>
>   $this->set('portfolio', $portfolio);
>
>   $this->set('neighbors', $this->Portfolio->
> getNeighbors($portfolio['Portfolio']['order']));
>
>   
>
>   if ($this->request->is('ajax')) {
>
>  $this->_ajaxSetup(); //prepare for ajax request no 
> render, set debug 0
>
>  $response = array(
>
>  'html' => $this->render('view', 'ajax')->body(),
>
>  'slide' => $portfolio['Thumb']['0']['slide']);
>
>  $this->_ajaxReturn($response); //returns the json 
> array / response
>
>   }
>
>   
>
>}
>
>  
>
> *From:* cake...@googlegroups.com [mailto:cake...@googlegroups.com] *On 
> Behalf Of *AD7six
> *Se

RE: Cake or IE9?

2013-06-30 Thread Advantage+
Will play around even more.

 

Using newest version of jQuery.

The ajax response / headers are set in the $this->_ajaxReturn($response);
and it works fine in every other browser. It returns a JSON encoded
response.

My current code even works in IE8, its just 9 that does not want to
co-operate with me.

 

I will try .on() and see how that goes.

 

In the js snip :

 

$("a.portfolio").click(function(e){

e.preventDefault();

var link = $(this).attr("href");

 

$.ajax({

type: "GET",

url: link,

//cache: false,

dataType: "json",


success: function(response)
{



 
alert(response);



 

 

There is never a response from the server in IE9 it never comes back with
anything. Just sits there waiting for something I suppose.

 

Thanks for your time. See how it goes J

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of Reuben
Sent: Sunday, June 30, 2013 8:28 PM
To: cake-php@googlegroups.com
Subject: Re: Cake or IE9?

 

Here are the things I would be looking at first.

 

1. Consider the version of jQuery you are using.  In newer releases of
jQuery, .live() is deprecated, or just doesn't work.  If this is working for
you, then you may be using an older version of jQuery, and that may have
issues with IE9. The newer way is to use .on() for event handling, but if
you go too new, then IE8 gets knocked off the list of supported browsers.

 

2. You shouldn't need to use Firebug Lite to inspect the DOM, JS and Network
in IE9.  Typically, I use Chrome, but the inspectors in IE9 are pretty good.
Having said that, if a response isn't getting sent, that might be a server
side issue, but likely because your Ajax request isn't invoking an Ajax
response.  You may want to compare Request-Type, Application-Type,
Content-Type or X-Requested-with, or whatever it is that indicates to
CakePHP that an Ajax request is coming in, and an Ajax response is required.

 

3. If you can see that a response is being sent from the server, then you're
probably looking at a JS/IE9 issue.

On Monday, 1 July 2013 06:41:08 UTC+10, advantage+ wrote:

The request is being sent / response via regular ajax view. It works in all
browsers using this approach except IE9. 

I check Firebug Lite in IE and the same request gets sent but it never
returns anything it just sits there with the little spinner in FB lite. 

So that's why I am wondering if it's a cake / ie9 issue or just an issue
with my JS script.

 

   /

   * VIEW METHOD

   * ***

   *

   * 

   * 

   * 

   /

   public function view($slug = null) {

  

  $portfolio = $this->Portfolio->getPortfolioBySlug($slug);

  

  $this->set('portfolio', $portfolio);

  $this->set('neighbors',
$this->Portfolio->getNeighbors($portfolio['Portfolio']['order']));

  

  if ($this->request->is('ajax')) {

 $this->_ajaxSetup(); //prepare for ajax request no
render, set debug 0

 $response = array(

 'html' => $this->render('view', 'ajax')->body(),

 'slide' => $portfolio['Thumb']['0']['slide']);

 $this->_ajaxReturn($response); //returns the json array
/ response

  }

  

   }

 

From: cake...@googlegroups.com 
[mailto:cake...@googlegroups.com  ] On Behalf Of AD7six
Sent: Sunday, June 30, 2013 9:10 AM
To: cake...@googlegroups.com  
Subject: Re: Cake or IE9?

 



On Sunday, 30 June 2013 05:41:36 UTC+2, advantage+ wrote:

Not sure if this is a Cake issue or just stupid IE.

 

I have a small snip of js code that works in all browsers except IE9.

 

There's no CakePHP in your question.

 

AD

-- 
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+u...@googlegroups.com  .
To post to this group, send email to cake...@googlegroups.com 
.
Visit this group at http://groups.google.com/group/cake-php.
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
 

Re: Cake or IE9?

2013-06-30 Thread Reuben
Here are the things I would be looking at first.

1. Consider the version of jQuery you are using.  In newer releases of 
jQuery, .live() is deprecated, or just doesn't work.  If this is working 
for you, then you may be using an older version of jQuery, and that may 
have issues with IE9. The newer way is to use .on() for event handling, but 
if you go too new, then IE8 gets knocked off the list of supported browsers.

2. You shouldn't need to use Firebug Lite to inspect the DOM, JS and 
Network in IE9.  Typically, I use Chrome, but the inspectors in IE9 are 
pretty good.  Having said that, if a response isn't getting sent, that 
might be a server side issue, but likely because your Ajax request isn't 
invoking an Ajax response.  You may want to compare Request-Type, 
Application-Type, Content-Type or X-Requested-with, or whatever it is that 
indicates to CakePHP that an Ajax request is coming in, and an Ajax 
response is required.

3. If you can see that a response is being sent from the server, then 
you're probably looking at a JS/IE9 issue.

On Monday, 1 July 2013 06:41:08 UTC+10, advantage+ wrote:
>
> The request is being sent / response via regular ajax view. It works in 
> all browsers using this approach except IE9. 
>
> I check Firebug Lite in IE and the same request gets sent but it never 
> returns anything it just sits there with the little spinner in FB lite. 
>
> So that’s why I am wondering if it’s a cake / ie9 issue or just an issue 
> with my JS script.
>
>  
>
>/
>
>* VIEW METHOD
>
>* ***
>
>*
>
>* 
>
>* 
>
>* 
>
>/
>
>public function view($slug = null) {
>
>   
>
>   $portfolio = $this->Portfolio->getPortfolioBySlug($slug);
>
>   
>
>   $this->set('portfolio', $portfolio);
>
>   $this->set('neighbors', $this->Portfolio->
> getNeighbors($portfolio['Portfolio']['order']));
>
>   
>
>   if ($this->request->is('ajax')) {
>
>  $this->_ajaxSetup(); //prepare for ajax request no 
> render, set debug 0
>
>  $response = array(
>
>  'html' => $this->render('view', 'ajax')->body(),
>
>  'slide' => $portfolio['Thumb']['0']['slide']);
>
>  $this->_ajaxReturn($response); //returns the json 
> array / response
>
>   }
>
>   
>
>}
>
>  
>
> *From:* cake...@googlegroups.com  [mailto:
> cake...@googlegroups.com ] *On Behalf Of *AD7six
> *Sent:* Sunday, June 30, 2013 9:10 AM
> *To:* cake...@googlegroups.com 
> *Subject:* Re: Cake or IE9?
>
>  
>
>
>
> On Sunday, 30 June 2013 05:41:36 UTC+2, advantage+ wrote:
>
> Not sure if this is a Cake issue or just stupid IE.
>
>  
>
> I have a small snip of js code that works in all browsers except IE9.
>
>  
>
> There's no CakePHP in your question.
>
>  
>
> AD
>
> -- 
> 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+u...@googlegroups.com .
> To post to this group, send email to cake...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/cake-php.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




RE: Cake or IE9?

2013-06-30 Thread Advantage+
The request is being sent / response via regular ajax view. It works in all
browsers using this approach except IE9. 

I check Firebug Lite in IE and the same request gets sent but it never
returns anything it just sits there with the little spinner in FB lite. 

So that's why I am wondering if it's a cake / ie9 issue or just an issue
with my JS script.

 

   /

   * VIEW METHOD

   * ***

   *

   * 

   * 

   * 

   /

   public function view($slug = null) {

  

  $portfolio = $this->Portfolio->getPortfolioBySlug($slug);

  

  $this->set('portfolio', $portfolio);

  $this->set('neighbors',
$this->Portfolio->getNeighbors($portfolio['Portfolio']['order']));

  

  if ($this->request->is('ajax')) {

 $this->_ajaxSetup(); //prepare for ajax request no
render, set debug 0

 $response = array(

 'html' => $this->render('view', 'ajax')->body(),

 'slide' => $portfolio['Thumb']['0']['slide']);

 $this->_ajaxReturn($response); //returns the json array
/ response

  }

  

   }

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of AD7six
Sent: Sunday, June 30, 2013 9:10 AM
To: cake-php@googlegroups.com
Subject: Re: Cake or IE9?

 



On Sunday, 30 June 2013 05:41:36 UTC+2, advantage+ wrote:

Not sure if this is a Cake issue or just stupid IE.

 

I have a small snip of js code that works in all browsers except IE9.

 

There's no CakePHP in your question.

 

AD

-- 
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.




Localized plugin error: Could not find BrValidation class

2013-06-30 Thread Ribamar FS
Hi!

My Cake - 2.3.6

Download localized plugin and copy  to app/Plugin (Localized)
Add in app/Config/bootstrap.php:
CakePlugin::load('Localized'); 

Add to model:
App::uses('BrValidation', 'Localized.Validation');

Validation:
public $validate = array(
'cpf' => array(
'valid' => array(
'rule' => array('ssn', null, 'br'),
'required' => true,
'message' => 'CPF inválido!'
)
),
);

On try to add a new register receive:

*Warning* (512): Could not find BrValidation class, unable to complete 
validation. [*CORE/Cake/Utility/Validation.php*, line *799*]

Any tip is welcome.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Salesforce Integration

2013-06-30 Thread chris graber
Anyone integrate with Salesforce? I'm trying out several things (PHP 
Toolkit, etc). Looking for a slam dunk solution so I don't have to do 
something fully custom. I need to make a site where users are 
authenticated, but the user/pass are in a Salesforce object. So behind the 
scenes a connection to Salesforce is made and the user info is looked up.

Ideas?

-c

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Get old record in beforeSave when updating (doing a $this->find() inside beforeSave callback)

2013-06-30 Thread AD7six


On Saturday, 29 June 2013 21:14:31 UTC+2, Vanja Dizdarević wrote:
>
> Thanks MorFer, that is a simple solution, but it feels like meddling with 
> Model. At the point of the find, the model is in the save cycle and I don't 
> know what else a find() might change in it.
>
> Btw, *$this->data* AND *$this->id* should be saved. The id *should* stay 
> the same, but you never know. 
>
> This feels cleaner, but I'm wondering about the overhead:
>
> $Model = ClassRegistry::init('User');
> $query = [
>  'recursive' => 0, 
>  'conditions' => [$this->alias.'.'.$this->primaryKey => 
> $this->data[$this->alias][$this->primaryKey]]
> ];
> $oldData = $Model->find('first', $query);
>

If you do that inside the User model - $this and $Model are exactly the 
same object.

AD

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Get old record in beforeSave when updating (doing a $this->find() inside beforeSave callback)

2013-06-30 Thread AD7six


On Saturday, 29 June 2013 19:53:49 UTC+2, Vanja Dizdarević wrote:
>
> When updating a row, I wish to read the "old" data before saving the 
> current record.
>
> Here's a simplified example:
>
> Controller code:
> $this->User->save(['id' => 3, 'username' => 'a-new-username']);
>
> Model code:
> class User extends AppModel {
>public function beforeSave($options){
>//is it an update?
>if (isset($this->data[$this->alias][$this->primaryKey])) {
> //read record
> $oldData = 
> $this->findById($this->data[$this->alias][$this->primaryKey]); 
>   //^^^ here's the problem! ^^^
> if ($oldData[$this->alias]['username_update_count'] >= 3){
>return false;
> }
> else {
>   $this->data[$this->alias]['username_update_count'] = 
> $oldData[$this->alias]['username_update_count'] + 1;
> }
>}
>}
> }
>
> The problem is, that $this->findById (or any other READ operation) fills 
> the current $this->data with the read data
>

If by "READ operation" you mean a find call (you refer to findById - a 
find) - that is quite simply not true.

If you call the method 
Model::read
 however, 
it will populate $this->data.

AD

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Generating multiple 'requests' based on form selections

2013-06-30 Thread David Suna
I think your use of the term "request" is confusing. Do you need the client 
to issue six requests to the server with the various combinations? Or can 
the client issue a single request with all of the information and have the 
server process that as a request for six new records to be created?

If you need to actually issue six separate requests then the way I could 
think of doing it would be using JavaScript. Capture the submit button 
event and then use AJAX calls to issue the separate requests. This is a 
very messy way to do it as you would need to build into the client error 
handling and roll back for partially executed requests.

If you can have the single request then basically all of the work happens 
on the server.  I haven't used CakePHP 1.1 but in 1.3 you could generate an 
array of the model you want to save and call saveAll.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Model::AfterFind $results format, associations

2013-06-30 Thread AD7six


On Saturday, 29 June 2013 10:49:19 UTC+2, Vanja Dizdarević wrote:
>
> Thank you Andy for taking time to write all that!
>
> I should have made my goal clearer, I agree - "what array formats can be 
> expected in the afterFind callback?"
>
> Of course, I am trying to access only the respective model's data in the 
> model.
>
> After reading your answer and writing up a test for all possible 
> associations, find types and different recursions, this is my conclusion:
>
> ### Option 1:
> $results = 
> [
> 'id' => '1',
> 'field1' => 'value1'
> 'HasManyAlias' => [0 => [fields/values...], 1 => 
> [fields/values...], etc..],
> 'BelongsToAlias' => [ 'id' => 2, ...],
> 'hasOne' => [ 'id' => 5, ...]
> ]
>

Please show some code demonstrating this format being received in afterFind.

AD

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Cake or IE9?

2013-06-30 Thread AD7six


On Sunday, 30 June 2013 05:41:36 UTC+2, advantage+ wrote:
>
> Not sure if this is a Cake issue or just stupid IE.
>
>  
>
> I have a small snip of js code that works in all browsers except IE9.
>

There's no CakePHP in your question.

AD

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.