Re: Make required css class not appear on edit page

2011-01-12 Thread zzella
Aha, a simple solution to every problem :-) That does the trick.

Thanks!

Ella

On Jan 11, 8:39 pm, cricket  wrote:
> On Tue, Jan 11, 2011 at 1:25 PM, zzella  wrote:
> > Hi,
>
> > I have a model where a field is required on the Add (create) page but
> > can be empty on the Modify (update) page.
>
> > My model specifies the field should be not-empty on create only, but
> > the "required" css class (red asterisk) still gets added on the modify
> > page. How do I make this a non-required field on the modify page?
>
> I'm not sure if Cake normally would not add "required" in this
> situation (never looked into it) but you could always undo the CSS
> rule in your stylesheet:
>
> #IdOfForm .required { ... }

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Make required css class not appear on edit page

2011-01-11 Thread cricket
On Tue, Jan 11, 2011 at 1:25 PM, zzella  wrote:
> Hi,
>
> I have a model where a field is required on the Add (create) page but
> can be empty on the Modify (update) page.
>
> My model specifies the field should be not-empty on create only, but
> the "required" css class (red asterisk) still gets added on the modify
> page. How do I make this a non-required field on the modify page?

I'm not sure if Cake normally would not add "required" in this
situation (never looked into it) but you could always undo the CSS
rule in your stylesheet:

#IdOfForm .required { ... }

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Make required css class not appear on edit page

2011-01-11 Thread zzella
Hi,

I have a model where a field is required on the Add (create) page but
can be empty on the Modify (update) page.

My model specifies the field should be not-empty on create only, but
the "required" css class (red asterisk) still gets added on the modify
page. How do I make this a non-required field on the modify page?

MODEL:
class Diploma extends AppModel {
var $validate = array(
'specialite' => array(
'notempty' => array(
'rule' => array('notempty'),
'message' => 'Veuillez saisir la spécialité',
'required' => false,
'on' => 'create', // Limit validation to 
'create' or 'update'
operations
),
),
)
}

On both ADD and EDIT pages (although these are for a parent model):
echo $this->Form->input('Diploma.0.specialite',
array('label'=>__('Spécialité',true),'size'=>40));

The behaviour of the validation rule works correctly when I save but I
just can't get rid of that star!!!

Any help is much appreciated!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: css class

2009-07-15 Thread Dhileepen Chakravarthy
Thanks jeff. somewhat i understood its good enough to proceed.

--~--~-~--~~~---~--~~
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: css class

2009-07-14 Thread jeff
To change the cakes css style

make ur own css and place it in the default.ctp file

in app/views/layout folder

place this there

 css('your css file name');?>

eg:

 css('styles');?>

using this in default will set this style for all view pages...

=> alternativelty

in the requried view page add the above code

On Tue, Jul 14, 2009 at 2:28 PM, Dhileepen Chakravarthy <
dhileepen.cake...@gmail.com> wrote:

> Hi Everybody,
>
> i can able to change the existing css . but how do i use newly created css
> class into my .ctp file
>
> Regards,
> Dhileepen
>
> >
>


