Re: Is there any way to display error when working on ajax request?

2013-05-01 Thread Anthony
use debug and tail the debug.log file.

On Wednesday, February 9, 2011 12:43:42 PM UTC-6, cake-learner wrote:
>
> I set up one class to handle all ajax request called ajax_controll. 
> The thing is everytime I develop a function and there is some kind of 
> syntactic errors it returns empty. Usually take a couple of hours to 
> develop 
> one simple query because of this. Is it anyway to spit out the php 
> error on 
> browser( maybe there is firebug plugin? )

-- 
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: Is there any way to display error when working on ajax request?

2011-02-10 Thread Sam Sherlock
I use one of the following

1) Firephp.
http://www.firephp.org

2) What Krissy said

3) sticking vars in an array and using
json_encode(compact('hasThisThingSucceeded', 'isTheFlagFlying'));
so if you project is handling the reponse and looking for content I would
compact a set of vars to the var
that gets returned as content. The you get the output within the page (this
can go wrong, but is sometime helpful)


 - S




On 9 February 2011 18:58, Krissy Masters  wrote:

> I sometimes do a print_r($data); in the view / response code just to see
> whats coming back if im getting noting / errors just so I can "visually"
> see
> something to pin-point whats going wrong, if there is infact data and work
> from there.
>
> Or execute a debug(); exit(); in the function itself right before the save
> or delete so its runs but does not complete the request so I can see if
> everything up to the save / delelte is working and what I have right before
> that.
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
> Behalf
> Of ibejohn818
> Sent: Wednesday, February 09, 2011 3:17 PM
> To: CakePHP
> Subject: Re: Is there any way to display error when working on ajax
> request?
>
> Since your method of request for the action is ajax, I'm assuming it's
> publicly accessible.
>
> So the best way to dev it is thru the browser then apply your ajax
> formatting to the action one you are completed with it.
>
> www.mysite.com/ajax/my_action
>
> On Feb 9, 10:43 am, cake-learner  wrote:
> > I set up one class to handle all ajax request called ajax_controll.
> > The thing is everytime I develop a function and there is some kind of
> > syntactic errors it returns empty. Usually take a couple of hours to
> > develop
> > one simple query because of this. Is it anyway to spit out the php
> > error on
> > browser( maybe there is firebug plugin? )
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at
> http://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


RE: Is there any way to display error when working on ajax request?

2011-02-09 Thread Krissy Masters
I sometimes do a print_r($data); in the view / response code just to see
whats coming back if im getting noting / errors just so I can "visually" see
something to pin-point whats going wrong, if there is infact data and work
from there.

Or execute a debug(); exit(); in the function itself right before the save
or delete so its runs but does not complete the request so I can see if
everything up to the save / delelte is working and what I have right before
that.

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of ibejohn818
Sent: Wednesday, February 09, 2011 3:17 PM
To: CakePHP
Subject: Re: Is there any way to display error when working on ajax request?

Since your method of request for the action is ajax, I'm assuming it's
publicly accessible.

So the best way to dev it is thru the browser then apply your ajax
formatting to the action one you are completed with it.

www.mysite.com/ajax/my_action

On Feb 9, 10:43 am, cake-learner  wrote:
> I set up one class to handle all ajax request called ajax_controll.
> The thing is everytime I develop a function and there is some kind of
> syntactic errors it returns empty. Usually take a couple of hours to
> develop
> one simple query because of this. Is it anyway to spit out the php
> error on
> browser( maybe there is firebug plugin? )

-- 
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Is there any way to display error when working on ajax request?

2011-02-09 Thread ibejohn818
Since your method of request for the action is ajax, I'm assuming it's
publicly accessible.

So the best way to dev it is thru the browser then apply your ajax
formatting to the action one you are completed with it.

www.mysite.com/ajax/my_action

On Feb 9, 10:43 am, cake-learner  wrote:
> I set up one class to handle all ajax request called ajax_controll.
> The thing is everytime I develop a function and there is some kind of
> syntactic errors it returns empty. Usually take a couple of hours to
> develop
> one simple query because of this. Is it anyway to spit out the php
> error on
> browser( maybe there is firebug plugin? )

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Is there any way to display error when working on ajax request?

