Validate belongsTo model in select element - inList does not seem to work?

2009-02-03 Thread Mickiii

Hi,

I am trying to validate data from an association the I output to the
view like:

$this-set('countries', $this-Customer-Country-find('list'));

and in the view:

echo $form-input('Customer.country'); // Results in select

How would I validate the input of this form? I was thinking I could
use inList, but that does not seem to provide this functionality.

Thanks,

Michael
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Show validationerrors after a redirect

2009-02-02 Thread Mickiii

Hi,

This is probably simple, but I can't find any specifics on it.

I have a controller called ledger_controller, which uses two models:
Ledgeraccount and Ledgertransaction. Within this controller i have a
function called chartofaccounts, which includes a form, with an action
that leads to the ledger controller, but a function called add. I
can save the data alright, and also validate it, but I can't get the
error messages to show... why is that?

Controller ledger:

function add () {
if(!empty($this-data)) {
$this-Ledgeraccount-set($this-data);
if($this-Ledgeraccount-validates()) {
$this-Ledgeraccount-save($this-data, false);
$this-redirect('chartofaccounts');
} else {
$this-Session-setFlash('Venligt ret fejlene 
herunder',
'default', array('class'='bad'));
$this-redirect('chartofaccounts');
}
}
}

Form in chartofaccounts.ctp

?=$form-create('Ledgeraccount', array('url' = '/ledger/add'));?

?
echo $form-input('Ledgeraccount.number');
echo $form-input('Ledgeraccount.name');
echo $form-input('Ledgeraccount.type', array('options' = array(
'header'='Header',
'sum'='Sum',
'profitloss'='Profit Loss',
'balancesheet'='Balancesheet'
)));
?

?=$form-end('Create');?


If this is standard behaviour, then is there any way I can get the
errormessages to show in the chartofaccounts view, without breaking
the conventions too much?

Thanks
--~--~-~--~~~---~--~~
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: Show validationerrors after a redirect

2009-02-02 Thread Mickiii

Thanks Brian, however if I remove the redirect call it displays the
view for the function add, i.e. the add.ctp (which doesnt exists),
but I want it to go back to chartofaccounts where the form is, and
then display the errors there.

On Feb 2, 9:30 pm, brian bally.z...@gmail.com wrote:
 You don't need to redirect. When you do so, the information stored in
 $validationErrors is lost because you're making a new request. If you
 remove the redirect() call, Cake should simply re-display the form.
 Then if all is working well, FormHelper will take care of printing the
 errors for you.

 On Mon, Feb 2, 2009 at 3:23 PM, Mickiii michael.la...@gmail.com wrote:

  Hi,

  This is probably simple, but I can't find any specifics on it.

  I have a controller called ledger_controller, which uses two models:
  Ledgeraccount and Ledgertransaction. Within this controller i have a
  function called chartofaccounts, which includes a form, with an action
  that leads to the ledger controller, but a function called add. I
  can save the data alright, and also validate it, but I can't get the
  error messages to show... why is that?

  Controller ledger:

         function add () {
                 if(!empty($this-data)) {
                         $this-Ledgeraccount-set($this-data);
                         if($this-Ledgeraccount-validates()) {
                                 $this-Ledgeraccount-save($this-data, 
  false);
                                 $this-redirect('chartofaccounts');
                         } else {
                                 $this-Session-setFlash('Venligt ret 
  fejlene herunder',
  'default', array('class'='bad'));
                                 $this-redirect('chartofaccounts');
                         }
                 }
         }

  Form in chartofaccounts.ctp

  ?=$form-create('Ledgeraccount', array('url' = '/ledger/add'));?

  ?
         echo $form-input('Ledgeraccount.number');
         echo $form-input('Ledgeraccount.name');
         echo $form-input('Ledgeraccount.type', array('options' = array(
                 'header'='Header',
                 'sum'='Sum',
                 'profitloss'='Profit Loss',
                 'balancesheet'='Balancesheet'
         )));
  ?

  ?=$form-end('Create');?

  If this is standard behaviour, then is there any way I can get the
  errormessages to show in the chartofaccounts view, without breaking
  the conventions too much?

  Thanks
