Re: Variable state through multiple Ajax requests (ModalBox) including forms

2009-01-13 Thread WebbedIT

Siegfried,

I've used that very useful article to get my head around the basics
and I have then move on some distance since then.

That article only deals with opening a form and submitting it showing
any error then having it close if no errors.  What I have created is a
whole controller's worth of actions within a single modal window
(Index, Add, Edit, Delete).

In my opinion I have also implemented ModalBox much better by
adjusting how links and forms are submitted within the window so that
ModalBox does the hard work of displaying the spinner whilst the
content is updated and then resizes the window to accommodate the new
content (namely doing away with the ajax-form() and $ajax-link
commands, which are shortcuts to prototype ajax calls, in favour of an
onclick event calling Modalbox.show()).  This does away with the
requirement for custom javascript functions such as the suggested
closeModalbox().

I plan to write an article about this myself and run it past the
author of the above article when I have got my issues resolved.

So back to the original question ... how is form data stored in
between Ajax calls so that even after clearing $this-data it is
reappears when next calling a form-type action (add or edit)?

Regards,

Paul.
--~--~-~--~~~---~--~~
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: Variable state through multiple Ajax requests (ModalBox) including forms

2009-01-13 Thread Chad Casselman
I would love to see what you have done and your code.  I am trying to expand
my use of the modal box but not having much luck.  Looking forward to it.

Chad



On Tue, Jan 13, 2009 at 12:25 PM, WebbedIT p...@webbedit.co.uk wrote:


 Siegfried,

 I've used that very useful article to get my head around the basics
 and I have then move on some distance since then.

 That article only deals with opening a form and submitting it showing
 any error then having it close if no errors.  What I have created is a
 whole controller's worth of actions within a single modal window
 (Index, Add, Edit, Delete).

 In my opinion I have also implemented ModalBox much better by
 adjusting how links and forms are submitted within the window so that
 ModalBox does the hard work of displaying the spinner whilst the
 content is updated and then resizes the window to accommodate the new
 content (namely doing away with the ajax-form() and $ajax-link
 commands, which are shortcuts to prototype ajax calls, in favour of an
 onclick event calling Modalbox.show()).  This does away with the
 requirement for custom javascript functions such as the suggested
 closeModalbox().

 I plan to write an article about this myself and run it past the
 author of the above article when I have got my issues resolved.

 So back to the original question ... how is form data stored in
 between Ajax calls so that even after clearing $this-data it is
 reappears when next calling a form-type action (add or edit)?

 Regards,

 Paul.
 


--~--~-~--~~~---~--~~
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: Variable state through multiple Ajax requests (ModalBox) including forms

2009-01-13 Thread WebbedIT

Would love to share what I have learnt, but would prefer to do so
after I have a fully working example.  I will also provide a demo of
it in use the way I am using it as it is quite neat and should be
something most people could use.  Also I can get some feedback on it's
positives and negatives that way.

Need an answer to this issue though ... time to go look at the source
code to figure out how $_POST variables are transferred to $this-data
to see what I am missing.

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



Multiple forms per page, field IDs need to be unique

2009-01-12 Thread Chris Hawes

Hello,

I'm currently working on an e-commerce application.

On the product pages, I am generating a form to add products to the
cart. As such, each page can contain several forms.

I've created a helper for my application which contains: product
display; add to cart form generation; menu generation for the cms;
etc.

My helper uses the Form and HTML helpers.

Each form I create has the same ID (CartAddForm) as each form has the
same action.
Also, each field within the form shares the same ID with the form
elements in the other forms (eg. CartProductDescription).

As such, the pages fail validation.

Can anyone immediately think of a way around this?

Thanks,

Chris.

--~--~-~--~~~---~--~~
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: Multiple forms per page, field IDs need to be unique

2009-01-12 Thread Rogelio Nodal
I'm new to CakePHP(day of reading documentation is pretty much my
experience) but If it was me doing it I would instead of using forms I would
just add links in the form /produtcs/addtocart/45 or
/products/addtocart/VeryNiceProduct and then use the flash function to
redirect back to the products page noting which products are added to the
cart. Like I said before I am very new to CakePHP so I may be completly off.
Could someone please give me so feedback on my idea. I would like to know if
my idea makes sense just in case I find myself in the same position. Thanks.

On Mon, Jan 12, 2009 at 6:05 AM, Chris Hawes m...@chrishawes.net wrote:


 Hello,

 I'm currently working on an e-commerce application.

 On the product pages, I am generating a form to add products to the
 cart. As such, each page can contain several forms.

 I've created a helper for my application which contains: product
 display; add to cart form generation; menu generation for the cms;
 etc.

 My helper uses the Form and HTML helpers.

 Each form I create has the same ID (CartAddForm) as each form has the
 same action.
 Also, each field within the form shares the same ID with the form
 elements in the other forms (eg. CartProductDescription).

 As such, the pages fail validation.

 Can anyone immediately think of a way around this?

 Thanks,

 Chris.

 



-- 
Rogelio Nodal

--~--~-~--~~~---~--~~
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: Multiple forms per page, field IDs need to be unique

2009-01-12 Thread brian

What Rogelio said. And, if you prefer buttons to links, you can always
use javascript to swap your links for buttons. This would be a snap
with jQuery.

On Mon, Jan 12, 2009 at 12:34 PM, Rogelio Nodal rno...@gmail.com wrote:
 I'm new to CakePHP(day of reading documentation is pretty much my
 experience) but If it was me doing it I would instead of using forms I would
 just add links in the form /produtcs/addtocart/45 or
 /products/addtocart/VeryNiceProduct and then use the flash function to
 redirect back to the products page noting which products are added to the
 cart. Like I said before I am very new to CakePHP so I may be completly off.
 Could someone please give me so feedback on my idea. I would like to know if
 my idea makes sense just in case I find myself in the same position. Thanks.

 On Mon, Jan 12, 2009 at 6:05 AM, Chris Hawes m...@chrishawes.net wrote:

 Hello,

 I'm currently working on an e-commerce application.

 On the product pages, I am generating a form to add products to the
 cart. As such, each page can contain several forms.

 I've created a helper for my application which contains: product
 display; add to cart form generation; menu generation for the cms;
 etc.

 My helper uses the Form and HTML helpers.

 Each form I create has the same ID (CartAddForm) as each form has the
 same action.
 Also, each field within the form shares the same ID with the form
 elements in the other forms (eg. CartProductDescription).

 As such, the pages fail validation.

 Can anyone immediately think of a way around this?

 Thanks,

 Chris.





 --
 Rogelio Nodal

 


--~--~-~--~~~---~--~~
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: Multiple forms per page, field IDs need to be unique

2009-01-12 Thread mark_story

specify the id attribute?

-Mark

On Jan 12, 6:05 am, Chris Hawes m...@chrishawes.net wrote:
 Hello,

 I'm currently working on an e-commerce application.

 On the product pages, I am generating a form to add products to the
 cart. As such, each page can contain several forms.

 I've created a helper for my application which contains: product
 display; add to cart form generation; menu generation for the cms;
 etc.

 My helper uses the Form and HTML helpers.

 Each form I create has the same ID (CartAddForm) as each form has the
 same action.
 Also, each field within the form shares the same ID with the form
 elements in the other forms (eg. CartProductDescription).

 As such, the pages fail validation.

 Can anyone immediately think of a way around this?

 Thanks,

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



set checkboxes on multiple forms

2009-01-02 Thread brian

I have an admin_index page for a model that requires a listing for
each row, which includes a *separate* form with a couple of
checkboxes. The controller action is:

public function admin_index()
{
$this-data = $this-paginate();
}

Now, in the view, I cannot figure out how to get the FormHelper to
properly set the checked attribute on these checkboxes. Why doesn't
this work?