-- 
-- 
(¨`•.•´¨) I may be busy,
`•.¸(¨`•.•´¨)  but I assure you,
(¨`•.•´¨)¸.•´ you are always in my heart
`•.¸.•´


With Lots of Love.

THANKS AND REGARDS

Jeffery Jacob

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



css class

2009-07-14 Thread Dhileepen Chakravarthy
Hi Everybody,

i can able to change the existing css . but how do i use newly created css
class into my .ctp file

Regards,
Dhileepen

--~--~-~--~~~---~--~~
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: Required form field NOT marked with "required" CSS class

2009-04-29 Thread jstein

> IF it doesn't have to be present, its NOT a required field ;-)
>
> To make CakePHP add the required classes you must include the addition
> rule "required"=>true

That's exactly the problem: From a model point of view, the field is
NOT required, but from a form point of view, it IS required.

I think the form logic has a problem detecting if a field is required
or not, when one field have multiple validation rules.

  Regards

Jonathan

--~--~-~--~~~---~--~~
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: Required form field NOT marked with "required" CSS class

2009-04-29 Thread rich...@home

"need the opposite: IF the field is present, it must NOT be empty
(and it must be unique). "

IF it doesn't have to be present, its NOT a required field ;-)

To make CakePHP add the required classes you must include the addition
rule "required"=>true

e.g.

var $validate = array(
  'name' => array('notempty'),
  'number' => array(
'notempty'=>array('rule'=>'notempty', 'message'=>'Number must be
specified',
'required=>true),
'isUnique'=>array('rule'=>'isUnique', 'message'=>'Number is
already used')
  ));

This means the field MUST be in the posted data, can't be empty and
must be unique.

On Apr 29, 9:38 am, jstein  wrote:
> On Apr 28, 5:40 pm, brian  wrote:
>
> > Add 'allowEmpty' = true for number.
>
> According to the documentation, that would bypass validation, if the
> field is present but empty.
>
> I need the opposite: IF the field is present, it must NOT be empty
> (and it must be unique).
>
> The validation seems to work, but the FormHelper does not recognize
> the field as a required field.
>
>   Regards
>
>     Jonathan
--~--~-~--~~~---~--~~
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: Required form field NOT marked with "required" CSS class

2009-04-29 Thread Miles J

Use the rule "notEmpty". I prefer it then setting the required to true.
--~--~-~--~~~---~--~~
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: Required form field NOT marked with "required" CSS class

2009-04-29 Thread jstein

On Apr 28, 5:40 pm, brian  wrote:

> Add 'allowEmpty' = true for number.

According to the documentation, that would bypass validation, if the
field is present but empty.

I need the opposite: IF the field is present, it must NOT be empty
(and it must be unique).

The validation seems to work, but the FormHelper does not recognize
the field as a required field.

  Regards

Jonathan

--~--~-~--~~~---~--~~
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: Required form field NOT marked with "required" CSS class

2009-04-28 Thread brian

Add 'allowEmpty' = true for number.

On Tue, Apr 28, 2009 at 9:31 AM, Jonathan  wrote:
>
> In a model, I have a validation like the following:
>
> var $validate = array(
>  'name' => array('notempty'),
>  'number' => array(
>    'notempty'=>array('rule'=>'notempty', 'message'=>'Number must be
> specified'),
>    'isUnique'=>array('rule'=>'isUnique', 'message'=>'Number is
> already used')
>  ));
>
> - and in a view:
>  echo $form->create();
>  echo $form->input('name');
>  echo $form->input('number');
>
> Then "name" gets a CSS class with "required", but "number" does not.
>
> However, if I add "'required'=>true" to "number" it does get the
> required class - but it breaks my validation, because in some cases, I
> want to update the data without supplying the "number" field.
>
> My solution so far is to add "$form->fieldset['validates'][] =
> 'number';" after "$form->create();", but I guess there should be a
> better way...
>
> I guess there is room for some confusion, because "required" in the
> form is not the same as "required" in the model validation!
>
>  Regards
>
>    Jonathan
>
> >
>

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



Required form field NOT marked with "required" CSS class

2009-04-28 Thread Jonathan

In a model, I have a validation like the following:

var $validate = array(
  'name' => array('notempty'),
  'number' => array(
'notempty'=>array('rule'=>'notempty', 'message'=>'Number must be
specified'),
'isUnique'=>array('rule'=>'isUnique', 'message'=>'Number is
already used')
  ));

- and in a view:
  echo $form->create();
  echo $form->input('name');
  echo $form->input('number');

Then "name" gets a CSS class with "required", but "number" does not.

However, if I add "'required'=>true" to "number" it does get the
required class - but it breaks my validation, because in some cases, I
want to update the data without supplying the "number" field.

My solution so far is to add "$form->fieldset['validates'][] =
'number';" after "$form->create();", but I guess there should be a
better way...

I guess there is room for some confusion, because "required" in the
form is not the same as "required" in the model validation!

  Regards

Jonathan

--~--~-~--~~~---~--~~
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: CSS Class for with $html->tableHeaders

2009-02-16 Thread AD7six



On Feb 14, 12:38 pm, Roman  wrote:
> With the HTML helper it is easy to set a CSS class for a :
>
> tableCells(
> 'one',
> array('two',array('class'=>'myCssClass'),
> 'three'
> );?>
>
> As I understand the documentation, it is only possible to set a CSS
> class for  and for all the 's:
>
> tableHeaders(
>     array('Date','Title','Active'),
>     array('class' => 'status'),
>     array('class' => 'product_table')
> );?>
>
> Is there a way to set a CSS class for a single ?

manually.

submit a patch with your enhancement ticket if you want the
tableHeaders method to act the same as tableCells.

hth,

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



CSS Class for with $html->tableHeaders

2009-02-14 Thread Roman

With the HTML helper it is easy to set a CSS class for a :

tableCells(
'one',
array('two',array('class'=>'myCssClass'),
'three'
);?>

As I understand the documentation, it is only possible to set a CSS
class for  and for all the 's:

tableHeaders(
array('Date','Title','Active'),
array('class' => 'status'),
array('class' => 'product_table')
);?>

Is there a way to set a CSS class for a single ?

I want table headers for columns which contain numbers to be aligned
right, using a CSS class .number

--~--~-~--~~~---~--~~
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: Adding custom css class to $html->link and a , HELP!

2009-01-28 Thread brian

echo $html->link(
'Activate',
'/order/activate/'.$order['List']['id'],
array(
'class' => 'button2'
),
sprintf(__('Are you sure you want to activate this order ?', true),
$order['List']['id']),
false
);

The last param tells Cake not to escape the title. But I think this
would be simpler if you added the "icon_delete" class to the link
itself.

Also, you should consider using the array notation for your routes. If
you have a lot of routes, it's *so* much better in the long run.

On Wed, Jan 28, 2009 at 9:20 PM, Louie Miranda  wrote:
> Hello,
>
> I have this code:
> echo ' class="icon_delete">Activate';
>
> That displays a css class on  and after that a  with another class.
>
> When I am using CakePHP, I can only use this.
> echo $html->link("activate", '/order/activate/'.$order['List']['id'], null,
> sprintf(__('Are you sure you want to activate this order ?', true),
> $order['List']['id']));
>
> Is there any work around where I could make it work on my first example
> above? By using cakeish methods?
> --
> Louie Miranda (lmira...@gmail.com)
> http://www.louiemiranda.net
>
> Security Is A Series Of Well-Defined Steps
> chmod -R 0 / ; and smile :)
>
>
> >
>

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



Adding custom css class to $html->link and a , HELP!

2009-01-28 Thread Louie Miranda
Hello,

I have this code:
*echo 'Activate';*

That displays a css class on  and after that a  with another class.

When I am using CakePHP, I can only use this.
*echo $html->link("activate", '/order/activate/'.$order['List']['id'], null,
sprintf(__('Are you sure you want to activate this order ?', true),
$order['List']['id']));*

Is there any work around where I could make it work on my first example
above? By using cakeish methods?
--
Louie Miranda (lmira...@gmail.com)
http://www.louiemiranda.net

Security Is A Series Of Well-Defined Steps
chmod -R 0 / ; and smile :)

--~--~-~--~~~---~--~~
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: Adding CSS class to HTML link helper

2008-06-15 Thread David C. Zentgraf

The __() function is a translation helper function which looks up the  
word/phrase in localization files. Look at the i18n section of the  
cookbook... Usually that function echos the result directly into your  
page, passing it the second argument TRUE makes it return the value  
instead (so you can use it in other functions).




http://book.cakephp.org/view/120/global-constants-and-functions

Extra stuff for the link helper goes into the third argument:

link(__('Edit', true), array('action'=>'edit',  
$bookmark['Bookmark']['id']), array('class' => 'myClass')); ?>

As always, the API Docs are your friend.
http://api.cakephp.org/1.2/class_html_helper.html#71ff7f331b08318bc867a4d9057b7d9f

On 15 Jun 2008, at 22:00, BeroFX wrote:

>
> So, I baked some views and looking at the code you get:
>
> link(__('Edit', true), array('action'=>'edit',
> $bookmark['Bookmark']['id'])); ?>
>
> Which prints out an "Edit" link. How do I add a CSS class to this so I
> can have a little icon next to the text?
>
> note: I have the css code.
>
> Also, can anyone explain "__('Edit', true)"? I know it prints out
> Edit, and true is to make it a link.
> But __() part I don't get.
>
> I did Google it, but there isn't any good explanation :(
>
> 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
-~--~~~~--~~--~--~---



Adding CSS class to HTML link helper

2008-06-15 Thread BeroFX

So, I baked some views and looking at the code you get:

link(__('Edit', true), array('action'=>'edit',
$bookmark['Bookmark']['id'])); ?>

Which prints out an "Edit" link. How do I add a CSS class to this so I
can have a little icon next to the text?

note: I have the css code.

Also, can anyone explain "__('Edit', true)"? I know it prints out
Edit, and true is to make it a link.
But __() part I don't get.

I did Google it, but there isn't any good explanation :(

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: Scaffolding From tags css class

2006-07-13 Thread cwsTrummer

no way to chance the html output? ok than i have to write my css new


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



Re: Scaffolding From tags css class

2006-07-13 Thread gwoo

view source. You will see that required field take class="required",  
optional fields are class="optional"

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



Scaffolding From tags css class

2006-07-13 Thread cwsTrummer

hello

i am playing around with the scaffolding feature and i found that in
the scaffolding views the input tags are made with this function call

echo $form->generateFields( $fieldNames );

then i get some input fields and divs around it
how can i set the css class for this elements? to format a little bit
the output of the scaffold

thanks


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



$ajax->submit css class

2006-06-22 Thread sicapitan

print $ajax->submit('Add task', array('url' => 'add',
'update'=>'tasks_todo');

print $ajax->submit('Add task', array('url' => 'add',
'update'=>'tasks_todo','class'=>'something');

doesn't work, is there a different format?


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