2011-02-09 Thread cake-learner
I set up one class to handle all ajax request called ajax_controll.
The thing is everytime I develop a function and there is some kind of
syntactic errors it returns empty. Usually take a couple of hours to
develop
one simple query because of this. Is it anyway to spit out the php
error on
browser( maybe there is firebug plugin? )

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Validation (Check If username Exists Display Error Message)

2010-12-18 Thread John Maxim
Thanks guys, I need more time to improve my php/cakephp skills. Like I
said earlier it's not my talent. I have to do this because of a
project. Thanks for teaching !

On Dec 19, 7:12 am, euromark  wrote:
> and if you do use beforeValidate
> dont return false!
>
> you need to return true in order to validate the other fields as well
> cake will automatically stop after the validation as soon as one field
> invalidates
> so there is no reason to abort before that.
>
> On 18 Dez., 20:00, cricket  wrote:
>
> > On Sat, Dec 18, 2010 at 2:47 AM, John Maxim  wrote:
> > > Thanks Solved. But I have a question, with that said, 1.3 version and
> > > the newer--it all seem much easier than the older version, seems like
> > > less codes required...
>
> > > Or is it I'm missing something ?
>
> > > All I have to do is just add in the additional array into my existing
> > > username validation array instead of creating a new function called
> > > beforeValidate(). Am I right ?
>
> > > Just to ensure because I'm quite new to this and I'm programming
> > > challenged. This will help to clarify my upcoming tasks.
>
> > It's just a conceptual misunderstanding. The beforeValidate callback
> > is meant for situations where you might need to either massage the
> > data a bit--or even adjust the model's validation rules--before
> > allowing Cake to validate it according to the model's $validate rules.
> > What your examples were doing, though, is doing the actual validation
> > itself. Instead of using beforeValidate, you should be assigning a
> > custom model method for the entry in $validate for username. However,
> > Cake has some built-in methods for certain common situations. In this
> > case, you can use isUnique.

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Validation (Check If username Exists Display Error Message)

2010-12-18 Thread euromark
and if you do use beforeValidate
dont return false!

you need to return true in order to validate the other fields as well
cake will automatically stop after the validation as soon as one field
invalidates
so there is no reason to abort before that.


On 18 Dez., 20:00, cricket  wrote:
> On Sat, Dec 18, 2010 at 2:47 AM, John Maxim  wrote:
> > Thanks Solved. But I have a question, with that said, 1.3 version and
> > the newer--it all seem much easier than the older version, seems like
> > less codes required...
>
> > Or is it I'm missing something ?
>
> > All I have to do is just add in the additional array into my existing
> > username validation array instead of creating a new function called
> > beforeValidate(). Am I right ?
>
> > Just to ensure because I'm quite new to this and I'm programming
> > challenged. This will help to clarify my upcoming tasks.
>
> It's just a conceptual misunderstanding. The beforeValidate callback
> is meant for situations where you might need to either massage the
> data a bit--or even adjust the model's validation rules--before
> allowing Cake to validate it according to the model's $validate rules.
> What your examples were doing, though, is doing the actual validation
> itself. Instead of using beforeValidate, you should be assigning a
> custom model method for the entry in $validate for username. However,
> Cake has some built-in methods for certain common situations. In this
> case, you can use isUnique.

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Validation (Check If username Exists Display Error Message)

2010-12-18 Thread cricket
On Sat, Dec 18, 2010 at 2:47 AM, John Maxim  wrote:
> Thanks Solved. But I have a question, with that said, 1.3 version and
> the newer--it all seem much easier than the older version, seems like
> less codes required...
>
> Or is it I'm missing something ?
>
> All I have to do is just add in the additional array into my existing
> username validation array instead of creating a new function called
> beforeValidate(). Am I right ?
>
> Just to ensure because I'm quite new to this and I'm programming
> challenged. This will help to clarify my upcoming tasks.