(I'm not interested in editing multiple records with a single form, btw.)

foreach($this-data as $k = $foo)
{
?
?= $form-create('Foo', array('action' = 'edit')) ?
?= $form-hidden(Foo.${k}.id) ?
table
tr
td
?= $foo['User']['label'] ?
(?= $foo['User']['id'] ?)
/td
td
?= $form-input(Foo.${k}.something) ?
/td
td
?= $form-input(Foo.${k}.something_else) ?
/td
td
?= $form-submit('edit') ?
/td
/tr
/table
?= $form-end() ?

I thought FormHelper was able to do this if $this-data is set. I know
that I can just type out the form markup, but ...

--~--~-~--~~~---~--~~
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: set checkboxes on multiple forms

2009-01-02 Thread brian

On Fri, Jan 2, 2009 at 11:53 PM, brian bally.z...@gmail.com wrote:
 I have an admin_index page for a model that requires a listing for
 each row, which includes a *separate* form with a couple of
 checkboxes. The controller action is:

 public function admin_index()
 {
$this-data = $this-paginate();
 }

 Now, in the view, I cannot figure out how to get the FormHelper to
 properly set the checked attribute on these checkboxes. Why doesn't
 this work?

 (I'm not interested in editing multiple records with a single form, btw.)

 foreach($this-data as $k = $foo)
 {
 ?
 ?= $form-create('Foo', array('action' = 'edit')) ?
 ?= $form-hidden(Foo.${k}.id) ?
 table
tr
td
?= $foo['User']['label'] ?
(?= $foo['User']['id'] ?)
/td
td
?= $form-input(Foo.${k}.something) ?
/td
td
?= $form-input(Foo.${k}.something_else) ?
/td
td
?= $form-submit('edit') ?
/td
/tr
 /table
 ?= $form-end() ?

 I thought FormHelper was able to do this if $this-data is set. I know
 that I can just type out the form markup, but ...


I just clued in to the fact that the data array was in the wrong form.
I'm using contain to grab the User's name info and the array looked
like:

Array
(
[0] = Array
(
[Foo] = Array
(
[id] = 1
[bar] = 1
[another_field] = 0
[user_id] = 3
)

[User] = Array
(
[first_name] = ...
[last_name] = ...
[organisation_name] = ...
[id] = 3
[label] = ...
)

)
...

Of course, I need:

Array
(
[Foo] = Array
(
[0] = Array
(
[first_name] = ...
[last_name] = ...
[organisation_name] = ...
[id] = 1
[label] = ...
[bar] = 1
[another_field] = 0
[user_id] = 3
)
...

I solved it by using the most excellent Set class.

$tmp = $this-paginate();

$this-data['Foo'] = Set::merge(
Set::extract($tmp, '{n}.User'),
Set::extract($tmp, '{n}.Foo')
);
unset($tmp);

I had to put the User extraction first in the merge params so that
Foo-id wouldn't get clobbered because contain grabs User-id even if
it's not in the fields list.

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



Security component and AJAX forms

2009-01-01 Thread archF6

I am using the Security component, and it works great, except when I
load a form via AJAX, the token fields are not being written in the
form.  I'm using the form helper.  Also note the action that renders
the form is in a different controller, so not sure if that's part of
the problem.

I can use the blackhole callback to circumvent the issue by
determining controller name and action, but would prefer to keep
security component enabled for these forms if possible.

The reason for such an approach is this...
Basically a blog with comments, but product developers want people to
write their blog post, then login if the email address they provide
exists in our database.  Therefore I have a Posts controller with a
form asking for email and comment.  If email address is in database,
load a Users controller action to login by providing password.
Otherwise, create a light registration process that also resides in
the Users controller.

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



How to make forms in cakephp

2008-12-23 Thread mona

I m new to cake php i want to make form in cakephp and i make the
following things
class User extends AppModel {

var $name = 'User';

 var $validate = array(
 'name'=array('rule'='notEmpty'),
 'email'=array('rule'='email'),
 'password'=array(
  'Cannot be empty' = array('rule'='notEmpty'),
'Must be at least 4 chars' = array('rule'=array
('minLength', 4))
 )
   );
 }
This is my model and i saved as a user.php
and my controller is
  class UsersController extends AppController {

var $name = 'Users';
var $components = array('Security');

function add() {
 if(!empty($this-data)) {
$this-User-save($this-data);
}
  }
 }

and then i create a view for add action
echo $form-create();
echo $form-inputs(array('name', 'email', 'password'));
echo $form-end('Register');
but it is creating error can anybody tell me why it is creating a
error please correct it

--~--~-~--~~~---~--~~
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 make forms in cakephp

2008-12-23 Thread eMarcus

Hi Mona,

Well, it would help if you could specify the error a bit more. The
form need to be called 'app/views/users/add.ctp'.

I don't know if you can make echo $form-inputs(array('name',
'email', 'password'));

I would rather do:
  echo $form-input('User.name');
  echo $form-input('User.password', array ('type' = 'password));
  echo $form-input('User.email');

bye
me.


On Dec 23, 3:17 pm, mona poojapinj...@gmail.com wrote:
 I m new to cake php i want to make form in cakephp and i make the
 following things
     class User extends AppModel {

         var $name = 'User';

      var $validate = array(
          'name'=array('rule'='notEmpty'),
          'email'=array('rule'='email'),
          'password'=array(
                   'Cannot be empty' = array('rule'='notEmpty'),
                 'Must be at least 4 chars' = array('rule'=array
 ('minLength', 4))
          )
        );
  }
 This is my model and i saved as a user.php
 and my controller is
   class UsersController extends AppController {

     var $name = 'Users';
     var $components = array('Security');

     function add() {
          if(!empty($this-data)) {
             $this-User-save($this-data);
         }
       }
  }

 and then i create a view for add action
     echo $form-create();
     echo $form-inputs(array('name', 'email', 'password'));
     echo $form-end('Register');
 but it is creating error can anybody tell me why it is creating a
 error please correct it
--~--~-~--~~~---~--~~
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: cake 1.2 forms: date fields left empty = null in database?

2008-12-18 Thread Sebastian Göttschkes

Hi,

thanks for your reply. The data field was set to null before. If I
update a dataset and assigning the null value to a the birthday field
(SET birthday=null) it works fine. So I added the following code to my
controller:
if(empty($this-data['Employee']['birthday']))
$this-data['Employee']['birthday'] = null;
This works fine, but I'm not sure if this is the proper way to do it?

Regards,
Sebastian

On 16 Dez., 15:13, Alexandru Ciobanu ics.cake...@gmail.com wrote:
 Sebastian Göttschkes wrote:
  Hi,

  i got the following problem using cakePHP 1.2 RC3:

  My Model 'Employee' has a attribute called 'birthday' (datatype:
  DATE). In the add-view, I have the following code:
  ?= $form-input('birthday',array('type'='text'));?
  If i left this field blank when adding an employee, this employee has
  the birthday '-00-00' saved in the database. I would rather like
  the birthday having the null-value, because -00-00 is no valid
  birthday.

 Set the date field to NULL
 |ALTER TABLE `employees` CHANGE `birthday` `birthday` DATE NULL;

 IIRC

 HTH
 |
--~--~-~--~~~---~--~~
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: cake 1.2 forms: date fields left empty = null in database?

2008-12-17 Thread Adriano Varoli Piazza

On 16 dic, 11:44, Sebastian Göttschkes sebastian.goettsch...@mpx-
e.de wrote:
 Additionally, if I add a valid birthday, it is saved correctly. When
 editing the employee, I would like to get the birthday viewed in the
 format dd.mm.. How can I tell cake to view the birthday like this?

Ok, here's what I've done:

in the Obras edit / add view:

echo $html-div('input select',
$form-label('fecha_creacion', 'Fecha de Creación')
.
$form-day('fecha_creacion', null, array(), '---')
. ' - ' .
$form-month('fecha_creacion', null, array(), '---')
. ' - ' .
$form-year('fecha_creacion', 1600, date('Y'), null, array(),
false)
);

This shows the div, a label and three select fields for day, month,
year, separated by ' - ', with the year between 1600 and the current
year, and day and month optional (these are the dates in which works
of art were made, and sometimes the date is not exact).

On the Obras controller, before saving:

$tmp = $this-data['Obra']['fecha_creacion'];
$this-data['Obra']['fecha_creacion'] = $tmp['year']; // year is
mandatory
if ($tmp['month']) {
$this-data['Obra']['fecha_creacion'] .= '-' . $tmp['month'];
if ($tmp['day']) {  // only if they selected a month
$this-data['Obra']['fecha_creacion'] .= '-' . $tmp['day'];
}
}

HTH
--
Saludos
Adriano
--~--~-~--~~~---~--~~
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: cake 1.2 forms: date fields left empty = null in database?

2008-12-16 Thread Alexandru Ciobanu

Sebastian Göttschkes wrote:
 Hi,

 i got the following problem using cakePHP 1.2 RC3:

 My Model 'Employee' has a attribute called 'birthday' (datatype:
 DATE). In the add-view, I have the following code:
 ?= $form-input('birthday',array('type'='text'));?
 If i left this field blank when adding an employee, this employee has
 the birthday '-00-00' saved in the database. I would rather like
 the birthday having the null-value, because -00-00 is no valid
 birthday.

   
Set the date field to NULL
|ALTER TABLE `employees` CHANGE `birthday` `birthday` DATE NULL;

IIRC

HTH
|

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



AW: cake 1.2 forms: date fields left empty = null in database?

2008-12-16 Thread Liebermann, Anja Carolin

 
Hi Sebastian,

You have to format the date for your view. If this is really woth the effort. I 
had a similar problem in a non cake Project.

I played around with 
$dateold = date(d.m.Y,strtotime($datefoo));
And
$datefoo= date(Y-m-d, strtotime(-$n day));

Hope that helps. Be careful what format to validate!

Anja


-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag 
von Sebastian Göttschkes
Gesendet: Dienstag, 16. Dezember 2008 14:45
An: CakePHP
Betreff: cake 1.2 forms: date fields left empty = null in database?


Hi,

i got the following problem using cakePHP 1.2 RC3:

My Model 'Employee' has a attribute called 'birthday' (datatype:
DATE). In the add-view, I have the following code:
?= $form-input('birthday',array('type'='text'));?
If i left this field blank when adding an employee, this employee has the 
birthday '-00-00' saved in the database. I would rather like the birthday 
having the null-value, because -00-00 is no valid birthday.

Additionally, if I add a valid birthday, it is saved correctly. When editing 
the employee, I would like to get the birthday viewed in the format dd.mm.. 
How can I tell cake to view the birthday like this?

I hope you guys can help me.

Thanks in advance,
Regards,
Sebastian


--~--~-~--~~~---~--~~
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: cake 1.2 forms: date fields left empty = null in database?

2008-12-16 Thread Adriano Varoli Piazza

I am in the process of editing my views to get a similar effect. If
you can wait a couple hours, I'll be back with an explanation.

But, to whet your appetite: controlling for '-00-00' is not that
different from controlling for null, seems to me. '-00-00' is the
'null value' for a date field. I have the problem of dates that can be
full, or just years, or just years and months, so I can't use a date
field at all, and have to validate my dates otherwise.

Basically, to edit the date fields as you like, you have to process
them before saving in the edit method, filling up the $this-data
['yourdatefield'] with a valid date from what you got. For example:
in the view, you have three inputs type='text' name='dateday',
name='datemonth', name='dateyear'
in the action, get the date fields and process them saving each value
to your $this-data['yourdatefield'] as a full '-mm-dd' string.

Plus, you should also set the variable at the end of the edit action
doing the opposite action, so the dates to be modified should be
exploded and set to 'dateday', etc.

I hope I'm not making any mistaeks.

Cheers,

On 16 dic, 11:44, Sebastian Göttschkes sebastian.goettsch...@mpx-
e.de wrote:
 Hi,

 i got the following problem using cakePHP 1.2 RC3:

 My Model 'Employee' has a attribute called 'birthday' (datatype:
 DATE). In the add-view, I have the following code:
 ?= $form-input('birthday',array('type'='text'));?
 If i left this field blank when adding an employee, this employee has
 the birthday '-00-00' saved in the database. I would rather like
 the birthday having the null-value, because -00-00 is no valid
 birthday.

 Additionally, if I add a valid birthday, it is saved correctly. When
 editing the employee, I would like to get the birthday viewed in the
 format dd.mm.. How can I tell cake to view the birthday like this?

 I hope you guys can help me.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



cake 1.2 forms: date fields left empty = null in database?

2008-12-16 Thread Sebastian Göttschkes

Hi,

i got the following problem using cakePHP 1.2 RC3:

My Model 'Employee' has a attribute called 'birthday' (datatype:
DATE). In the add-view, I have the following code:
?= $form-input('birthday',array('type'='text'));?
If i left this field blank when adding an employee, this employee has
the birthday '-00-00' saved in the database. I would rather like
the birthday having the null-value, because -00-00 is no valid
birthday.

Additionally, if I add a valid birthday, it is saved correctly. When
editing the employee, I would like to get the birthday viewed in the
format dd.mm.. How can I tell cake to view the birthday like this?

I hope you guys can help me.

Thanks in advance,
Regards,
Sebastian
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Prepopulating forms via the URL

2008-12-15 Thread acoustic_overdrive

I just thought of a little function that I wanted to get some feedback
on. It's a way to pre-populate a form when adding new records, using
the URL only and no controller-specific controller logic.

In AppController::beforeRender :

if(isset($_REQUEST['populate'])) {
if(empty($this-data)) {
$this-data = array();
}
$this-data = array_merge_recursive($this-data,$_REQUEST
['populate']);
}

then make a link pointing to an ADD form:

/admin/project_images/add?populate[ProjectImage][project_id]=3populate
[ProjectImage][name]=blah

What do you think? Not very cakey with that querystring but is there a
better way to do this?

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: Prepopulating forms via the URL

2008-12-15 Thread Alexandru Ciobanu

acoustic_overdrive wrote:
 I just thought of a little function that I wanted to get some feedback
 on. It's a way to pre-populate a form when adding new records, using
 the URL only and no controller-specific controller logic.

 In AppController::beforeRender :

 if(isset($_REQUEST['populate'])) {
   if(empty($this-data)) {
   $this-data = array();
   }
   $this-data = array_merge_recursive($this-data,$_REQUEST
 ['populate']);
 }

 then make a link pointing to an ADD form:

 /admin/project_images/add?populate[ProjectImage][project_id]=3populate
 [ProjectImage][name]=blah

 What do you think? Not very cakey with that querystring but is there a
 better way to do this?

   
?= $form-input('ProjectImage.project_id', array('value' = '3'));?
?= $form-input('ProjectImage.name', array('value' = 'blah'));?



--~--~-~--~~~---~--~~
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: Prepopulating forms via the URL

2008-12-15 Thread brian

On Mon, Dec 15, 2008 at 1:18 PM, acoustic_overdrive
jamierm...@googlemail.com wrote:

 I just thought of a little function that I wanted to get some feedback
 on. It's a way to pre-populate a form when adding new records, using
 the URL only and no controller-specific controller logic.

 In AppController::beforeRender :

 if(isset($_REQUEST['populate'])) {
if(empty($this-data)) {
$this-data = array();
}
$this-data = array_merge_recursive($this-data,$_REQUEST
 ['populate']);
 }

 then make a link pointing to an ADD form:

 /admin/project_images/add?populate[ProjectImage][project_id]=3populate
 [ProjectImage][name]=blah

 What do you think? Not very cakey with that querystring but is there a
 better way to do this?


Why not just pass the Project.id (I'm assuming this request is coming
from a Project page) and fetch and add any data to $this-data in your
add() method?

--~--~-~--~~~---~--~~
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: Prepopulating forms via the URL

2008-12-15 Thread acoustic_overdrive

Hi, thanks both for your replies.

@Alexandru: Unfortunately that's not flexible enough for me, because
depending on where I'm coming from I may or may not want to pre-
populate a field.

@brian: I usually do it something like /project_images/add/project_id:
3 but that means I have to write logic at the URL generation stage and
also at the controller method stage, but with the code above I only
have to think about it at the URL generation stage, less room for
error I think (and faster)!






On Dec 15, 6:32 pm, brian bally.z...@gmail.com wrote:
 On Mon, Dec 15, 2008 at 1:18 PM, acoustic_overdrive



 jamierm...@googlemail.com wrote:

  I just thought of a little function that I wanted to get some feedback
  on. It's a way to pre-populate a form when adding new records, using
  the URL only and no controller-specific controller logic.

  In AppController::beforeRender :

  if(isset($_REQUEST['populate'])) {
         if(empty($this-data)) {
                 $this-data = array();
         }
         $this-data = array_merge_recursive($this-data,$_REQUEST
  ['populate']);
  }

  then make a link pointing to an ADD form:

  /admin/project_images/add?populate[ProjectImage][project_id]=3populate
  [ProjectImage][name]=blah

  What do you think? Not very cakey with that querystring but is there a
  better way to do this?

 Why not just pass the Project.id (I'm assuming this request is coming
 from a Project page) and fetch and add any data to $this-data in your
 add() method?
--~--~-~--~~~---~--~~
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: Managing empty data in forms with associations

2008-12-09 Thread majna

Maybe you can use
$this-data['Users'] = Set::filter($this-data['Users']);


On Dec 8, 8:52 pm, variaas [EMAIL PROTECTED] wrote:
 Does CakePHP have a function to clear out empty datarows before
 saving? Right now I manually parse the array to see if there is an
 empty array and unset it.

 So given this array:

 [data] =
  [0]       =
   [name] = 'alice'
  [1]       =
   [name] = 'bob'
  [2]       =
   [name] = ''

 I would unset [data][2] and then call the save method. I just wanted
 to make sure I'm not re-inventing a wheel available in CakePHP.
--~--~-~--~~~---~--~~
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: adding info from forms to more then one table

2008-12-09 Thread webscriptz

I was thinking like this:

function add() {
if (!empty($this-data)) {
$this-Timespan-create();
if ($this-Timespan-save($this-data)) {
$this-data['Timespan']['saldo'] = 
$this-data['Timespan']
['saldo'] + $this-data['Record']['saldo'];
$this-data['Timespan']['credit'] = 
$this-data['Timespan']
['credit'] +$this-data['Record']['credit'];
$this-Session-setFlash(__('The Timespan has 
been saved', true));
$this-redirect(array('action'='index'));
} else {
$this-Session-setFlash(__('The Timespan could 
not be saved.
Please, try again.', true));
}
}
$years = $this-Timespan-Year-find('list');
$this-set(compact('years'));
}

but it doesn't work and i'm sorry to say but Rob, you solution, even
after adaptation, doesn't work.

On Dec 2, 4:46 pm, Rob [EMAIL PROTECTED] wrote:
 I would suggest looking at saveAll to do the save part, then to do
 your addition you just need to make sure it's in the data.

 That said, here's the way I handle adding a related record as shown in
 your add() above:

 function add() {
                 if (!empty($this-data)) {
                         $this-Record-create();
                         if ($this-Record-save($this-data)) {
                             $this-data['Timespan']['record_id'] =
 $this-Record-getLastInsertId();
                             $this-data['Timespan']['debet'] = 
 $this-data['Record']['debet'];

                             $this-data['Timespan']['credit'] = 
 $this-data['Record']['credit'];

                             if ($this-Record-Timespan-save($this-data)){

                                $this-Session-setFlash(__('The Record
 has been saved', true));
                                 $this-redirect(array
 ('action'='index'));
                                } else {
                                  $this-Session-setFlash(__('The
 Timespan could not be saved.',true));
                                }
                         } else {
                                 $this-Session-setFlash(__('The
 Record could not be saved.
 Please, try again.', true));
                         }
                 }

 And for places that you expect an update, you would just do your
 calculation and do a 'saveAll($this-data)'

 On Dec 2, 2:14 am,webscriptz[EMAIL PROTECTED] wrote:

  normally i would read it out with php, put them in vars and addition
  the values and resave them.

  On Dec 2, 10:49 am,webscriptz[EMAIL PROTECTED] wrote:

   Sorry for that,

   I have a model Records and Timespans. DEBET and CREDIT have to be
   inserted in the records table but also in the Timespans table in DEBET
   and CREDIT
   The first is not a problem but the second is. IT has to be additioned
   not just replaced by the latest.

   function add() {
                   if (!empty($this-data)) {
                           $this-Record-create();
                           if ($this-Record-save($this-data)) {
                                   $this-Session-setFlash(__('The Record 
   has been saved', true));
                                   $this-redirect(array('action'='index'));
                           } else {
                                   $this-Session-setFlash(__('The Record 
   could not be saved.
   Please, try again.', true));
                           }
                   }
                   $timespans = $this-Record-Timespan-find('list');
                   $this-set(compact('timespans'));

   what do I have to reference to where in fact I didn't quit get that
   and do I have to change something in the view also?

   Thanks,

   - Tim

   On Dec 1, 9:40 pm, Rob [EMAIL PROTECTED] wrote:

So just a suggestion for future questions, describe the tables and
their relationship in your question a little next time.

Assuming you have a Records model and a Timespans model that are
related to each other, and the relationships are described in the
models for those two entities ...

So, for example if you want to add the values from a Record to the
values in the related Timespan, you would reference the $this-Record
and $this-Record-Timespan

On Dec 1, 1:45 am,webscriptz[EMAIL PROTECTED] wrote:

 I'm making a register and I have a small problem,

 I want two numbers to be additioned (+) with the numbers already in an
 other table, unfortunantly I don't know how to do this.

 i have a Record with debet and credit and i want to addition them
 to debet and credit in timespans.

 but they got controller  model records

 please help,

 Tim De Smedt
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.

Re: adding info from forms to more then one table

2008-12-09 Thread webscriptz

I'm going to give a better description of the problem

When I add a record the data will be stored in the records table of my
database what I want to do is:

When my records is saved the system should do something like this,
when it's saved

call the timespan that is selected, load the saldo debet credit from
timespan and do this following:

timespan credit = timespan credit +
record credit
timespan debet = timespan debet +
record credit

this should be used in the view:

timespan saldo = previous timespan +
(timespan credit - timespan debet)

my problem is that this should be happening in the view at the time I
ask timespan to show all my related records.

plz help me, I really have no idea of how to do this.

Tim

On Dec 2, 4:46 pm, Rob [EMAIL PROTECTED] wrote:
 I would suggest looking at saveAll to do the save part, then to do
 your addition you just need to make sure it's in the data.

 That said, here's the way I handle adding a related record as shown in
 your add() above:

 function add() {
                 if (!empty($this-data)) {
                         $this-Record-create();
                         if ($this-Record-save($this-data)) {
                             $this-data['Timespan']['record_id'] =
 $this-Record-getLastInsertId();
                             $this-data['Timespan']['debet'] = 
 $this-data['Record']['debet'];

                             $this-data['Timespan']['credit'] = 
 $this-data['Record']['credit'];

                             if ($this-Record-Timespan-save($this-data)){

                                $this-Session-setFlash(__('The Record
 has been saved', true));
                                 $this-redirect(array
 ('action'='index'));
                                } else {
                                  $this-Session-setFlash(__('The
 Timespan could not be saved.',true));
                                }
                         } else {
                                 $this-Session-setFlash(__('The
 Record could not be saved.
 Please, try again.', true));
                         }
                 }

 And for places that you expect an update, you would just do your
 calculation and do a 'saveAll($this-data)'

 On Dec 2, 2:14 am,webscriptz[EMAIL PROTECTED] wrote:

  normally i would read it out with php, put them in vars and addition
  the values and resave them.

  On Dec 2, 10:49 am,webscriptz[EMAIL PROTECTED] wrote:

   Sorry for that,

   I have a model Records and Timespans. DEBET and CREDIT have to be
   inserted in the records table but also in the Timespans table in DEBET
   and CREDIT
   The first is not a problem but the second is. IT has to be additioned
   not just replaced by the latest.

   function add() {
                   if (!empty($this-data)) {
                           $this-Record-create();
                           if ($this-Record-save($this-data)) {
                                   $this-Session-setFlash(__('The Record 
   has been saved', true));
                                   $this-redirect(array('action'='index'));
                           } else {
                                   $this-Session-setFlash(__('The Record 
   could not be saved.
   Please, try again.', true));
                           }
                   }
                   $timespans = $this-Record-Timespan-find('list');
                   $this-set(compact('timespans'));

   what do I have to reference to where in fact I didn't quit get that
   and do I have to change something in the view also?

   Thanks,

   - Tim

   On Dec 1, 9:40 pm, Rob [EMAIL PROTECTED] wrote:

So just a suggestion for future questions, describe the tables and
their relationship in your question a little next time.

Assuming you have a Records model and a Timespans model that are
related to each other, and the relationships are described in the
models for those two entities ...

So, for example if you want to add the values from a Record to the
values in the related Timespan, you would reference the $this-Record
and $this-Record-Timespan

On Dec 1, 1:45 am,webscriptz[EMAIL PROTECTED] wrote:

 I'm making a register and I have a small problem,

 I want two numbers to be additioned (+) with the numbers already in an
 other table, unfortunantly I don't know how to do this.

 i have a Record with debet and credit and i want to addition them
 to debet and credit in timespans.

 but they got controller  model records

 please help,

 Tim De Smedt
--~--~-~--~~~---~--~~
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

Managing empty data in forms with associations

2008-12-08 Thread variaas

Does CakePHP have a function to clear out empty datarows before
saving? Right now I manually parse the array to see if there is an
empty array and unset it.

So given this array:

[data] =
 [0]   =
  [name] = 'alice'
 [1]   =
  [name] = 'bob'
 [2]   =
  [name] = ''

I would unset [data][2] and then call the save method. I just wanted
to make sure I'm not re-inventing a wheel available in CakePHP.

--~--~-~--~~~---~--~~
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: correct way to create multiple text forms in a table

2008-12-03 Thread Todd M

Its all one form. The form goes to a model that has a belongs to
relationship to the x  y models. So the controller to initially
create the form would have

$x= $this-X-findAllBySomeId($some_id);
$this-set('x'', $x);
$y = $this-Y-findAllByDifferentId($different_id);
$this-set('y', $y);

There is a relationship between X  Y model, but I don't think that is
important for this situation.

When $x  $y are given to the view. The view will have only one form.
This form deals with the Z model. The Z model has belongsto X and
belongsToY fields. That is the Z model has a unique id, and x_id,
y_id, and value column.
An example is.
Array
(
[Z] = Array
(
[x_id] = 'value'
[y_id]= 'value'
[description] = 'description for Z'
)
)

I wanted to use a table that is XxY wide. So in my original example
there was 2 entries for both X  Y from the findAll functions. This
would produce a 2x2 table.


The part that I don't quite understand is how to create the forms with
knowledge of the X's  Y's ID. so I know how to properly save it to
the Z model, using a saveAll. I have only had experience with doing
this one entry at a time.

Thanks for assistance in advance,
-T



On Dec 3, 1:34 am, brian [EMAIL PROTECTED] wrote:
 Could you query again, but without all the table display stuff? You have 4
 text boxes in a view and ... what?

 What's the model name, and what models is it associated to (and how)?

 Or is it 4 separate forms? 5?

 On Wed, Dec 3, 2008 at 12:27 AM, Todd M [EMAIL PROTECTED] wrote:

  I'm creating a table where the top header row and left column are
  text, but everything in the middle will be a text box. So if the table
  was 5x5, there would be a 4x4 matrix of text boxes.

  Each of these text inputs will represent a different entry to be saved
  at the same model. My plan is to have one submit and the controller
  will will call a model-saveall function. However of the text box
  forms has a id associated to the top row and leftmost column. In other
  words the form is saving to a model that has belongsTo association
  with the top row and left.

  Is there something that I'm missing on how to have this association
  linked with each $form-input.

  (Note:example has top left cell blank intentionally)
  tr
   td  /td
   tdx1/td
   tdx2/td
  /tr
  tr
   tdy1/td
   tdtext form x1/y1 for modelz/td
   tdtext form x2/y1 for modelz/td
  /tr
  tr
   tdy2/td
   tdtext form x1/y2 for modelz/td
   tdtext form x2/y2 for modelz/td
  /tr

  So the submit would save four entries into the model.

  My question is how to use the form helper? And/or is there other best
  practices out there.

  The only solution that I can come up with is to not use the
  'Modelname.fieldname' in the naming convention and have the controller
  parse the name into cake naming convention before saving.
--~--~-~--~~~---~--~~
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: adding info from forms to more then one table

2008-12-02 Thread webscriptz

normally i would read it out with php, put them in vars and addition
the values and resave them.

On Dec 2, 10:49 am, webscriptz [EMAIL PROTECTED] wrote:
 Sorry for that,

 I have a model Records and Timespans. DEBET and CREDIT have to be
 inserted in the records table but also in the Timespans table in DEBET
 and CREDIT
 The first is not a problem but the second is. IT has to be additioned
 not just replaced by the latest.

 function add() {
                 if (!empty($this-data)) {
                         $this-Record-create();
                         if ($this-Record-save($this-data)) {
                                 $this-Session-setFlash(__('The Record has 
 been saved', true));
                                 $this-redirect(array('action'='index'));
                         } else {
                                 $this-Session-setFlash(__('The Record could 
 not be saved.
 Please, try again.', true));
                         }
                 }
                 $timespans = $this-Record-Timespan-find('list');
                 $this-set(compact('timespans'));

 what do I have to reference to where in fact I didn't quit get that
 and do I have to change something in the view also?

 Thanks,

 - Tim

 On Dec 1, 9:40 pm, Rob [EMAIL PROTECTED] wrote:

  So just a suggestion for future questions, describe the tables and
  their relationship in your question a little next time.

  Assuming you have a Records model and a Timespans model that are
  related to each other, and the relationships are described in the
  models for those two entities ...

  So, for example if you want to add the values from a Record to the
  values in the related Timespan, you would reference the $this-Record
  and $this-Record-Timespan

  On Dec 1, 1:45 am, webscriptz [EMAIL PROTECTED] wrote:

   I'm making a register and I have a small problem,

   I want two numbers to be additioned (+) with the numbers already in an
   other table, unfortunantly I don't know how to do this.

   i have a Record with debet and credit and i want to addition them
   to debet and credit in timespans.

   but they got controller  model records

   please help,

   Tim De Smedt
--~--~-~--~~~---~--~~
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: adding info from forms to more then one table

2008-12-02 Thread webscriptz

Sorry for that,

I have a model Records and Timespans. DEBET and CREDIT have to be
inserted in the records table but also in the Timespans table in DEBET
and CREDIT
The first is not a problem but the second is. IT has to be additioned
not just replaced by the latest.

function add() {
if (!empty($this-data)) {
$this-Record-create();
if ($this-Record-save($this-data)) {
$this-Session-setFlash(__('The Record has 
been saved', true));
$this-redirect(array('action'='index'));
} else {
$this-Session-setFlash(__('The Record could 
not be saved.
Please, try again.', true));
}
}
$timespans = $this-Record-Timespan-find('list');
$this-set(compact('timespans'));

what do I have to reference to where in fact I didn't quit get that
and do I have to change something in the view also?

Thanks,

- Tim

On Dec 1, 9:40 pm, Rob [EMAIL PROTECTED] wrote:
 So just a suggestion for future questions, describe the tables and
 their relationship in your question a little next time.

 Assuming you have a Records model and a Timespans model that are
 related to each other, and the relationships are described in the
 models for those two entities ...

 So, for example if you want to add the values from a Record to the
 values in the related Timespan, you would reference the $this-Record
 and $this-Record-Timespan

 On Dec 1, 1:45 am, webscriptz [EMAIL PROTECTED] wrote:

  I'm making a register and I have a small problem,

  I want two numbers to be additioned (+) with the numbers already in an
  other table, unfortunantly I don't know how to do this.

  i have a Record with debet and credit and i want to addition them
  to debet and credit in timespans.

  but they got controller  model records

  please help,

  Tim De Smedt

--~--~-~--~~~---~--~~
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: adding info from forms to more then one table

2008-12-02 Thread Rob

I would suggest looking at saveAll to do the save part, then to do
your addition you just need to make sure it's in the data.

That said, here's the way I handle adding a related record as shown in
your add() above:

function add() {
if (!empty($this-data)) {
$this-Record-create();
if ($this-Record-save($this-data)) {
$this-data['Timespan']['record_id'] =
$this-Record-getLastInsertId();
$this-data['Timespan']['debet'] = $this-
data['Record']['debet'];
$this-data['Timespan']['credit'] = $this-
data['Record']['credit'];
if ($this-Record-Timespan-save($this-
data)){
   $this-Session-setFlash(__('The Record
has been saved', true));
$this-redirect(array
('action'='index'));
   } else {
 $this-Session-setFlash(__('The
Timespan could not be saved.',true));
   }
} else {
$this-Session-setFlash(__('The
Record could not be saved.
Please, try again.', true));
}
}

And for places that you expect an update, you would just do your
calculation and do a 'saveAll($this-data)'

On Dec 2, 2:14 am, webscriptz [EMAIL PROTECTED] wrote:
 normally i would read it out with php, put them in vars and addition
 the values and resave them.

 On Dec 2, 10:49 am, webscriptz [EMAIL PROTECTED] wrote:

  Sorry for that,

  I have a model Records and Timespans. DEBET and CREDIT have to be
  inserted in the records table but also in the Timespans table in DEBET
  and CREDIT
  The first is not a problem but the second is. IT has to be additioned
  not just replaced by the latest.

  function add() {
                  if (!empty($this-data)) {
                          $this-Record-create();
                          if ($this-Record-save($this-data)) {
                                  $this-Session-setFlash(__('The Record has 
  been saved', true));
                                  $this-redirect(array('action'='index'));
                          } else {
                                  $this-Session-setFlash(__('The Record 
  could not be saved.
  Please, try again.', true));
                          }
                  }
                  $timespans = $this-Record-Timespan-find('list');
                  $this-set(compact('timespans'));

  what do I have to reference to where in fact I didn't quit get that
  and do I have to change something in the view also?

  Thanks,

  - Tim

  On Dec 1, 9:40 pm, Rob [EMAIL PROTECTED] wrote:

   So just a suggestion for future questions, describe the tables and
   their relationship in your question a little next time.

   Assuming you have a Records model and a Timespans model that are
   related to each other, and the relationships are described in the
   models for those two entities ...

   So, for example if you want to add the values from a Record to the
   values in the related Timespan, you would reference the $this-Record
   and $this-Record-Timespan

   On Dec 1, 1:45 am, webscriptz [EMAIL PROTECTED] wrote:

I'm making a register and I have a small problem,

I want two numbers to be additioned (+) with the numbers already in an
other table, unfortunantly I don't know how to do this.

i have a Record with debet and credit and i want to addition them
to debet and credit in timespans.

but they got controller  model records

please help,

Tim De Smedt


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



correct way to create multiple text forms in a table

2008-12-02 Thread Todd M

I'm creating a table where the top header row and left column are
text, but everything in the middle will be a text box. So if the table
was 5x5, there would be a 4x4 matrix of text boxes.

Each of these text inputs will represent a different entry to be saved
at the same model. My plan is to have one submit and the controller
will will call a model-saveall function. However of the text box
forms has a id associated to the top row and leftmost column. In other
words the form is saving to a model that has belongsTo association
with the top row and left.

Is there something that I'm missing on how to have this association
linked with each $form-input.

(Note:example has top left cell blank intentionally)
tr
  td  /td
  tdx1/td
  tdx2/td
/tr
tr
  tdy1/td
  tdtext form x1/y1 for modelz/td
  tdtext form x2/y1 for modelz/td
/tr
tr
  tdy2/td
  tdtext form x1/y2 for modelz/td
  tdtext form x2/y2 for modelz/td
/tr

So the submit would save four entries into the model.

My question is how to use the form helper? And/or is there other best
practices out there.

The only solution that I can come up with is to not use the
'Modelname.fieldname' in the naming convention and have the controller
parse the name into cake naming convention before saving.
--~--~-~--~~~---~--~~
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: correct way to create multiple text forms in a table

2008-12-02 Thread brian
Could you query again, but without all the table display stuff? You have 4
text boxes in a view and ... what?

What's the model name, and what models is it associated to (and how)?

Or is it 4 separate forms? 5?

On Wed, Dec 3, 2008 at 12:27 AM, Todd M [EMAIL PROTECTED] wrote:


 I'm creating a table where the top header row and left column are
 text, but everything in the middle will be a text box. So if the table
 was 5x5, there would be a 4x4 matrix of text boxes.

 Each of these text inputs will represent a different entry to be saved
 at the same model. My plan is to have one submit and the controller
 will will call a model-saveall function. However of the text box
 forms has a id associated to the top row and leftmost column. In other
 words the form is saving to a model that has belongsTo association
 with the top row and left.

 Is there something that I'm missing on how to have this association
 linked with each $form-input.

 (Note:example has top left cell blank intentionally)
 tr
  td  /td
  tdx1/td
  tdx2/td
 /tr
 tr
  tdy1/td
  tdtext form x1/y1 for modelz/td
  tdtext form x2/y1 for modelz/td
 /tr
 tr
  tdy2/td
  tdtext form x1/y2 for modelz/td
  tdtext form x2/y2 for modelz/td
 /tr

 So the submit would save four entries into the model.

 My question is how to use the form helper? And/or is there other best
 practices out there.

 The only solution that I can come up with is to not use the
 'Modelname.fieldname' in the naming convention and have the controller
 parse the name into cake naming convention before saving.
 


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



adding info from forms to more then one table

2008-12-01 Thread webscriptz

I'm making a register and I have a small problem,

I want two numbers to be additioned (+) with the numbers already in an
other table, unfortunantly I don't know how to do this.

i have a Record with debet and credit and i want to addition them
to debet and credit in timespans.

but they got controller  model records

please help,

Tim De Smedt

--~--~-~--~~~---~--~~
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: adding info from forms to more then one table

2008-12-01 Thread Rob

So just a suggestion for future questions, describe the tables and
their relationship in your question a little next time.

Assuming you have a Records model and a Timespans model that are
related to each other, and the relationships are described in the
models for those two entities ...

So, for example if you want to add the values from a Record to the
values in the related Timespan, you would reference the $this-Record
and $this-Record-Timespan

On Dec 1, 1:45 am, webscriptz [EMAIL PROTECTED] wrote:
 I'm making a register and I have a small problem,

 I want two numbers to be additioned (+) with the numbers already in an
 other table, unfortunantly I don't know how to do this.

 i have a Record with debet and credit and i want to addition them
 to debet and credit in timespans.

 but they got controller  model records

 please help,

 Tim De Smedt
--~--~-~--~~~---~--~~
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: Working with forms for CMS

2008-11-20 Thread Jon Bennett

Hi Flipflops,

Nice one, sorry for delayed response but been sidetracked by another project.

  class FormsController extends AppController {

 var $name = 'Forms';

 /**
 * a generic method to handle the submited forms
 * looks up a schema / and validation rules based on the id of the
  formthis-
 */
 submit_handler(){

 if(isset($this-data)){

 $id = $this-data['Form']['id'];
 // get all the data about the form
 $meta = $this-Form-read(null, $id)
 // set the validation array we want to use
 $this-Form-validate = $meta['validation_rules'];

 if ($this-Form-validates()) {
 // it validated logic
 } else {
 // didn't validate logic
 }
 }
 }
  }


that's roughly how I was thinking it.

  You would have to feed the model a schema (for the submitted form) to
  use wouldn't you?

Yes, I was thinking of a attaching the form via a HABTM, then checking
for an associated record, if that's there you set the schema in the
model. I think this would have to be done manually, not in an
afterFind or similar. This should allow $form-inputs and validation
work.

cheers,

jon

-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
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: Working with forms for CMS

2008-11-19 Thread Flipflops

Hi Jon, Dardo

I guess it depends how hacky you want to be. You could have two models
one that manages the form builder and another which is really just a
shell that would validate the actual forms when you submit them.

Off the top of my head I guess you could do something like this (not
tried out btw):

class FormsController extends AppController {

var $name = 'Forms';

/**
* a generic method to handle the submited forms
* looks up a schema / and validation rules based on the id of the
formthis-
*/
submit_handler(){

if(isset($this-data)){

$id = $this-data['Form']['id'];
// get all the data about the form
$meta = $this-Form-read(null, $id)
// set the validation array we want to use
$this-Form-validate = $meta['validation_rules'];

if ($this-Form-validates()) {
// it validated logic
} else {
// didn't validate logic
}
}
}
}

You would have to feed the model a schema (for the submitted form) to
use wouldn't you? Not sure how to do that but I'm sure it wouldn't be
hard to find out, (and I'd better do some work now!)

Cheers

On Nov 18, 3:02 pm, Jon Bennett [EMAIL PROTECTED] wrote:
 Hi Flip flops,

   Passing the schema and validation rules seems like a good idea - I'm
   guessing your are thinking you could couple it with some kind of
   wizard / interface so you build your forms within the CMS... could be
   a really goood feature but at the end of the day it boils down to how
   long the initial development time takes to recoup.
   Hi Flipflops,
   Passing the schema and validation rules seems like a good idea

 so did I - but I've just realised that my 'EmailForm' model would have
 it's own schema, at least:

 - id
 - name
 - schema
 - rules

 I'll need to add to this, either using a merge or just replacing the
 array - so that when adding a record to the CMS the real schema and
 validation are used, but when a form is submitted the custom schema
 and rules are used.

 Perhaps a simple check to see if there's any info in the 'with' of the
 habtm, if there is use the form rules, if not use the default.

 again though you have the issue of how/when/and by what this info is set.

 hmm - it's not obvious which way to go (yet!).

 Cheers,

 Jon

 --

 jon bennett
 w:http://www.jben.net/
 iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



need help with forms and ajax

2008-11-19 Thread mmm

hi group,
i'm missing something really simple and i need your help, i have a
simple form in my view, when a user presses submit button i want to
send form data to controller( or view) and get the result back in the
ajax callback, updating one singe div on the view. how can actually do
that?

please help!

--~--~-~--~~~---~--~~
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: need help with forms and ajax

2008-11-19 Thread mmm

already found a solution to it! thanks anyway!

On 19 Nov., 13:15, mmm [EMAIL PROTECTED] wrote:
 hi group,
 i'm missing something really simple and i need your help, i have a
 simple form in my view, when a user presses submit button i want to
 send form data to controller( or view) and get the result back in the
 ajax callback, updating one singe div on the view. how can actually do
 that?

 please help!
--~--~-~--~~~---~--~~
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: Working with forms for CMS

2008-11-18 Thread Jon Bennett

Hi bakers,

  Got a theory/approach question, hoping someone's been down this route 
 already.

  A lot of my projects are CMS'd sites. This largely means a few models:

  * Page
  * Article
  * Documents (files, images, media etc)

  Often I have to work with forms, contact forms, email sign ups etc
  that are then embedded in each page, and I'd really like to use the
  cake validation and auto magic, whilst avoiding manually creating a
  model for each form.

  Is this feasible? Any other ideas? Or am I just over over complicating 
 things!

The other issue I'm grappling with is how to connect a form to a page
or article when the form doesn't have a db table. I would like to have
a HABTM and 'with' to set a few vars, something like:

FormsPages
- id
- form_id
- page_id
- position (sidebar, end of main content etc)

But how would i set the validation/schema of 'form' if it has no content?

What about adding 2 fields to Forms:

Forms
- id
- name
- schema (serialised obj)
- validation_rules (serialised obj)

And then passing the values of each to the Form model in beforeValidate?

Thanks for any insight.

Cheers,

Jon


-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
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: Working with forms for CMS

2008-11-18 Thread Dardo Sordi Bogado

 Often I have to work with forms, contact forms, email sign ups etc
 that are then embedded in each page, and I'd really like to use the
 cake validation and auto magic, whilst avoiding manually creating a
 model for each form.

What is wrong with creating a Model for handling the data of your forms ?

 Is this feasible? Any other ideas? Or am I just over over complicating things!

I don't think it will be easier than writing a tableless model...

Regards,
- Dardo Sordi.

 Cheers,

 Jon

 --

 jon bennett
 w: http://www.jben.net/
 iChat (AIM): jbendotnet Skype: jon-bennett

 


--~--~-~--~~~---~--~~
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: Working with forms for CMS

2008-11-18 Thread Dardo Sordi Bogado

 What about adding 2 fields to Forms:

 Forms
 - id
 - name
 - schema (serialised obj)
 - validation_rules (serialised obj)

 And then passing the values of each to the Form model in beforeValidate?

It seems pretty strightforward to do, why don't give it a try and then
tell us how it went? It sounds as an interesting topic for a bakery
article.

Regards,
- Dardo Sordi.

 Thanks for any insight.

 Cheers,

 Jon


 --

 jon bennett
 w: http://www.jben.net/
 iChat (AIM): jbendotnet Skype: jon-bennett

 


--~--~-~--~~~---~--~~
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: Working with forms for CMS

2008-11-18 Thread Jon Bennett

 It seems pretty strightforward to do, why don't give it a try and then
  tell us how it went?

Am just thinking things through a little further. I was thinking about
how I would set the _schema and validate values. I had thought about
calling a method in afterFind, but they aren't run for associated
models, so I think I'll need to write a custom method in my model
which sets that, so the view knows what the schema is when showing a
form, and not just validating.

pieces of the puzzle are fitting together, and I'm considering using
trevorsg's http://javavideotutes.com/oldsite/temp/cakemvalidate/
validate creation code as a start point for a form builder, which
would be really handy - just need to strike the right balance between
super flexible and client usable.

Will keep you updated.

 It sounds as an interesting topic for a bakery article.

indeed it does.

cheers,

Jon

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
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: Working with forms for CMS

2008-11-18 Thread Flipflops

Hi

Passing the schema and validation rules seems like a good idea - I'm
guessing your are thinking you could couple it with some kind of
wizard / interface so you build your forms within the CMS... could be
a really goood feature but at the end of the day it boils down to how
long the initial development time takes to recoup.

I've been pondering this kind of thing too but hadn't made any attempt
to build it yet!

On Nov 18, 11:42 am, Jon Bennett [EMAIL PROTECTED] wrote:
 Hi bakers,

   Got a theory/approach question, hoping someone's been down this route 
  already.

   A lot of my projects are CMS'd sites. This largely means a few models:

   * Page
   * Article
   * Documents (files, images, media etc)

   Often I have to work with forms, contact forms, email sign ups etc
   that are then embedded in each page, and I'd really like to use the
   cake validation and auto magic, whilst avoiding manually creating a
   model for each form.

   Is this feasible? Any other ideas? Or am I just over over complicating 
  things!

 The other issue I'm grappling with is how to connect a form to a page
 or article when the form doesn't have a db table. I would like to have
 a HABTM and 'with' to set a few vars, something like:

 FormsPages
 - id
 - form_id
 - page_id
 - position (sidebar, end of main content etc)

 But how would i set the validation/schema of 'form' if it has no content?

 What about adding 2 fields to Forms:

 Forms
 - id
 - name
 - schema (serialised obj)
 - validation_rules (serialised obj)

 And then passing the values of each to the Form model in beforeValidate?

 Thanks for any insight.

 Cheers,

 Jon

 --

 jon bennett
 w:http://www.jben.net/
 iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
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: Working with forms for CMS

2008-11-18 Thread Jon Bennett

Hi Flip flops,

  Passing the schema and validation rules seems like a good idea - I'm
  guessing your are thinking you could couple it with some kind of
  wizard / interface so you build your forms within the CMS... could be
  a really goood feature but at the end of the day it boils down to how
  long the initial development time takes to recoup.
  Hi Flipflops,

  Passing the schema and validation rules seems like a good idea

so did I - but I've just realised that my 'EmailForm' model would have
it's own schema, at least:

- id
- name
- schema
- rules

I'll need to add to this, either using a merge or just replacing the
array - so that when adding a record to the CMS the real schema and
validation are used, but when a form is submitted the custom schema
and rules are used.

Perhaps a simple check to see if there's any info in the 'with' of the
habtm, if there is use the form rules, if not use the default.

again though you have the issue of how/when/and by what this info is set.

hmm - it's not obvious which way to go (yet!).

Cheers,

Jon

-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
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: Working with forms for CMS

2008-11-18 Thread Dardo Sordi Bogado

 so did I - but I've just realised that my 'EmailForm' model would have
 it's own schema, at least:

Why don't use two models: one for handling the validation of the
dynamic forms and one for storing the metadata in the DB.

Then in the dynamics forms, you can override schema() and probably a
couple more to get it's definitions from the db using the other model,
with a fake relationship or instanciating directly the other model.

Just my 2c,
- Dardo Sordi.

 - id
 - name
 - schema
 - rules

 I'll need to add to this, either using a merge or just replacing the
 array - so that when adding a record to the CMS the real schema and
 validation are used, but when a form is submitted the custom schema
 and rules are used.

 Perhaps a simple check to see if there's any info in the 'with' of the
 habtm, if there is use the form rules, if not use the default.

 again though you have the issue of how/when/and by what this info is set.

 hmm - it's not obvious which way to go (yet!).

 Cheers,

 Jon

 --

 jon bennett
 w: http://www.jben.net/
 iChat (AIM): jbendotnet Skype: jon-bennett

 


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



Working with forms for CMS

2008-11-17 Thread Jon Bennett

Hi folks,

Got a theory/approach question, hoping someone's been down this route already.

A lot of my projects are CMS'd sites. This largely means a few models:

* Page
* Article
* Documents (files, images, media etc)

Often I have to work with forms, contact forms, email sign ups etc
that are then embedded in each page, and I'd really like to use the
cake validation and auto magic, whilst avoiding manually creating a
model for each form.

Is this feasible? Any other ideas? Or am I just over over complicating things!

Cheers,

Jon

-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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



Handy trick for forms that down offer all fields from model.

2008-11-13 Thread Josey

As a relatively new baker and programmer, for that matter, I ran into
a problem earlier this week.
I was creating a form for users to edit their information however, not
all fields were present in this form for the general member but those
fields happened to be required fields.

In the model those fields non present were set up to validate but,
since they didn't appear in the form (unless you were logged in with
the proper privileges ) the user would never see the validation
errors.

So, upon updating their information they would click Save Details
only to be taken back to the edit form, not their profile page.

Quandary I thought.

Upon troubleshooting I realized that it was due to the form validating
non-present fields.

A little digging and I pulled this up.
unset($this-User-validate['username']);

Obviously the username is required but it's not changeable.

I add that to the save group in my edit controller action and that
tells the model to ignore validation when it uses the edit action.

So, in closing; If you want to have a form that doesn't have all the
fields in it and some of those fields have validation rules set just
use unset($this-User-validate['fieldname']);
--~--~-~--~~~---~--~~
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: Handy trick for forms that down offer all fields from model.

2008-11-13 Thread teknoid

I assume you had 'required'=true as part of the validation rules.
Seems like, yet another, misunderstanding :)

http://teknoid.wordpress.com/2008/11/04/requiredtrue-the-source-of-major-confusion/

On Nov 13, 9:02 am, Josey [EMAIL PROTECTED] wrote:
 As a relatively new baker and programmer, for that matter, I ran into
 a problem earlier this week.
 I was creating a form for users to edit their information however, not
 all fields were present in this form for the general member but those
 fields happened to be required fields.

 In the model those fields non present were set up to validate but,
 since they didn't appear in the form (unless you were logged in with
 the proper privileges ) the user would never see the validation
 errors.

 So, upon updating their information they would click Save Details
 only to be taken back to the edit form, not their profile page.

 Quandary I thought.

 Upon troubleshooting I realized that it was due to the form validating
 non-present fields.

 A little digging and I pulled this up.
 unset($this-User-validate['username']);

 Obviously the username is required but it's not changeable.

 I add that to the save group in my edit controller action and that
 tells the model to ignore validation when it uses the edit action.

 So, in closing; If you want to have a form that doesn't have all the
 fields in it and some of those fields have validation rules set just
 use unset($this-User-validate['fieldname']);
--~--~-~--~~~---~--~~
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: Handy trick for forms that down offer all fields from model.

2008-11-13 Thread teknoid

'requied'=true, is rarely necessary. You are probably more interested
in the 'notEmpty' rule.
If you read the manual (ans possibly my post above), you'll see why
'required' doesn't exactly mean what you'd expect.
Using the default value of false, will help you to avoid any trickery
(unless you truly do not trust the source from which the data is
coming).

On Nov 13, 11:16 am, teknoid [EMAIL PROTECTED] wrote:
 I assume you had 'required'=true as part of the validation rules.
 Seems like, yet another, misunderstanding :)

 http://teknoid.wordpress.com/2008/11/04/requiredtrue-the-source-of-ma...

 On Nov 13, 9:02 am, Josey [EMAIL PROTECTED] wrote:

  As a relatively new baker and programmer, for that matter, I ran into
  a problem earlier this week.
  I was creating a form for users to edit their information however, not
  all fields were present in this form for the general member but those
  fields happened to be required fields.

  In the model those fields non present were set up to validate but,
  since they didn't appear in the form (unless you were logged in with
  the proper privileges ) the user would never see the validation
  errors.

  So, upon updating their information they would click Save Details
  only to be taken back to the edit form, not their profile page.

  Quandary I thought.

  Upon troubleshooting I realized that it was due to the form validating
  non-present fields.

  A little digging and I pulled this up.
  unset($this-User-validate['username']);

  Obviously the username is required but it's not changeable.

  I add that to the save group in my edit controller action and that
  tells the model to ignore validation when it uses the edit action.

  So, in closing; If you want to have a form that doesn't have all the
  fields in it and some of those fields have validation rules set just
  use unset($this-User-validate['fieldname']);


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



Accessibility and forms

2008-11-09 Thread イタリア人

Hello all,

although putting tags in the right order does not make an accessible
website, I was wondering if anyone is really looking at priority AAA
for accessible websites and updated the form helper...

Anyone ?

Julien
--~--~-~--~~~---~--~~
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: validation conflicts: two forms, one model, one page

2008-10-27 Thread Christian Leskowsky

Hmm... the Auth component sets the flash message Message.auth and  
checks for it in the view:

if ($session-check('Message.auth')) {
$session-flash('auth');
}

Maybe you can do something similar?

http://book.cakephp.org/view/564/Displaying-Auth-Error-Messages

On 23-Oct-08, at 7:24 PM, RyOnLife wrote:



 I have a single page which contains both a login and a registration  
 form,
 both post to the 'User' model. When the 'username' field in the  
 registration
 form has a validation error, Cake shows the message on the  
 'username' field
 in the registration form and the 'login' form. How can I contain the  
 error
 message to the appropriate form?
 -- 
 View this message in context: 
 http://www.nabble.com/validation-conflicts%3A-two-forms%2C-one-model%2C-one-page-tp20141502p20141502.html
 Sent from the CakePHP mailing list archive at Nabble.com.


 


--~--~-~--~~~---~--~~
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: validation conflicts: two forms, one model, one page

2008-10-27 Thread RyOnLife


It's a workaround, but did the trick: $('#FormName .error-message').hide()
-- 
View this message in context: 
http://n2.nabble.com/validation-conflicts%3A-two-forms%2C-one-model%2C-one-page-tp1370230p1382883.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



validation conflicts: two forms, one model, one page

2008-10-23 Thread RyOnLife


I have a single page which contains both a login and a registration form,
both post to the 'User' model. When the 'username' field in the registration
form has a validation error, Cake shows the message on the 'username' field
in the registration form and the 'login' form. How can I contain the error
message to the appropriate form?
-- 
View this message in context: 
http://www.nabble.com/validation-conflicts%3A-two-forms%2C-one-model%2C-one-page-tp20141502p20141502.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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: Auth component and ajax forms

2008-10-03 Thread CG

Did you check this var at the auth component?

/**
 * The name of an optional view element to render when an Ajax request
is made
 * with an invalid or expired session
 *
 * @var string
 * @access public
 */
var $ajaxLogin = null;

Never tried it, but i guess is something meant to do what you need.

HTH,

CG

On Oct 2, 4:17 pm, RobertoSDN [EMAIL PROTECTED] wrote:
 Hello, i am using ajax forms and i have a problem with the Auth
 component that works fine with the login action but not with others
 actions because only the login action has the bahavior to render a
 element to handle errors like bellow:

 if ($loginAction == $url) {
    ...code} else {

    if (!$this-user()) {
         if (!$this-RequestHandler-isAjax()) {
                 $this-Session-setFlash($this-authError, 'default', array(),
 'auth');
                 $this-Session-write('Auth.redirect', $url);
                 $controller-redirect($loginAction);
                 return false;
         } elseif (!empty($this-ajaxLogin)) {
                 $controller-viewPath = 'elements';
                 echo $controller-render($this-ajaxLogin,   
 $this-RequestHandler-ajaxLayout);

                 $this-_stop();
                 return false;
         } else {
                 $controller-redirect(null, 403);
         }
    }

 }

 The problem is, when i make a request to an action that the function
 isAuthorized() returns false, the component redirect the render to a
 referer page that its layout is not a ajax layout and the view is the
 view's referer, would be a bad thing to replace the actual Auth code
 to this bellow?

 After this
 if ($this-isAuthorized($type)) {
         return true;

 }

 put this

 if (!$this-RequestHandler-isAjax()) {
         $this-Session-setFlash($this-authError, 'default', array(),
 'auth');
         $controller-redirect($controller-referer(), null, true);}else{

         $controller-viewPath = 'elements';
         echo $controller-render($this-ajaxLogin, 
 $this-RequestHandler-ajaxLayout);

         $this-_stop();
         return false;

 }

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



Auth component and ajax forms

2008-10-02 Thread RobertoSDN

Hello, i am using ajax forms and i have a problem with the Auth
component that works fine with the login action but not with others
actions because only the login action has the bahavior to render a
element to handle errors like bellow:

if ($loginAction == $url) {
   ...code
} else {
   if (!$this-user()) {
if (!$this-RequestHandler-isAjax()) {
$this-Session-setFlash($this-authError, 'default', array(),
'auth');
$this-Session-write('Auth.redirect', $url);
$controller-redirect($loginAction);
return false;
} elseif (!empty($this-ajaxLogin)) {
$controller-viewPath = 'elements';
echo $controller-render($this-ajaxLogin,   
$this-RequestHandler-
ajaxLayout);
$this-_stop();
return false;
} else {
$controller-redirect(null, 403);
}
   }
}

The problem is, when i make a request to an action that the function
isAuthorized() returns false, the component redirect the render to a
referer page that its layout is not a ajax layout and the view is the
view's referer, would be a bad thing to replace the actual Auth code
to this bellow?

After this
if ($this-isAuthorized($type)) {
return true;
}

put this

if (!$this-RequestHandler-isAjax()) {
$this-Session-setFlash($this-authError, 'default', array(),
'auth');
$controller-redirect($controller-referer(), null, true);
}else{
$controller-viewPath = 'elements';
echo $controller-render($this-ajaxLogin, $this-RequestHandler-
ajaxLayout);
$this-_stop();
return false;
}

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



CakePHP 1.1, AJAX and forms not doing anything.

2008-09-30 Thread aka

Hi!

I have a controller, which fetches other controllers data through
requestAction().

The first element contains a form in which there is an $ajax-
submit(...);

the problem here is that the form does nothing. The form doesen't even
send XHR request.

However, the $ajax-link's works just fine and when I click one of the
links, resultin an update to the that element and then return back to
the original element the form starts to work.

Am I missing something? becouse this seems very odd.
--~--~-~--~~~---~--~~
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: CakePHP 1.1, AJAX and forms not doing anything.

2008-09-30 Thread clemos

Hi

You should at least give the code from your view, so that we can
figure out what's going on.

Also, english is not my mother language, and I don't understand this sentence :
 However, the $ajax-link's works just fine and when I click one of the
 links, resultin an update to the that element and then return back to
 the original element the form starts to work.

Please be a bit more clear.
+++
Clément

On Tue, Sep 30, 2008 at 1:34 PM, aka [EMAIL PROTECTED] wrote:

 Hi!

 I have a controller, which fetches other controllers data through
 requestAction().

 The first element contains a form in which there is an $ajax-
submit(...);

 the problem here is that the form does nothing. The form doesen't even
 send XHR request.

 However, the $ajax-link's works just fine and when I click one of the
 links, resultin an update to the that element and then return back to
 the original element the form starts to work.

 Am I missing something? becouse this seems very odd.
 


--~--~-~--~~~---~--~~
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: CakePHP 1.1, AJAX and forms not doing anything.

2008-09-30 Thread aka

Yes Sorry clemos, was alittle tired on this afternoon.

Here is the question completely rewritten :)

1. Download the latest stable release of CakePHP (1.1.19.6305)
1.1 Set it up and running.

2. Download the prototype.js library and copy it to your fresh cake
installation js -folder.

3. Lets create the controller we need
3.1 create users_controller.php, source is here: 
http://bin.cakephp.org/view/228475902
3.2 create settings controller.php, source here: 
http://bin.cakephp.org/view/1561727948

4. Now we need some models too...
4.1 Let's create the user.php, source can be found here:
http://bin.cakephp.org/view/1560512038
4.2 Next we need the setting.php, get the source here:
http://bin.cakephp.org/view/325085541

5. We need three views as well... V for Views!
5.1 /users/index.thtml, source: http://bin.cakephp.org/view/227887042
5.2 /users/edit.thtml, source: http://bin.cakephp.org/view/1754502406
5.3 /settings/index.thtml, source: http://bin.cakephp.org/view/1797653162
view:settings/index

6. Let's modify the default layout a little (include the prototype
library and what not)
6.1 download this layout and save it under /views/layouts/test.thtml
(http://bin.cakephp.org/view/1757453857)

7. Now we are ready to begin testing...
7.1 browse to localhost/your/new/cake/installation/settings/
7.2 try to type something to the text field and press submit...
nothing happens. The browser doesen't send any XHR request.
7.3 click the link that says click me, this invokes an AJAX call
(which works BTW)
7.4 Click the link on that window again. That load the same view, that
we used in 7.1 and now the AJAX submit button works..

-Antti


prototype.js
--~--~-~--~~~---~--~~
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: Forms not validating while using EmailComponent?

2008-09-18 Thread David C. Zentgraf

Are you looking for this?
http://book.cakephp.org/view/410/Validating-Data-from-the-Controller

On 18 Sep 2008, at 13:51, 703designs wrote:


 How can I check if the data is valid before trying to send the mail
 out? Validation errors are falling into the email failed condition,
 and validation errors aren't reported to the user.
 


--~--~-~--~~~---~--~~
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: Forms not validating while using EmailComponent?

2008-09-18 Thread 703designs

 I saw that last night before posting, and wrapping the send sequence
in this conditional didn't work: I got funny preg_match errors (also
noted here:
http://ryan.ifupdown.com/2008/08/24/delimiter-must-not-be-alphanumeric-or-backslash-corecakelibsmodelmodelphp-line-2202/
, although his fix didn't work for me):

function add() {
if(!empty($this-data)) {
$this-Contact-set('$this-data);
if($this-Contact-validates()) {
// Start sending messages, then flash a success message if
successful. Redirect to site root
}
}
}

I also got an error about a missing 'add' view which is probably
easier to fix. This controller's 'add' method just sends out emails
and flashes a message to the homepage. What do I need to do for the
form to point to this method, but for validation errors to show up on
the form (repopulating fields)? This is not very well-documented, or
if it is, I had difficulty finding an answer.

On Sep 18, 4:44 am, David C. Zentgraf [EMAIL PROTECTED] wrote:
 Are you looking for 
 this?http://book.cakephp.org/view/410/Validating-Data-from-the-Controller

 On 18 Sep 2008, at 13:51, 703designs wrote:



  How can I check if the data is valid before trying to send the mail
  out? Validation errors are falling into the email failed condition,
  and validation errors aren't reported to the user.
--~--~-~--~~~---~--~~
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: Forms not validating while using EmailComponent?

2008-09-18 Thread David C. Zentgraf

On 18 Sep 2008, at 21:50, 703designs wrote:

 I got funny preg_match errors

Show us your $validate rules then or go through them with a fine comb.

 $this-Contact-set('$this-data);

I hope this is not copypasted as it's invalid PHP.

 This controller's 'add' method just sends out emails
 and flashes a message to the homepage. What do I need to do for the
 form to point to this method, but for validation errors to show up on
 the form (repopulating fields)?

What view is your form in then? The add action will automatically try  
to render the add view, naturally. If this is not where your form is,  
override it with $this-render();

 This is not very well-documented, or
 if it is, I had difficulty finding an answer.

http://book.cakephp.org/view/428/render

--~--~-~--~~~---~--~~
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: Forms not validating while using EmailComponent?

2008-09-18 Thread 703designs

Right, that was a typo, not a paste. I think that you'll be able to
better help me if you understand how I've designed my contact form:

Model: Contact[name, email, city, subject, message, and a couple
others]
Model['validate']: Name, email, and message have 'required' = true
Views: index (just passes in a pageTitle from the controller and
renders a form from the model using $this-form-create('Contact') or
equivalent -- works fine. This form automatically mapped to
ContactsController::add(), so I created that method and put all of the
relevant mail logic in there.

So should I move this logic into index() and force the form to use
that method? Or force a render of the index view and find some way to
pass in the validation errors?

Thanks for the help!

On Sep 18, 9:29 am, David C. Zentgraf [EMAIL PROTECTED] wrote:
 On 18 Sep 2008, at 21:50, 703designs wrote:

  I got funny preg_match errors

 Show us your $validate rules then or go through them with a fine comb.

  $this-Contact-set('$this-data);

 I hope this is not copypasted as it's invalid PHP.

  This controller's 'add' method just sends out emails
  and flashes a message to the homepage. What do I need to do for the
  form to point to this method, but for validation errors to show up on
  the form (repopulating fields)?

 What view is your form in then? The add action will automatically try  
 to render the add view, naturally. If this is not where your form is,  
 override it with $this-render();

  This is not very well-documented, or
  if it is, I had difficulty finding an answer.

 http://book.cakephp.org/view/428/render
--~--~-~--~~~---~--~~
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: Forms not validating while using EmailComponent?

2008-09-18 Thread 703designs

Note that each ['validate'] key also has a normal ['message'] defined,
saying that the field in question is required.

On Sep 18, 9:29 am, David C. Zentgraf [EMAIL PROTECTED] wrote:
 On 18 Sep 2008, at 21:50, 703designs wrote:

  I got funny preg_match errors

 Show us your $validate rules then or go through them with a fine comb.

  $this-Contact-set('$this-data);

 I hope this is not copypasted as it's invalid PHP.

  This controller's 'add' method just sends out emails
  and flashes a message to the homepage. What do I need to do for the
  form to point to this method, but for validation errors to show up on
  the form (repopulating fields)?

 What view is your form in then? The add action will automatically try  
 to render the add view, naturally. If this is not where your form is,  
 override it with $this-render();

  This is not very well-documented, or
  if it is, I had difficulty finding an answer.

 http://book.cakephp.org/view/428/render
--~--~-~--~~~---~--~~
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: Forms not validating while using EmailComponent?

2008-09-18 Thread David C. Zentgraf

I'm not 100% sure, but I think older versions of Cake required you to  
specify a rule. If you're only interested in the 'required' field,  
specify a rule that'll always validate, like '/.*/' . What version of  
Cake are you using?

Structure your app the way you see fit. It's not good form to use  
index() to add data to the database, but that's up to you to decide.  
Either you make sure that the form submits to the right action (see  
$form-create() options), or that the action renders the appropriate  
view when it's done. What works better for you I don't know.

On 18 Sep 2008, at 23:18, 703designs wrote:

 Right, that was a typo, not a paste. I think that you'll be able to
 better help me if you understand how I've designed my contact form:

 Model: Contact[name, email, city, subject, message, and a couple
 others]
 Model['validate']: Name, email, and message have 'required' = true
 Views: index (just passes in a pageTitle from the controller and
 renders a form from the model using $this-form-create('Contact') or
 equivalent -- works fine. This form automatically mapped to
 ContactsController::add(), so I created that method and put all of the
 relevant mail logic in there.

 So should I move this logic into index() and force the form to use
 that method? Or force a render of the index view and find some way to
 pass in the validation errors?

 Thanks for the help!

 On Sep 18, 9:29 am, David C. Zentgraf [EMAIL PROTECTED] wrote:
 On 18 Sep 2008, at 21:50, 703designs wrote:

 I got funny preg_match errors

 Show us your $validate rules then or go through them with a fine  
 comb.

 $this-Contact-set('$this-data);

 I hope this is not copypasted as it's invalid PHP.

 This controller's 'add' method just sends out emails
 and flashes a message to the homepage. What do I need to do for the
 form to point to this method, but for validation errors to show up  
 on
 the form (repopulating fields)?

 What view is your form in then? The add action will automatically try
 to render the add view, naturally. If this is not where your form is,
 override it with $this-render();

 This is not very well-documented, or
 if it is, I had difficulty finding an answer.

 http://book.cakephp.org/view/428/render
 


--~--~-~--~~~---~--~~
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: Forms not validating while using EmailComponent?

2008-09-18 Thread 703designs

So a rendered view will automatically receive validation messages? In
which variable? If I need to set a var, what should my target be
($this-set('errors', /* what here? */))? I tried substituting a
minLength 1 rule yesterday and if it worked, I would not have changed
it, although I can't with certainty say whether validation simply
never happened or if I got these same errors.

I think that if I render index, that will do the job, as long as I can
get error messages to present. Isn't there a resource about this
(practical form validation)? The blog application, if I recall
correctly, just saves data but doesn't address any fields on an
individual basis, which I need for my template. I know that I'm
missing something, and the Model, View, and Controller sections of the
Cookbook aren't doing much to find the answer (same goes for the
FormHelper and EmailComponent API docs, the latter of which is
definitely a work in progress)?

On Sep 18, 10:36 am, David C. Zentgraf [EMAIL PROTECTED] wrote:
 I'm not 100% sure, but I think older versions of Cake required you to  
 specify a rule. If you're only interested in the 'required' field,  
 specify a rule that'll always validate, like '/.*/' . What version of  
 Cake are you using?

 Structure your app the way you see fit. It's not good form to use  
 index() to add data to the database, but that's up to you to decide.  
 Either you make sure that the form submits to the right action (see  
 $form-create() options), or that the action renders the appropriate  
 view when it's done. What works better for you I don't know.

 On 18 Sep 2008, at 23:18, 703designs wrote:

  Right, that was a typo, not a paste. I think that you'll be able to
  better help me if you understand how I've designed my contact form:

  Model: Contact[name, email, city, subject, message, and a couple
  others]
  Model['validate']: Name, email, and message have 'required' = true
  Views: index (just passes in a pageTitle from the controller and
  renders a form from the model using $this-form-create('Contact') or
  equivalent -- works fine. This form automatically mapped to
  ContactsController::add(), so I created that method and put all of the
  relevant mail logic in there.

  So should I move this logic into index() and force the form to use
  that method? Or force a render of the index view and find some way to
  pass in the validation errors?

  Thanks for the help!

  On Sep 18, 9:29 am, David C. Zentgraf [EMAIL PROTECTED] wrote:
  On 18 Sep 2008, at 21:50, 703designs wrote:

  I got funny preg_match errors

  Show us your $validate rules then or go through them with a fine  
  comb.

  $this-Contact-set('$this-data);

  I hope this is not copypasted as it's invalid PHP.

  This controller's 'add' method just sends out emails
  and flashes a message to the homepage. What do I need to do for the
  form to point to this method, but for validation errors to show up  
  on
  the form (repopulating fields)?

  What view is your form in then? The add action will automatically try
  to render the add view, naturally. If this is not where your form is,
  override it with $this-render();

  This is not very well-documented, or
  if it is, I had difficulty finding an answer.

 http://book.cakephp.org/view/428/render


--~--~-~--~~~---~--~~
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: Forms not validating while using EmailComponent?

2008-09-18 Thread David C. Zentgraf

On 18 Sep 2008, at 23:53, 703designs wrote:

 So a rendered view will automatically receive validation messages? In
 which variable?

Yes. When a model is validated in the controller, invalid fields will  
be noted in a variable. Don't know of the top of my head in which one,  
do a debug($this) in the view and you'll find it. You don't need to  
worry about it though. The FormHelper automatically picks up on this  
variable and prints corresponding error messages. It also picks up on  
data in $this-data to fill in form fields, that's how data is handed  
back to the form. The important thing for this to work is that the  
Model.field names are correct, but if it returns to the same form  
(read: renders the same view) the data came from this shouldn't be a  
problem.

You can manually invalidate fields in the controller if you want to  
test this procedure.

 If I need to set a var, what should my target be
 ($this-set('errors', /* what here? */))? I tried substituting a
 minLength 1 rule yesterday and if it worked, I would not have changed
 it, although I can't with certainty say whether validation simply
 never happened or if I got these same errors.

 I think that if I render index, that will do the job, as long as I can
 get error messages to present. Isn't there a resource about this
 (practical form validation)? The blog application, if I recall
 correctly, just saves data but doesn't address any fields on an
 individual basis, which I need for my template. I know that I'm
 missing something, and the Model, View, and Controller sections of the
 Cookbook aren't doing much to find the answer (same goes for the
 FormHelper and EmailComponent API docs, the latter of which is
 definitely a work in progress)?

 On Sep 18, 10:36 am, David C. Zentgraf [EMAIL PROTECTED] wrote:
 I'm not 100% sure, but I think older versions of Cake required you to
 specify a rule. If you're only interested in the 'required' field,
 specify a rule that'll always validate, like '/.*/' . What version of
 Cake are you using?

 Structure your app the way you see fit. It's not good form to use
 index() to add data to the database, but that's up to you to decide.
 Either you make sure that the form submits to the right action (see
 $form-create() options), or that the action renders the appropriate
 view when it's done. What works better for you I don't know.

 On 18 Sep 2008, at 23:18, 703designs wrote:

 Right, that was a typo, not a paste. I think that you'll be able to
 better help me if you understand how I've designed my contact form:

 Model: Contact[name, email, city, subject, message, and a couple
 others]
 Model['validate']: Name, email, and message have 'required' = true
 Views: index (just passes in a pageTitle from the controller and
 renders a form from the model using $this-form-create('Contact')  
 or
 equivalent -- works fine. This form automatically mapped to
 ContactsController::add(), so I created that method and put all of  
 the
 relevant mail logic in there.

 So should I move this logic into index() and force the form to use
 that method? Or force a render of the index view and find some way  
 to
 pass in the validation errors?

 Thanks for the help!

 On Sep 18, 9:29 am, David C. Zentgraf [EMAIL PROTECTED] wrote:
 On 18 Sep 2008, at 21:50, 703designs wrote:

 I got funny preg_match errors

 Show us your $validate rules then or go through them with a fine
 comb.

 $this-Contact-set('$this-data);

 I hope this is not copypasted as it's invalid PHP.

 This controller's 'add' method just sends out emails
 and flashes a message to the homepage. What do I need to do for  
 the
 form to point to this method, but for validation errors to show up
 on
 the form (repopulating fields)?

 What view is your form in then? The add action will automatically  
 try
 to render the add view, naturally. If this is not where your form  
 is,
 override it with $this-render();

 This is not very well-documented, or
 if it is, I had difficulty finding an answer.

 http://book.cakephp.org/view/428/render


 


--~--~-~--~~~---~--~~
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: Forms not validating while using EmailComponent?

2008-09-18 Thread Brett Wilton

pr($this-validationErrors) in your view will show you the errors.

---
Brett Wilton
http://wiltonsoftware.com

On Fri, Sep 19, 2008 at 12:31 PM, David C. Zentgraf [EMAIL PROTECTED] wrote:

 On 18 Sep 2008, at 23:53, 703designs wrote:

 So a rendered view will automatically receive validation messages? In
 which variable?

 Yes. When a model is validated in the controller, invalid fields will
 be noted in a variable. Don't know of the top of my head in which one,
 do a debug($this) in the view and you'll find it. You don't need to
 worry about it though. The FormHelper automatically picks up on this
 variable and prints corresponding error messages. It also picks up on
 data in $this-data to fill in form fields, that's how data is handed
 back to the form. The important thing for this to work is that the
 Model.field names are correct, but if it returns to the same form
 (read: renders the same view) the data came from this shouldn't be a
 problem.

 You can manually invalidate fields in the controller if you want to
 test this procedure.


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



Forms not validating while using EmailComponent?

2008-09-17 Thread 703designs

How can I check if the data is valid before trying to send the mail
out? Validation errors are falling into the email failed condition,
and validation errors aren't reported to the user.
--~--~-~--~~~---~--~~
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: Edit forms in Internet Explorer

2008-09-13 Thread chicklin

Wow, that's pretty obscure.  Yes, I'm using mod_auth_sspi.  It was so
easy to set up, I hate to change to LDAP, but it looks like that's
going to be necessary.  Thanks for the suggestion, I'll give it a try.

On Sep 12, 6:32 pm, Niko [EMAIL PROTECTED] wrote:
 I was having the exact same problem until I disable the mod_auth_sspi
 module. I then replaced it with mod_authnz_ldap and everything works
 fine. Maybe you can check something at a module level. When I set a
 proxy between the web server and IE I found out that when it got stuck
 all the server got was GET request and no PUT. If you wait a couple of
 seconds and hit the submit button you got a PUT request, as expected.
 Hope that helps.
 Nico.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



upgrading to 1.2 and non-ascii characters in forms

2008-09-13 Thread igor

Hello,

I'm in a middle of migrating a project from cake 1.1 to 1.2. I've got
most pages to display, but I ran into one problem with forms. Source
code in a view goes like this:

$miesiace=array('Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec','Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień');
echo $form-input('Zamowienie.miesiac',array( 'label'= '',
'type'='select', 'options'=$miesiace, 'selected'=date(m)-1) );

which generates HTML:

option value=0/option
option value=1Luty/option
option value=2Marzec/option
option value=3/option
option value=4Maj/option

All options with non-ascii characters are blank. It used to work with
1.1. Any ideas?

Also, is there a more comprehensive upgrade guide than
http://book.cakephp.org/view/411/Migrating-from-CakePHP-1-1-to-1-2 ?
This one doesn't seem to cover all the changes.

--~--~-~--~~~---~--~~
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: Edit forms in Internet Explorer

2008-09-12 Thread Niko

I was having the exact same problem until I disable the mod_auth_sspi
module. I then replaced it with mod_authnz_ldap and everything works
fine. Maybe you can check something at a module level. When I set a
proxy between the web server and IE I found out that when it got stuck
all the server got was GET request and no PUT. If you wait a couple of
seconds and hit the submit button you got a PUT request, as expected.
Hope that helps.
Nico.

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



Edit forms in Internet Explorer

2008-09-09 Thread chicklin

Hello, using cake_1.2.0.7296-rc2 under Apache/PHP5/Windows

I'm having a problem where when I submit a form to edit a database
entity, the controller sometimes does not recognize $this-data as
being set and sends me back to the orignal edit form.  The weird thing
is, that if I try it a couple times, it eventually works and saves the
updates.  It seems like if I wait several seconds between modifying
the form and hitting submit it works more reliably.  If I make the
form change and click submit quickly, I can do this over and over
without ever getting the update saved.

The other weird thing is that this only happens in Internet Explorer,
not Firefox.  My form and controller were generated with bake.  Any
ideas?

--~--~-~--~~~---~--~~
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: Edit forms in Internet Explorer

2008-09-09 Thread scs

I suggest posting the view and controller. The first thing I would
look at is there any JavaScript that IE is having issue with.

On Sep 9, 10:46 am, chicklin [EMAIL PROTECTED] wrote:
 Hello, using cake_1.2.0.7296-rc2 under Apache/PHP5/Windows

 I'm having a problem where when I submit a form to edit a database
 entity, the controller sometimes does not recognize $this-data as
 being set and sends me back to the orignal edit form.  The weird thing
 is, that if I try it a couple times, it eventually works and saves the
 updates.  It seems like if I wait several seconds between modifying
 the form and hitting submit it works more reliably.  If I make the
 form change and click submit quickly, I can do this over and over
 without ever getting the update saved.

 The other weird thing is that this only happens in Internet Explorer,
 not Firefox.  My form and controller were generated with bake.  Any
 ideas?
--~--~-~--~~~---~--~~
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: Edit forms in Internet Explorer

2008-09-09 Thread chicklin

There is no Javascript in the page whatsoever.  If you read through
the controller logic, the only way that the form will return to itself
without doing anything is if $this-data is not set (i.e. empty($this-
data)).

Here is the controller:


?php
class DomainsController extends AppController {

var $name = 'Domains';
var $helpers = array('Html', 'Form');

function index() {
$this-Domain-recursive = 0;
$this-set('domains', $this-paginate());
}

function view($id = null) {
if (!$id) {
$this-Session-setFlash(__('Invalid Domain.', true));
$this-redirect(array('action'='index'));
}
$this-set('domain', $this-Domain-read(null, $id));
}

function add() {
if (!empty($this-data)) {
$this-Domain-create();
if ($this-Domain-save($this-data)) {
$this-Session-setFlash(__('The Domain has 
been saved', true));

$this-redirect(array('action'='view','id'=$this-Domain-
getInsertID()));
} else {
$this-Session-setFlash(__('The Domain could 
not be saved.
Please, try again.', true));
}
}
$groups = $this-Domain-Group-find('list');
$nodes = $this-Domain-Node-find('list');
$this-set(compact('groups', 'nodes'));
}

function edit($id = null) {
if (!$id  empty($this-data)) {
$this-Session-setFlash(__('Invalid Domain', true));
$this-redirect(array('action'='index'));
}
if (!empty($this-data)) {
if ($this-Domain-save($this-data)) {
$this-Session-setFlash(__('The Domain has 
been saved', true));

$this-redirect(array('action'='view','id'=$id));
} else {
$this-Session-setFlash(__('The Domain could 
not be saved.
Please, try again.', true));
}
}
if (empty($this-data)) {
$this-data = $this-Domain-read(null, $id);
}
$groups = $this-Domain-Group-find('list');
$nodes = $this-Domain-Node-find('list');
$this-set(compact('groups','nodes'));
}

function delete($id = null) {
if (!$id) {
$this-Session-setFlash(__('Invalid id for Domain', 
true));
$this-redirect(array('action'='index'));
}
if ($this-Domain-del($id)) {
$this-Session-setFlash(__('Domain deleted', true));
$this-redirect(array('action'='index'));
}
}

}
?



and here is the view



div class=actions
?php echo $html-link(__('Back To Domain', true),
array('action'='view', $this-data['Domain']['id']));?
/div
div class=domains form
?php echo $form-create('Domain');?
fieldset
legend?php __('Edit Domain');?/legend
?php
echo $form-input('id');
echo $form-input('name');
echo $form-input('username', array('label'='Username (OS)'));
echo $form-input('grp', array('label'='Group (OS)'));
echo $form-input('environment');
?
div class='input checkbox'
?php
echo $form-label('Restricted?');
echo $form-checkbox('restricted');
?
/div
?php
echo $form-input('Group');
echo $form-input('Node');
?
/fieldset
?php echo $form-end('Submit');?
/div



On Sep 9, 10:15 am, scs [EMAIL PROTECTED] wrote:
 I suggest posting the view and controller. The first thing I would
 look at is there any JavaScript that IE is having issue with.

 On Sep 9, 10:46 am, chicklin [EMAIL PROTECTED] wrote:

  Hello, using cake_1.2.0.7296-rc2 under Apache/PHP5/Windows

  I'm having a problem where when I submit a form to edit a database
  entity, the controller sometimes does not recognize $this-data as
  being set and sends me back to the orignal edit form.  The weird thing
  is, that if I try it a couple times, it eventually works and saves the
  updates.  It seems like if I wait several seconds between modifying
  the form and hitting submit it works more reliably.  If I make the
  form change and click submit quickly, I can do this over and over
  without ever getting the update saved.

  The other weird thing is that this only happens in Internet Explorer,
  not Firefox.  My form and controller were generated with bake.  Any
  ideas?

Multiple AJAX forms per page from the same source

2008-09-07 Thread Warringer

I have a database driven galery.

CREATE TABLE EXISTS `galeries` (
  `id` int(11) NOT NULL auto_increment,
  `year` year(4) NOT NULL,
  `titel` tinytext NOT NULL,
  `subtitle` tinytext NOT NULL,
  `folder` tinytext NOT NULL,
  PRIMARY KEY  (`id`)
)


CREATE TABLE EXISTS `images` (
  `id` int(11) NOT NULL auto_increment,
  `sort` int(11) NOT NULL,
  `galery_id` int(11) NOT NULL default '0',
  `title` tinytext NOT NULL,
  `subtitle` tinytext NOT NULL,
  `name` tinytext NOT NULL,
  `folder` tinytext NOT NULL,
  PRIMARY KEY  (`id`)
)

The galery hasMany Images. Based on the debug output, the edit method
saves the images into $this-data as well as the galery data.

Now I want to use the same edit view to edit all the images data as
well, using AJAX to update them. How can I do that without having to
handcode everything?

--~--~-~--~~~---~--~~
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: Handling HTML special chars from user generated content ( e.g. forms)

2008-08-29 Thread Mark (Germany)

i dont see the reason for changing them to HTML code anyway - as with
utf8 they can all be handled and displayed as they originally are.


On 28 Aug., 17:46, worthy [EMAIL PROTECTED] wrote:
 You saved my day. :D

 I was messing with this problem the whole day and never thought it
 would be that simple :).

 Thank you so much for this simple solution!

 Greetings
 worthy

 On 28 Aug., 17:38, Günther Theilen [EMAIL PROTECTED] wrote:

  Hi,

  do you use the form helper?
  If so try something like this:

  $form-input('foo.bar', array('escape' = false))

  Regards
  Guenther

  worthy schrieb:

   Another explaining example for the edit form:

  http://localhost/regions/edit/15

   data['Regions']['id']=15
   data['Regions']['name']='Test auml;'

   Now when cakephp fills the form with this data the value of the field
   changes from

   'Test auml;' to 'Test amp;auml;'

   And so the field shows 'Test auml; instead of 'Test ä'

   Is there any way to tell cakephp not to check for specialchars?

   Maybe now there is some help? :P

   Greetings
   worthy


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



Handling HTML special chars from user generated content ( e.g. forms)

2008-08-28 Thread worthy

Hi bakers,
as by the last week i am really getting into CakePHP and enjoy the
easeness of the creation process.

But i have one simple problem.
In every form of the project where users can input data, they can for
example input ( ä,ö,ü, é... and special chars like %§%/ or whatever)

So i want to write a system function that converts all these chars to
their html form. That is for example a ä becomes auml; etc.

To approach this i already wrote a function that does this exactly:

function htmlizeArray($txtArray) {
if (is_array($txtArray)) {
foreach ($txtArray as $key = $val) {
htmlizeArray($val);
}
}
else {
$txtArray = htmlentities($txtArray);
}
}

So now i have to know where to put this function in the source to
access it from every controller that i have made.
Because in the controllers where i anyhow deal with posted form data i
want to htmlize the data.

All the form data from a specific view is in the controller accessed
by $this-data.

So what i want to do now is to htmlize it with

htmlizeArray($this-data);

So maybe you can help me out with it.

Greetings from Germany
worthy
--~--~-~--~~~---~--~~
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: Handling HTML special chars from user generated content ( e.g. forms)

2008-08-28 Thread worthy

Hi bakers again :),
i managed to do it another way.

These two function provided below are the key for it. As you can see I
placed them inside of the app_controller.php



class AppController extends Controller {

function htmlchars($data) {

if (empty($data)) {
return $data;
}

if (is_array($data)) {
foreach ($data as $key = $val) {
$data[$key] = $this-htmlchars($val);
}
return $data;
}
else {
$patterns = array(/\/, /%/, //, //, '//', 
/'/, /\
(/, /\)/, /\+/, /-/, /ä/, /Ä/, /ö/, /Ö/, /ü/, /Ü/);
$replacements = array(amp;, #37;, lt;, gt;, 
quot;,
#39;, #40;, #41;, #43;, #45;, auml;, Auml;,
ouml;, Ouml;, uuml;, Uuml;);
$data = preg_replace($patterns, $replacements, $data);
return $data;
}
}

function unhtmlchars($data) {

if (empty($data)) {
return $data;
}

if (is_array($data)) {
foreach ($data as $key = $val) {
$data[$key] = $this-unhtmlchars($val);
}
return $data;
}
else {
$patterns = array(/amp;/, /#37;/, /lt;/, 
/gt;/, /
quot;/, /#39;/, /#40;/, /#41;/, /#43;/, /#45;/, /
auml;/, /Auml;/, /ouml;/, /Ouml;/, /uuml;/, /Uuml;/);
$replacements = array(, %, , , '', ', 
(, ), +,
-, ä, Ä, ö, Ö, ü, Ü);

$data = preg_replace($patterns, $replacements, $data);
return $data;
}
}

}

So if i retrieve any data for a view i simply do $cleandata = $this-
htmlchars($this-data); and use $cleandata for now on.
The same with unhtmlchars().



The only problem i have now is the following.

Lets say I have an edit form with a Name field.
If the Name contains no special chars like ä,ö,ü etc. the value
of the field is filled automatically through the $form helper, but if
the Name contains one of those special chars, the field is not filled.

I don't know how to solve this.

Please help me as I'm stuck here.

Thanks in advance
worthy
--~--~-~--~~~---~--~~
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: Handling HTML special chars from user generated content ( e.g. forms)

2008-08-28 Thread worthy

Another explaining example for the edit form:

http://localhost/regions/edit/15

data['Regions']['id']=15
data['Regions']['name']='Test auml;'

Now when cakephp fills the form with this data the value of the field
changes from

'Test auml;' to 'Test amp;auml;'

And so the field shows 'Test auml; instead of 'Test ä'

Is there any way to tell cakephp not to check for specialchars?

Maybe now there is some help? :P

Greetings
worthy
--~--~-~--~~~---~--~~
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: Forms not associated to models - alternative to the Form core helper?

2008-08-27 Thread RichardAtHome

You may not think it now but your form IS related to a model ;-)

See Jonathan snooks example of a contact form:
http://snook.ca/archives/cakephp/contact_form_cakephp/

Jonathan creates a tableless model and defines the schema by hand.
That way you get all the benefit of cake's helpers (validation etc.)

On Aug 26, 5:29 pm, Enrique Delgado [EMAIL PROTECTED] wrote:
 Thanks Samuel and validkeys.

 Samuel, very true, I do like extending the functionality of CakePHP,
 that is probably one of the best ways to go when we need something
 more custom.

 This time, I had totally overlooked the regular Form helper methods
 like text(), password(), etc. Thanks validkeys for pointing this out.
 I was getting too caught up and spoiled by the input() automagic
 method, my bad.

 Using the regular methods works just fine.

 Thanks!

 On Aug 26, 11:15 am, validkeys [EMAIL PROTECTED]
 wrote:

  Hey Enrique,

  You could still use the regular forms:

  ?php echo $form-create('Search',array('url' = '/search','type' =
  'get')) ?

  ?php echo $form-text('query',array('type' = 'textarea')) ?

  ?php echo $form-end('Search!') ?

  On Aug 26, 11:45 am, Enrique Delgado [EMAIL PROTECTED]
  wrote:

   Hi All,

   The core Form helper works great as long as you have a model behind
   it, but what about forms that are not related to a model?

   Is there any helpers that I can use in the view? Or do I just code
   plain HTML?

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



Forms not associated to models - alternative to the Form core helper?

2008-08-26 Thread Enrique Delgado

Hi All,

The core Form helper works great as long as you have a model behind
it, but what about forms that are not related to a model?

Is there any helpers that I can use in the view? Or do I just code
plain HTML?

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



Re: Forms not associated to models - alternative to the Form core helper?

2008-08-26 Thread Samuel DeVore

On Tue, Aug 26, 2008 at 8:45 AM, Enrique Delgado
[EMAIL PROTECTED] wrote:

 Hi All,

 The core Form helper works great as long as you have a model behind
 it, but what about forms that are not related to a model?

 Is there any helpers that I can use in the view? Or do I just code
 plain HTML?

You could make your own helper... based or extending on the
FormHelper that doesn't need to be model backed.  Though there are
ways around (or to work within that limitation) making models that are
not DB backed for one, there are other 'tricks' as well.

The thing is the time you make a decision to deviate from the
expectations and conventions of the design of CakePHP is the time you
have to be willing to dig into the code, search around, and to think
on your own.  It really is not that hard and CakePHP is a lot more
flexible then people give it credit for, but 'official documentation'
for taking a 'custom' path really should not be expected.  I for one
love going my own way or bending CakePHP to my will but it takes
effort creativity and a willingness to be comfortable digging around
and being frustrated.

In my humble (mostly) opinion.  Have fun dig and share (that last part
I need to work on better I am sure)

Sam D


-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
http://blog.samdevore.com/cakephp-pages/i-cant-bake/

--~--~-~--~~~---~--~~
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: Forms not associated to models - alternative to the Form core helper?

2008-08-26 Thread validkeys

Hey Enrique,

You could still use the regular forms:

?php echo $form-create('Search',array('url' = '/search','type' =
'get')) ?

?php echo $form-text('query',array('type' = 'textarea')) ?

?php echo $form-end('Search!') ?


On Aug 26, 11:45 am, Enrique Delgado [EMAIL PROTECTED]
wrote:
 Hi All,

 The core Form helper works great as long as you have a model behind
 it, but what about forms that are not related to a model?

 Is there any helpers that I can use in the view? Or do I just code
 plain HTML?

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



Re: Forms not associated to models - alternative to the Form core helper?

2008-08-26 Thread Enrique Delgado

Thanks Samuel and validkeys.

Samuel, very true, I do like extending the functionality of CakePHP,
that is probably one of the best ways to go when we need something
more custom.

This time, I had totally overlooked the regular Form helper methods
like text(), password(), etc. Thanks validkeys for pointing this out.
I was getting too caught up and spoiled by the input() automagic
method, my bad.

Using the regular methods works just fine.

Thanks!

On Aug 26, 11:15 am, validkeys [EMAIL PROTECTED]
wrote:
 Hey Enrique,

 You could still use the regular forms:

 ?php echo $form-create('Search',array('url' = '/search','type' =
 'get')) ?

 ?php echo $form-text('query',array('type' = 'textarea')) ?

 ?php echo $form-end('Search!') ?

 On Aug 26, 11:45 am, Enrique Delgado [EMAIL PROTECTED]
 wrote:

  Hi All,

  The core Form helper works great as long as you have a model behind
  it, but what about forms that are not related to a model?

  Is there any helpers that I can use in the view? Or do I just code
  plain HTML?

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



Re: One to many forms with ajax

2008-07-12 Thread Andraž

Did you find the solution?

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



Possible security risk when saving data in forms - adding fields

2008-07-05 Thread phpjoy

When getting a form from a user, it should be double checked in the
user's action logic.
A user could easily manipulate a form field to submit a new field to
the server, like id=4294967294, and stuck the users table. The user
could guess, of course, other field names, or see other forms/views
and get the field names from there.
It has unlimited possibilities, like change the field created
modified lastvisit user.id and a lot more.
I tested it out on a company's blogging system, and I could easily
modify the created field to 2007.

Throughout the examples in the manual (1.2 and 1.1), I haven't noticed
any reminder of that possible risk, though I noticed the bad
programming habits shown in the blog example and old 1.1 manual.

function add() {
  if (!empty($this-data)) {
if ($this-Post-save($this-data)) {
  $this-flash('Your post has been saved.','/posts');
}
  }
}

Is there a function that I'm unaware of, that locks the fields from
the form?
Like: Controller-ExpectFields = array('Post.name', 'Post.title');

I checked the bakery's code, and found out that after adding a comment
[the add form is secured], you could edit the comment to belong to
another user by sending Comment.user_id from a form. I assume getting
them isn't too hard, for it's probably found in the generated HTML
code of the profiles.

Any thoughts about it?

--~--~-~--~~~---~--~~
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: Possible security risk when saving data in forms - adding fields

2008-07-05 Thread Dr. Tarique Sani
On Sat, Jul 5, 2008 at 11:37 AM, phpjoy [EMAIL PROTECTED] wrote:


 Throughout the examples in the manual (1.2 and 1.1), I haven't noticed
 any reminder of that possible risk, though I noticed the bad


http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd428f5c81

Notice the third param

HTH

Tarique

-- 
=
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 
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: Possible security risk when saving data in forms - adding fields

2008-07-05 Thread the_woodsman

I think you can also do this globally for a model using its $whitelist
field.

On Jul 5, 7:11 am, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
 On Sat, Jul 5, 2008 at 11:37 AM, phpjoy [EMAIL PROTECTED] wrote:

  Throughout the examples in the manual (1.2 and 1.1), I haven't noticed
  any reminder of that possible risk, though I noticed the bad

 http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd4...

 Notice the third param

 HTH

 Tarique

 --
 =
 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 
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: Editing model's primary key in forms

2008-07-01 Thread Bryan D

Thanks guys, that works perfectly.  I take it the Player.id form is
now preferred over Player/id ? I ported my app from Cake 1.1 to 1.2,
and probably missed a few things.

On Jun 30, 4:41 am, Jonathan Snook [EMAIL PROTECTED] wrote:
 On Sun, Jun 29, 2008 at 6:19 AM, Mr. Matt [EMAIL PROTECTED] wrote:

  I believe this should work:

  ?php echo $form-input('Player/id', array('type' = 'text')); ?

 Just to clarify, it's Player.id (notice the . instead of the /)

--~--~-~--~~~---~--~~
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: Editing model's primary key in forms

2008-07-01 Thread Jonathan Snook

Yes, that's correct. It now uses a period instead of a slash.

On Tue, Jul 1, 2008 at 1:50 PM, Bryan D [EMAIL PROTECTED] wrote:

 Thanks guys, that works perfectly.  I take it the Player.id form is
 now preferred over Player/id ? I ported my app from Cake 1.1 to 1.2,
 and probably missed a few things.

--~--~-~--~~~---~--~~
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: Editing model's primary key in forms

2008-06-30 Thread Mr. Matt

I believe this should work:

?php echo $form-input('Player/id', array('type' = 'text')); ?

On Jun 27, 5:54 pm, Bryan D [EMAIL PROTECTED] wrote:
 I would like to allow a model's primary key field (named id) to be
 editable, at least upon creation of a new object. I noticed that using
 syntax like:
  ?php echo $form-input('Player/id') ?
 doesn't work because CakePHP converts it to a hidden field
 automatically.  Is there some way I can override this?

 I worked around the problem when creating new objects by using raw
 html.  However, I'm not sure how to access the value of the model
 object's ID field in my edit form.  In fact, how do I access any of
 the object's data?  In most views I use $data['Modelname'] etc., but
 that doesn't work in the add/edit views.

 Thanks,
 Bryan

--~--~-~--~~~---~--~~
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: Editing model's primary key in forms

2008-06-30 Thread Jonathan Snook

On Sun, Jun 29, 2008 at 6:19 AM, Mr. Matt [EMAIL PROTECTED] wrote:

 I believe this should work:

 ?php echo $form-input('Player/id', array('type' = 'text')); ?

Just to clarify, it's Player.id (notice the . instead of the /)

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



Editing model's primary key in forms

2008-06-28 Thread Bryan D

I would like to allow a model's primary key field (named id) to be
editable, at least upon creation of a new object. I noticed that using
syntax like:
 ?php echo $form-input('Player/id') ?
doesn't work because CakePHP converts it to a hidden field
automatically.  Is there some way I can override this?

I worked around the problem when creating new objects by using raw
html.  However, I'm not sure how to access the value of the model
object's ID field in my edit form.  In fact, how do I access any of
the object's data?  In most views I use $data['Modelname'] etc., but
that doesn't work in the add/edit views.

Thanks,
Bryan

--~--~-~--~~~---~--~~
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: Form validation - multiple forms and multiple tables used per model

2008-06-17 Thread Marcelius

Hey

Foreach form create a new instance of corresponding model where data
should be saved:

$foo = new MyModel();
foreach($posteddata){
$foo-create($myPostedData);

if ($foo-validates()){
//great...
} else {
$errors = $foo-validationErrors;
]

All your other questions are well documented btw :-)
http://manual.cakephp.org/view/125/data-validation
http://api.cakephp.org/class_model.html

On 16 jun, 23:42, koala kid [EMAIL PROTECTED] wrote:
 Hi,

 I am using one model to process and save the data for multiple forms.
 How do I run cake's validation methods on each form separately. At the
 moment you appear to define your rules in $validate outside of any
 functions/methods. How do I run it from within a method.

 In addition as my model saves to multiple tables I am not using $this-

 save(). How do I enforce validation without using this method?

 Thanks for any help.
--~--~-~--~~~---~--~~
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: Form validation - multiple forms and multiple tables used per model

2008-06-17 Thread koala kid

Hi,

thanks for your help, its really appreciated. I'm new to cake and
although I know its going to be beneficial in the long run right now
the learning curve sucks and what really makes it worse is the lack of
decent documentation.

For example the behaviour you gave me the link to seems to do exactly
what I need but it doesn't tell me where to save it and what to call
the file. Can you explain?

Thanks.

On Jun 17, 6:03 am, keymaster [EMAIL PROTECTED] wrote:
  How do I run cake's validation methods on each form separately. At the
  moment you appear to define your rules in $validate outside of any
  functions/methods. How do I run it from within a method.

 Use this behavior:

 http://bakery.cakephp.org/articles/view/using-many-validation-ruleset...

--~--~-~--~~~---~--~~
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: Form validation - multiple forms and multiple tables used per model

2008-06-17 Thread koala kid

Ok,

I dug around and found out what to name the file and where to save it,
I think. I saved the file as multi_validate.php in app/models/
behaviours/. Is this correct?

I then defined my rules eg:

var $validationSets = array(
'admin' = array(
'name' = array('rule' = 'alphanumeric'),
'email' = array('rule' = 'email'),
'age' = array('rule' = 'numeric'),
),
'prop_add' = array(
  'prop_code' = array('rule' = 'alphanumeric'),
  'city' = array('rule' = 'alphanumeric'),
  'prop_page_title' = array('rule' = 
'alphanumeric'),
  'prop_page_desc' = array('rule' = 
'alphanumeric'),
  'prop_title' = array('rule' = 
'alphanumeric'),
  'prop_location' = array('rule' = 
'alphanumeric'),
  'prop_description' = array('rule' = 
'alphanumeric'),
  'prop_features' = array('rule' = 
'alphanumeric'),
  'prop_reviews' = array('rule' = 
'alphanumeric'),
  'prop_availability' = array('rule' = 
'alphanumeric'),
  'prop_flickr' = array('rule' = 
'alphanumeric')
),
'addNewLocation' = array(
'city' = array('rule' = 'alphanumeric', 'message' = 
'Only
letters and numbers, please try again.'),
'state' = array('rule' = array('minLenght', 6), 
'message' =
'Password must be at least 6 characters long, please try again.')
)
);

I then set which set of rules to use within my method like this:

$this-Admin-setValidation('prop_add');

but the form submits without validating.

Any ideas where I am going wrong?

Thanks.

On Jun 17, 11:06 am, koala kid [EMAIL PROTECTED] wrote:
 Hi,

 thanks for your help, its really appreciated. I'm new to cake and
 although I know its going to be beneficial in the long run right now
 the learning curve sucks and what really makes it worse is the lack of
 decent documentation.

 For example the behaviour you gave me the link to seems to do exactly
 what I need but it doesn't tell me where to save it and what to call
 the file. Can you explain?

 Thanks.

 On Jun 17, 6:03 am, keymaster [EMAIL PROTECTED] wrote:

   How do I run cake's validation methods on each form separately. At the
   moment you appear to define your rules in $validate outside of any
   functions/methods. How do I run it from within a method.

  Use this behavior:

 http://bakery.cakephp.org/articles/view/using-many-validation-ruleset...

--~--~-~--~~~---~--~~
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: Form validation - multiple forms and multiple tables used per model

2008-06-17 Thread koala kid

OK, I think I worked out what to name the file and where to save it:
app/models/behaviours/multi_validate.php. However I can't get it to
work. The form submits without validating.

I first set my validation rules in the model eg:

var $actsAs = array('MultiValidatable');

/**
 * Default validation ruleset
 */
var $validate = array(
'username' = array('rule' = 'alphanumeric', 'message' 
= 'Only
letters and numbers please.'),
'password' = array('rule' = array('minLenght', 6), 
'message' =
'Password must be at least 6 characters long.')
//'email' = array('rule' = 'email', 'message' = 
'Must be a valid
email address.'),
);

/**
 * Custom validation rulesets
 */
var $validationSets = array(
'admin' = array(
'name' = array('rule' = 'alphanumeric'),
'email' = array('rule' = 'email'),
'age' = array('rule' = 'numeric'),
),
'prop_add' = array(
  'prop_code' = array('rule' = 'alphanumeric'),
  'city' = array('rule' = 'alphanumeric'),
  'prop_page_title' = array('rule' = 
'alphanumeric'),
  'prop_page_desc' = array('rule' = 
'alphanumeric'),
  'prop_title' = array('rule' = 
'alphanumeric'),
  'prop_location' = array('rule' = 
'alphanumeric'),
  'prop_description' = array('rule' = 
'alphanumeric'),
  'prop_features' = array('rule' = 
'alphanumeric'),
  'prop_reviews' = array('rule' = 
'alphanumeric'),
  'prop_availability' = array('rule' = 
'alphanumeric'),
  'prop_flickr' = array('rule' = 
'alphanumeric')
),

I then call the method within my method prop_add() in the controller
like this:

$this-Admin-setValidation('prop_add');

Any ideas?

On Jun 17, 11:06 am, koala kid [EMAIL PROTECTED] wrote:
 Hi,

 thanks for your help, its really appreciated. I'm new to cake and
 although I know its going to be beneficial in the long run right now
 the learning curve sucks and what really makes it worse is the lack of
 decent documentation.

 For example the behaviour you gave me the link to seems to do exactly
 what I need but it doesn't tell me where to save it and what to call
 the file. Can you explain?

 Thanks.

 On Jun 17, 6:03 am, keymaster [EMAIL PROTECTED] wrote:

   How do I run cake's validation methods on each form separately. At the
   moment you appear to define your rules in $validate outside of any
   functions/methods. How do I run it from within a method.

  Use this behavior:

 http://bakery.cakephp.org/articles/view/using-many-validation-ruleset...

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



Form validation - multiple forms and multiple tables used per model

2008-06-16 Thread koala kid

Hi,

I am using one model to process and save the data for multiple forms.
How do I run cake's validation methods on each form separately. At the
moment you appear to define your rules in $validate outside of any
functions/methods. How do I run it from within a method.

In addition as my model saves to multiple tables I am not using $this-
save(). How do I enforce validation without using this method?

Thanks for any help.

--~--~-~--~~~---~--~~
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: Formatting Forms

2008-05-03 Thread [EMAIL PROTECTED]

I think you are over generalizing the standard (recommended by w3c)
that tables shouldn't be used for web page layouts. It's fine to use
tables to format data and forms, it's also just as fine not to use
tables for format forms. Don't feel bad about using tables to format
forms :).

Take Care,
Anthony

On May 2, 9:43 am, annie.r.knight [EMAIL PROTECTED]
wrote:
 Hi all.

 I have an app with a number of longformsin. Theseformsare
 formatted in tables with each row looking something like: thInput
 Label/thtdText Box [Or Whatever]/td. While the long term
 solution clearly is to migrate this to CSS design I'm going for the
 quick (and dirty) solution for now using Cake to generate the form and
 then putting it into the table.

 All I'm doing is to set each input's 'label' option to '' [blank] and
 manually putting the Label I want in an adjacent table cell.

 Is there a better way of doing this?

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



Formatting Forms

2008-05-02 Thread annie.r.knight

Hi all.

I have an app with a number of long forms in. These forms are
formatted in tables with each row looking something like: thInput
Label/thtdText Box [Or Whatever]/td. While the long term
solution clearly is to migrate this to CSS design I'm going for the
quick (and dirty) solution for now using Cake to generate the form and
then putting it into the table.

All I'm doing is to set each input's 'label' option to '' [blank] and
manually putting the Label I want in an adjacent table cell.

Is there a better way of doing this?

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



<    1   2   3   4   5   6   >