--~--~-~--~~~---~--~~
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: Show validationerrors after a redirect

2009-02-02 Thread Mickiii

Hang on, I just found this post in the Bakery:
http://bakery.cakephp.org/articles/view/validation-in-another-controller

Does that still apply? Or has there been done anything built in stuff
in the latest version of Cake?

On Feb 2, 9:40 pm, Mickiii michael.la...@gmail.com wrote:
 Thanks Brian, however if I remove the redirect call it displays the
 view for the function add, i.e. the add.ctp (which doesnt exists),
 but I want it to go back to chartofaccounts where the form is, and
 then display the errors there.

 On Feb 2, 9:30 pm, brian bally.z...@gmail.com wrote:

  You don't need to redirect. When you do so, the information stored in
  $validationErrors is lost because you're making a new request. If you
  remove the redirect() call, Cake should simply re-display the form.
  Then if all is working well, FormHelper will take care of printing the
  errors for you.

  On Mon, Feb 2, 2009 at 3:23 PM, Mickiii michael.la...@gmail.com wrote:

   Hi,

   This is probably simple, but I can't find any specifics on it.

   I have a controller called ledger_controller, which uses two models:
   Ledgeraccount and Ledgertransaction. Within this controller i have a
   function called chartofaccounts, which includes a form, with an action
   that leads to the ledger controller, but a function called add. I
   can save the data alright, and also validate it, but I can't get the
   error messages to show... why is that?

   Controller ledger:

          function add () {
                  if(!empty($this-data)) {
                          $this-Ledgeraccount-set($this-data);
                          if($this-Ledgeraccount-validates()) {
                                  $this-Ledgeraccount-save($this-data, 
   false);
                                  $this-redirect('chartofaccounts');
                          } else {
                                  $this-Session-setFlash('Venligt ret 
   fejlene herunder',
   'default', array('class'='bad'));
                                  $this-redirect('chartofaccounts');
                          }
                  }
          }

   Form in chartofaccounts.ctp

   ?=$form-create('Ledgeraccount', array('url' = '/ledger/add'));?

   ?
          echo $form-input('Ledgeraccount.number');
          echo $form-input('Ledgeraccount.name');
          echo $form-input('Ledgeraccount.type', array('options' = array(
                  'header'='Header',
                  'sum'='Sum',
                  'profitloss'='Profit Loss',
                  'balancesheet'='Balancesheet'
          )));
   ?

   ?=$form-end('Create');?

   If this is standard behaviour, then is there any way I can get the
   errormessages to show in the chartofaccounts view, without breaking
   the conventions too much?

   Thanks
--~--~-~--~~~---~--~~
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: Show validationerrors after a redirect

2009-02-02 Thread Mickiii

Miles, is that not what the 'url' option is doing?

On Feb 2, 10:54 pm, Miles J mileswjohn...@gmail.com wrote:
 Just change the url the form is posting to.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Cakephp on MAMP, Mac OSX

2008-12-26 Thread Mickiii

I have tried to search, but I can't seem to find anything that helps
me.

I have installed MAMP server on my mac, running OS X 10.5.5. I have
then set the ports to the default, meaning port 80 for Apache and port
3306 for MySQL. If I now go to localhost, cakephp renders correctly
the initial page, however, when I create controllers, and map them up
in the routes configuration, and try to view them I get a not found
from Apache. I then figured that I needed to enable mod_rewrite on
apache, but it is already enabled.

I have changed the document root in MAMP to /Users/user_name/
Development/my_app.

What am I missing?

Thanks!
--~--~-~--~~~---~--~~
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: Cakephp on MAMP, Mac OSX

2008-12-26 Thread Mickiii

Thanks for your reply, I have checked the httpd.conf located in the
mamp folder /mamp/conf/apache/httpd.conf, and checked for the lines:

LoadModule rewrite_module modules/mod_rewrite.so
DocumentRoot /Users/user_name/Development/my_app and finally that
this directory has AllowOverride set to All

What else can be wrong?

On Dec 26, 10:41 pm, Gwoo gwoo.cake...@gmail.com wrote:
 mod_rewrite needs to be enabled and AllowOverride All in the httpd.conf