It's just a conceptual misunderstanding. The beforeValidate callback
is meant for situations where you might need to either massage the
data a bit--or even adjust the model's validation rules--before
allowing Cake to validate it according to the model's $validate rules.
What your examples were doing, though, is doing the actual validation
itself. Instead of using beforeValidate, you should be assigning a
custom model method for the entry in $validate for username. However,
Cake has some built-in methods for certain common situations. In this
case, you can use isUnique.

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Validation (Check If username Exists Display Error Message)

2010-12-17 Thread John Maxim
Thanks Solved. But I have a question, with that said, 1.3 version and
the newer--it all seem much easier than the older version, seems like
less codes required...

Or is it I'm missing something ?

All I have to do is just add in the additional array into my existing
username validation array instead of creating a new function called
beforeValidate(). Am I right ?

Just to ensure because I'm quite new to this and I'm programming
challenged. This will help to clarify my upcoming tasks.



On Dec 18, 2:48 am, Stefano Salvatori  wrote:
> cakephp 1.3 has isUnique
>
> http://book.cakephp.org/view/134/Core-Validation-Rules#isUnique-472
>
>
>
> On Fri, Dec 17, 2010 at 2:19 PM, John Maxim  wrote:
> > Hi everyone,
>
> > I have a problem with validation script here:
>
> > ***The first script I used*
>
> > function beforeValidate() {
> >    if (!$this->id) {
> >        if ($this->findCount(array('User.username'
> >                                => $this->data['User']['username'])) > 0) {
> >            $this->invalidate('username_unique');
> >            return false;
> >        }
> >    }
> >    return true;
> > }
>
> > ***The second script I used*
>
> > function beforeValidate() {
> > if (!$this->id) {
> > if ($this->find('count',array('conditions' =>array('User.username' =>
>
> > $this->data))) > 0) {
> > $this->invalidate('username_unique');
> > return false;
> > }
> > }
> > return true;
> > }
>
> > ***
> > Error I get:
> > Warning (512): SQL Error: 1062: Duplicate entry 'James5' for key
> > 'username' [CORE\cake\libs\model\datasources\dbo_source.php, line 684]
>
> > ***
>
> > It was supposed to display the error msg stating the username already
> > taken. I don't know where went wrong... Anyone can shed some light
> > here ?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> --
> Stefano Salvatori M.http://stefano.salvatori.cl/

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Validation (Check If username Exists Display Error Message)

2010-12-17 Thread Stefano Salvatori
cakephp 1.3 has isUnique

http://book.cakephp.org/view/134/Core-Validation-Rules#isUnique-472

On Fri, Dec 17, 2010 at 2:19 PM, John Maxim  wrote:
> Hi everyone,
>
> I have a problem with validation script here:
>
> ***The first script I used*
>
> function beforeValidate() {
>    if (!$this->id) {
>        if ($this->findCount(array('User.username'
>                                => $this->data['User']['username'])) > 0) {
>            $this->invalidate('username_unique');
>            return false;
>        }
>    }
>    return true;
> }
>
> ***The second script I used*
>
> function beforeValidate() {
> if (!$this->id) {
> if ($this->find('count',array('conditions' =>array('User.username' =>
>
> $this->data))) > 0) {
> $this->invalidate('username_unique');
> return false;
> }
> }
> return true;
> }
>
> ***
> Error I get:
> Warning (512): SQL Error: 1062: Duplicate entry 'James5' for key
> 'username' [CORE\cake\libs\model\datasources\dbo_source.php, line 684]
>
> ***
>
> It was supposed to display the error msg stating the username already
> taken. I don't know where went wrong... Anyone can shed some light
> here ?
>
>
>
> 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 cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
>



-- 
Stefano Salvatori M.
http://stefano.salvatori.cl/

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Validation (Check If username Exists Display Error Message)

2010-12-17 Thread John Maxim
Hi everyone,

I have a problem with validation script here:

***The first script I used*

function beforeValidate() {
if (!$this->id) {
if ($this->findCount(array('User.username'
=> $this->data['User']['username'])) > 0) {
$this->invalidate('username_unique');
return false;
}
}
return true;
}

