Re: display validation error messages for textarea?

2007-11-09 Thread avairet

Hello and thank's for replies!

Do you know if it's scheduled to optimize the $form-textarea method
in next releases?
Because is not natural using $form-input for this kind of
field... and it's not practical using 3 instructions instead of 1!
The same problem exists within $form-checkbox...

Bye

Avairet




On 8 nov, 19:45, Radish [EMAIL PROTECTED] wrote:
 maybe instead of

 echo $form-textarea('Article.contenu');

 use

 echo $form-input('Article.contenu', array(
'type' = 'textarea'
 ));


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



Re: display validation error messages for textarea?

2007-11-09 Thread AD7six



On Nov 9, 10:13 am, avairet [EMAIL PROTECTED] wrote:
 Hello and thank's for replies!

 Do you know if it's scheduled to optimize the $form-textarea method
 in next releases?
 Because is not natural using $form-input for this kind of
 field...

How so? Irrespective of how html represents it, it's user input.

Try some more cakey code, you might like it:

[code]
h2Ajout article/h2
?php
echo $errorMessage;
echo $form-create('Article');
echo $form-inputs(
 'Article.titre',
 'Article.sous_titre',
 'Article.chapeau', // /*Only if the default isn't what you want
*/ = array('type' = 'x'),
 'Article.contenu',
 'Article.auteur',
);
echo $form-submit('Enregistrer);
echo $form-end();
?
[/code]

Note that
 inputs just calls input in a loop with whatever you pass it.
 you only need to define params where the defaults are not what you
want. and it looks like you only want the defaults.

 and it's not practical using 3 instructions instead of 1!

So stop using the building block methods and use input/inputs instead.

 The same problem exists within $form-checkbox...

By design ;)

hth,

AD


 Bye

 Avairet

 On 8 nov, 19:45, Radish [EMAIL PROTECTED] wrote:

  maybe instead of

  echo $form-textarea('Article.contenu');

  use

  echo $form-input('Article.contenu', array(
 'type' = 'textarea'
  ));


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



Re: display validation error messages for textarea?

2007-11-09 Thread avairet

OK AD! Thank's for your help.

How so? Irrespective of how html represents it, it's user input.
Yes, all fields in a form are user input, but in (X)HTML and
semantic context, a textarea is different to a text input!
And if a method is called textarea and an other input, the
developer is tempted using each to keep some coherence with HTML
syntax...

I've understood inputs method, but I've made some tests and it
didn't work fine... I'll try it again.

BR,

Avairet



On 9 nov, 11:12, AD7six [EMAIL PROTECTED] wrote:
 On Nov 9, 10:13 am, avairet [EMAIL PROTECTED] wrote:

  Hello and thank's for replies!

  Do you know if it's scheduled to optimize the $form-textarea method
  in next releases?
  Because is not natural using $form-input for this kind of
  field...

 How so? Irrespective of how html represents it, it's user input.

 Try some more cakey code, you might like it:

 [code]
 h2Ajout article/h2
 ?php
 echo $errorMessage;
 echo $form-create('Article');
 echo $form-inputs(
  'Article.titre',
  'Article.sous_titre',
  'Article.chapeau', // /*Only if the default isn't what you want
 */ = array('type' = 'x'),
  'Article.contenu',
  'Article.auteur',
 );
 echo $form-submit('Enregistrer);
 echo $form-end();
 ?
 [/code]

 Note that
  inputs just calls input in a loop with whatever you pass it.
  you only need to define params where the defaults are not what you
 want. and it looks like you only want the defaults.

  and it's not practical using 3 instructions instead of 1!

 So stop using the building block methods and use input/inputs instead.

  The same problem exists within $form-checkbox...

 By design ;)

 hth,

 AD



  Bye

  Avairet

  On 8 nov, 19:45, Radish [EMAIL PROTECTED] wrote:

   maybe instead of

   echo $form-textarea('Article.contenu');

   use

   echo $form-input('Article.contenu', array(
  'type' = 'textarea'
   ));


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



display validation error messages for textarea?

2007-11-08 Thread avairet

Hi everybody,

I'm French and I'm using CakePhp 1.2 since one month.
I don't understand why the validation error messages are not
displaying for a textarea field...

My model:

[code]
class Article extends AppModel {
public $name = 'Article';

public $validate = array (
  'titre' =
array(
'rule' = VALID_NOT_EMPTY,
'message' = 'Le titre est obligatoire !'
),

'contenu' =
array(
'rule' = VALID_NOT_EMPTY,
'message' = 'Le contenu est obligatoire !'
),

'auteur' =
array(
'rule' = VALID_NOT_EMPTY,
'message' = 'L\'auteur est obligatoire !'
)
   );
}
[/code]

And my view :
[code]
h2Ajout article/h2
?= $errorMessage; ?
form id=AjoutArticle method=post action=?php echo $html-url('/
admin/articles/add/')?
?php
echo $form-input('Article.titre');
echo $form-input('Article.sous_titre');
echo $form-label('Article.chapeau', 'Chapeau');
echo $form-textarea('Article.chapeau');
echo $form-label('Article.contenu', 'Contenu');
echo $form-textarea('Article.contenu');
echo $form-input('Article.auteur');
echo $form-submit('Enregistrer');
?
/form
[/code]

For the input fields, the validation is OK and the error message is
displayed.
For the textarea, the validation is OK but the error message is not
displayed??


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



Re: display validation error messages for textarea?

2007-11-08 Thread avairet

A little solution: in the view, I add echo $form-
error('Article.contenu); under echo $form-
textarea('Article.contenu');  !
But this is not very useful compare to the input fields method.
Why adding echo-label and echo-error to manage textarea error
message displaying?

Excuse me for my simple English...

B.R.

Avairet



On 8 nov, 18:24, avairet [EMAIL PROTECTED] wrote:
 Hi everybody,

 I'm French and I'm using CakePhp 1.2 since one month.
 I don't understand why the validation error messages are not
 displaying for a textarea field...

 My model:

 [code]
 class Article extends AppModel {
 public $name = 'Article';

 public $validate = array (
   'titre' =
 array(
 'rule' = VALID_NOT_EMPTY,
 'message' = 'Le titre est obligatoire !'
 ),

 'contenu' =
 array(
 'rule' = VALID_NOT_EMPTY,
 'message' = 'Le contenu est obligatoire !'
 ),

 'auteur' =
 array(
 'rule' = VALID_NOT_EMPTY,
 'message' = 'L\'auteur est obligatoire !'
 )
);}

 [/code]

 And my view :
 [code]
 h2Ajout article/h2
 ?= $errorMessage; ?
 form id=AjoutArticle method=post action=?php echo $html-url('/
 admin/articles/add/')?
 ?php
 echo $form-input('Article.titre');
 echo $form-input('Article.sous_titre');
 echo $form-label('Article.chapeau', 'Chapeau');
 echo $form-textarea('Article.chapeau');
 echo $form-label('Article.contenu', 'Contenu');
 echo $form-textarea('Article.contenu');
 echo $form-input('Article.auteur');
 echo $form-submit('Enregistrer');
 ?
 /form
 [/code]

 For the input fields, the validation is OK and the error message is
 displayed.
 For the textarea, the validation is OK but the error message is not
 displayed??


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



Re: display validation error messages for textarea?

2007-11-08 Thread Radish

maybe instead of

echo $form-textarea('Article.contenu');

use

echo $form-input('Article.contenu', array(
   'type' = 'textarea'
));


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