--~--~-~--~~~---~--~~
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: Cakephp on MAMP, Mac OSX

2008-12-26 Thread Mickiii

You're right, now it works like a charm. Thanks!

On Dec 26, 11:45 pm, Chad Casselman ccassel...@gmail.com wrote:
 I am running the same setup.  The only problem I ran into was, I extracted
 cake to my download folder and then copied and pasted it to where I wanted
 to code in it.  Little did I know, the .htaccess files did not copy and
 paste even though I grabbed the whole directory.

 Extract cake to where you want to work on it.

 Chad

 On Fri, Dec 26, 2008 at 5:41 PM, Mickiii michael.la...@gmail.com wrote:

  Thanks for your reply, I have checked the httpd.conf located in the
  mamp folder /mamp/conf/apache/httpd.conf, and checked for the lines:

  LoadModule rewrite_module modules/mod_rewrite.so
  DocumentRoot /Users/user_name/Development/my_app and finally that
  this directory has AllowOverride set to All

  What else can be wrong?

  On Dec 26, 10:41 pm, Gwoo gwoo.cake...@gmail.com wrote:
   mod_rewrite needs to be enabled and AllowOverride All in the httpd.conf
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Seperate database for each customer

2008-06-16 Thread Mickiii

Hi,

I am in the process of building and specific business administration
system, where clients subscribe on the application. Initially I
planned on giving each client their own database, and then by
controlling on login, connecting each client to their individual
database. This has worked fine in development, but now I am a bit
confused about the logic in this. My reasoning for doing so was data
security, because that way I would make sure that each client only had
access to their specific database, but I wonder if this is a very
ineffective way of doing things, and I am considering going back to
the method of using one database with a client id seperating it.
My current method would mean that a single server should control
hundreds of databases. What is you oppinion on the best approach?

If I decide to go with the client id approach, is it then possible to
make a global criteria to all queries in cake or should this be done
trough filtered views or similar?

Thanks in advance for your attention and time on this.

Regards,

Michael
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple validation rules in 1.2

2007-06-10 Thread Mickiii

Thanks, you were spot on, I just updated to the latest SVN checkout,
and now it seems to work. Although the new blank rule, instead of the,
soon deprecated, VALID_NOT_EMPTY, still doesnt work.

On 10 Jun., 07:44, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
 On 6/9/07, Mickiii [EMAIL PROTECTED] wrote:

  I have looked 
  athttp://bakery.cakephp.org/articles/view/multiple-rules-of-validation-...
  and it seems as if the above should work, but does'nt

 Ensure that you have the latest checkout from the SVN - it did not
 work for me using the day before's nightly

 HTH
 Tatique

 --
 =
 Cheesecake-Photoblog:http://cheesecake-photoblog.org
 PHP for E-Biz:http://sanisoft.com
 =


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Multiple validation rules in 1.2

2007-06-09 Thread Mickiii

How do I add several validationrules per field? I have tried:

var $validate = array(
'glaccount_no' = array(
array(
'rule' = array('blank'),
'message' = 'test1'
),
array(
'rule' = array('maxLength', 4),
'message' = 'test2'
)
),
'account_type' = array(
array(
'rule' = array('blank'),
'message' = 'test1'
)
),
'glaccount_description' = array(
array(
'rule' = array('blank'),
'message' = 'test1'
)
)
);

I have looked at 
http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-per-field-in-cakephp-1-2
and it seems as if the above should work, but does'nt

Thanks


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Editing thtml files in Dreamweaver

2006-04-12 Thread Mickiii

Did you do this step:


---
1. Make thtml files editable in the design view


- Find the Extensions.txt file in Dreamweaver's Configuration folder
and edit the line


PHP,PHP3,PHP4,PHP5,TPL:PHP Files


to read


PHP,PHP3,PHP4,PHP5,TPL,THTML:PHP Files


This tells DW to treat these files as PHP files, thus applying color
and similar formatting to the syntax.
I use DW 8, and have no problems what so ever, with either the coloring
or the opening of files through doubleclick.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---