That sounds like a lot of work just to avoid using html. If you are concerned about CakePHP coding standards (do they exist?) you should definitely not be thinking about hacking the core files. Creating "manual" form elements must be way better than editing files in the core.
Even using different names for each group of boxes and merging them in the controller or model must be better than modifying the core. I am still not clear about why you need to call the select multiple times. The only situation that would require you to call it twice is some layout issue you need to adress. Like: div checkbox checkbox /div div checkbox checkbox /div ... That is the only situation I can think of that can't be handled by a single select. It would be interesting to hear about it. On Mar 30, 12:33 pm, keyurvaghani <[email protected]> wrote: > Hello Miles, > > I have one more alternate way to prevent hidden control without doing > any kind of directly changes into libarary helper file (form.php). > > that is ... > > we can make out own custom helper with similar kind of function with > applied condition for not generating hidden while displaying multiple > checkboxes.... > > for that we have to follow steps as below: > > 1. make php helper file on location app/views/helpers/ > > 2. Make Helper Class like <classname>Helper and extends Helper as > base class. > > class MultipleCheckboxHelper extends Helper { } > > 3. include required helpers by defining var $helpers = array > ('Html','Form'); into custom helper class. > > 4. here we need Html and Form so define $helpers array variable as > shown above. > > 5. Now, just copy select Function from Form.php (cake library helper > file) and paste it over here. > > 6. Rename function name and take for conflict naming conventions with > another existing function name > > 7. Find and Replace $this-> TO $this->Form-> > > 8. Replace line where hidden element will be generated with $style > condition as below: > > function selectMultiple($fieldName, $options = array(), $selected = > null, $attributes = array(), $showEmpty = '') { > .................... > .................... > if($style!='checkbox'){ > $select[] = $this->Form->hidden(null, array('value' => '', 'id' > => null, 'secure' => false));} > > ..................... > ..................... > > } > > 9. Open controller file where you need to use this helper and include > this custom helpers by defining array variable as below: > > var $helpers = array('Form','Html','Javascript','MultipleCheckbox'); > > 10. call method from custom helpers into view files (.ctp / .thml) as > below: > > <?php $options1=array(1=>" Create Lead"); > e($multipleCheckbox->selectMultiple > ('ProfilePermissionsMaster.permission',$options1,NULL,array > ('multiple'=>'checkbox' , 'separator'=>' <br> ','value'=>'1'))); > > $options2=array(2=>" Approve/Reject Lead"); > e($multipleCheckbox->selectMultiple > ('ProfilePermissionsMaster.permission',$options2,NULL,array > ('multiple'=>'checkbox' , 'separator'=>' <br> ','value'=>'2'))); > > ?> > > Note: we have to call helper methods with object name with small case > of first word like $multipleCheckbox->method( ) > > Please let me your view which is correct way that i should have to > follow.... > > which is the most standard way as per cakephp rule or its MVC > structure. > > Thanks and Regards, > Keyur. > > On Mar 30, 2:39 pm, keyurvaghani <[email protected]> wrote: > > > Hi Miles, > > > Thanks for your needful help. > > > But currently i am developing company product through pure cakephp > > 1.2 standards and i have to follow its conventions during whole > > development cycle. > > > currently i have created multiple check boxes using $form->select() > > with 'multiple'=>'checkbox' options. > > > For these reasons, i have three alternate for this solution in which > > i will prevent to generate these hidden controls while displaying > > multiple check boxes as below: > > > (1) First way is pass extra boolean parameter say $showHidden=true / > > false > > > based on above parameter i will hide line no#: 1190 from file > > cake library helper "form.php". > > this line is executed from "select" Function. > > > (2) Second way is that in same file "form.php" and "select" Function > > on line No: 1187, > > > the variable $style get its value based on 'multiple' key and > > value attributes if it is 'checkbox' then stored same value otherwise > > null. > > > so i can use this $style variable as conditional variable for > > generating hidden control or not. > > > Means instead line no: 1190 as below: > > $select[] = $this->hidden(null, array('value' => '', 'id' => null, > > 'secure' => false)); > > > i will change it as below: > > > if($style!='checkbox'){ > > > $select[] = $this->hidden(null, array('value' => '', 'id' => > > null, 'secure' => false)); > > > } > > > (3) Third way is alternate way of above but in different way. > > > If we don't want any changes directly to "select" Function of > > Form.php library helper file, Then > > > - Just copy this "select" Function and Paste Above or below this > > function. > > - Now, rename this function from "select" To say it "selectMultiple > > ( )" function. > > - Then, put/change above line no:1190 with a condition of $style as > > displayed on 2nd way. > > > i can apply any of one among above alternatives through this way it > > will not auto generate hidden for multiple check boxes and post values > > with correct array that i want. > > > But even though i think this not standard way that i should follow. > > > so please let me know your ideas.... > > > Best Regards, > > Keyur Vaghani. > > ------------------------------------------------ > > > On Mar 30, 12:11 pm, Miles J <[email protected]> wrote: > > > > The only alternative is doing it manually. > > > > <input type="checkbox" name="data[Model][field][]"> > > > > You are unable to do it with the form helper. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