***The second script I used*

function beforeValidate() {
if (!$this->id) {
if ($this->find('count',array('conditions' =>array('User.username' =>

$this->data))) > 0) {
$this->invalidate('username_unique');
return false;
}
}
return true;
}

***
Error I get:
Warning (512): SQL Error: 1062: Duplicate entry 'James5' for key
'username' [CORE\cake\libs\model\datasources\dbo_source.php, line 684]

***

It was supposed to display the error msg stating the username already
taken. I don't know where went wrong... Anyone can shed some light
here ?



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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


RE: Display Error

2009-09-29 Thread Dave Maharaj :: WidePixels.com

Right on thanks!

Dave 

-Original Message-
From: Marcelo Andrade [mailto:mfandr...@gmail.com] 
Sent: September-29-09 12:18 PM
To: cake-php@googlegroups.com
Subject: Re: Display Error


On Tue, Sep 29, 2009 at 12:34 AM, Dave Maharaj :: WidePixels.com
 wrote:
> I need to place an error in a specific spot so I used the
>
> error($model . $field); ?>
>
> But the error shows up in 2 places now. Where I have my error code and 
> beside the field. How can I remove it from the field so it only 
> displays in the spot i want?

$form->input make an internal call to $form->error by default.
As John said, if you're using $form->input, you must to set "'error'=>
false" in the options.

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105



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



Re: Display Error

2009-09-29 Thread Marcelo Andrade

On Tue, Sep 29, 2009 at 12:34 AM, Dave Maharaj :: WidePixels.com
 wrote:
> I need to place an error in a specific spot so I used the
>
> error($model . $field); ?>
>
> But the error shows up in 2 places now. Where I have my error code and
> beside the field. How can I remove it from the field so it only displays in
> the spot i want?

$form->input make an internal call to $form->error by default.
As John said, if you're using $form->input, you must to set
"'error'=> false" in the options.

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

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



Re: Display Error

2009-09-28 Thread John Andersen

Set the option for error to false in the field, that you don't want
the error to be displayed!
Enjoy,
   John

On Sep 29, 6:34 am, "Dave Maharaj :: WidePixels.com"
 wrote:
> I need to place an error in a specific spot so I used the
>
> error($model . $field); ?>
>
> But the error shows up in 2 places now. Where I have my error code and
> beside the field. How can I remove it from the field so it only displays in
> the spot i want?
>
> Thanks,
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Display Error

2009-09-28 Thread Dave Maharaj :: WidePixels.com
I need to place an error in a specific spot so I used the 
 
error($model . $field); ?> 
 
But the error shows up in 2 places now. Where I have my error code and
beside the field. How can I remove it from the field so it only displays in
the spot i want?
 
Thanks,
 
Dave

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



Re: How to display error (when saving data)?

2007-10-27 Thread francky06l

This is totally up to you. You could store the errors in a file and
later when visitor logs in, show the content of the file.
I do something similar, and I Email the errors as a part of a
"report", I also have a "batch" model where I store all informations
about this background process (ie: time, input data (as compressed
blob), output etc ...)

Hope this helps

On Oct 26, 6:49 pm, Steveston <[EMAIL PROTECTED]> wrote:
> Hello!
>
> When saving data via a form, I can use $html->tagErrorMsg (along with
> invalidate function & model validation) to display error message.
>
> However, if I am not saving data via a form, how shall I display error
> message?
>
> For example, instead of adding one by form, I am adding many records
> by importing a csv file. Some records violates validation, some
> records are duplicate, etc. How shall I do to display error message to
> visitors (on View page)?
>
> Thank you very much


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to display error (when saving data)?

2007-10-26 Thread Steveston

Hello!

When saving data via a form, I can use $html->tagErrorMsg (along with
invalidate function & model validation) to display error message.

However, if I am not saving data via a form, how shall I display error
message?

For example, instead of adding one by form, I am adding many records
by importing a csv file. Some records violates validation, some
records are duplicate, etc. How shall I do to display error message to
visitors (on View page)?

Thank you very much


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---