CakePHP //FORM CONTEXT VALIDATION TO ADD SYMBOL '*' TO REQUIRED FIELDS

<?php echo $this->Form->create($user, ['novalidate', 'context' => ['validator' => 'addBySite']]); // 'context' set custom 'validator' if you won't use default validation echo $this->Form->input('email'); // will add css class 'require' echo $this->Form->input('name'); // here too // with style (#style) will make this input // Name * (*) auto made by style css with color 'tomato' (look #style bellow) // [_______________] echo $this->Form->end(); ?> <style id="style"> .input.text.required label:after, .form-group.required label:after { content: " *"; font-weight: bold; color: tomato; } </style>
Add to input field a symbol "*" that auto built by CakePHP Template.
Combinated with CSS and if you wanna, a custom validator, build in Table Model.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.