Hello All,
Facing 2 issues
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Issue 1
----------
Trying to create a simple form validation using the new 1.2 validation
method.
I want simple not_null input validation on a alphanumeric field..but
when i click on the 'submit' button its simply creating a record with
empty field ..... to implement this validation i have created the code
in the respective model and view files
cause.php (model file)
==================
<?
class Cause extends AppModel {
var $name = 'Cause';
var $hasMany = array('Donor');
var $hasMany1 = array('Donation');
var $displayField = 'cause_title';
var $validate = array(
'cause_title' => VALID_NOT_EMPTY,
'cause_desc' => VALID_NOT_EMPTY
);
} ?>
add.ctp (view file to add a cause record)
===============================
...
...
<legend><?php __('Add Cause');?></legend>
<?php
echo $form->input('cause_title', array('error' => 'VALID Title
plz'));
echo $form->input('cause_des');
echo $form->input('funds_needed');
echo $form->input('funds_collected');
echo $form->input('cause_status');
echo $form->input('cause_snaps');
?>
...
...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Issue 2
----------
Unable to re-create 'controller' through bake (model,controller
created manually)
Im getting the following error
Error: You must have a model for this class to build scaffold methods.
Please try again.
Model already created manually listed below.
<?
class Cause extends AppModel {
var $name = 'Cause';
var $hasMany = array('Donor');
var $hasMany1 = array('Donation');
var $displayField = 'cause_title';
var $validate = array(
'cause_title' => VALID_NOT_EMPTY,
'cause_desc' => VALID_NOT_EMPTY
);
} ?>
Infact we created basic 'scaffolding' controller manually ..
<?
class CausesController extends AppController {
var $name = 'Causes';
var $scaffold;
} ?>
Complete listing of Bake commands
============================
[r...@localhost support11May09]# /opt/lampp/bin/php /opt/lampp/htdocs/
support11May09/cake/console/cake.php bake -app app/
Welcome to CakePHP v1.2.2.8120 Console
---------------------------------------------------------------
App : app
Path: /opt/lampp/htdocs/support11May09/./app
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[Q]uit
What would you like to Bake? (D/M/V/C/P/Q)
> C
---------------------------------------------------------------
Bake Controller
Path: /opt/lampp/htdocs/support11May09/./app/controllers/
---------------------------------------------------------------
Possible Controllers based on your current database:
1. Causes
2. Donations
3. Donors
4. Volunteers
Enter a number from the list above, type in the name of another
controller, or 'q' to exit
[q] > 1
---------------------------------------------------------------
Baking CausesController
---------------------------------------------------------------
Would you like to build your controller interactively?
Warning: Choosing no will overwrite the CausesController. (y/n)
[y] > y
Would you like to use scaffolding? (y/n)
[n] > n
Would you like to include some basic class methods (index(), add(),
view(), edit())? (y/n)
[n] > y
Would you like to create the methods for admin routing? (y/n)
[n] > n
Would you like this controller to use other helpers besides HtmlHelper
and FormHelper? (y/n)
[n] > n
Would you like this controller to use any components? (y/n)
[n] > n
Would you like to use Sessions? (y/n)
[y] > y
Error: You must have a model for this class to build scaffold methods.
Please try again.
[r...@localhost support11May09]#
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please help me out. Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---