Read manual. http://book.cakephp.org/view/191/options-before-options-between-options-separator-a
echo $form->input( 'Amenity', array( 'type' => 'select', 'multiple' => 'checkbox', 'after' => $form->input( 'User.name', array('onfocus' => 'CheckCheckBox(this.form)') ) ) ); On Aug 28, 2:57 pm, fabio <3bi...@gmail.com> wrote: > Dear Dr.Loboto, thank you very much for your suggestion... i'm > handling on it but i would first need to know how to set the > FormHelper options to show one text field beside each checkbox... > > I was thinking about something like markup injections using > parameters "between[string]" or "after[string]" but i'm not really > sure it make sense... > > Any additional suggestion ? > > thanks a lot, really appreciate > > fabio > > On 28 Ago, 07:59, "Dr. Loboto" <drlob...@gmail.com> wrote: > > > > > echo $form->input('User.name', array('onfocus' => 'CheckCheckBox > > (this.form)')); > > > On Aug 27, 9:18 pm, fabio <3bi...@gmail.com> wrote: > > > > Dear all, > > > > i'm a CakePHP newbie and i'm looking for some help regarding a > > > particular use of checkboxes in a form. > > > > Basically i've got a check-boxes-section in the form of a baked > > > edit.ctp, called with a basic > > > > echo $form->input('Amenity', array( 'type' => 'select', 'multiple' => > > > 'checkbox' )); > > > > The models refers to a join table with an additional field 'specify': > > > > CREATE TABLE IF NOT EXISTS `amenities_properties` ( > > > `id` int(11) unsigned NOT NULL auto_increment, > > > `property_id` int(11) NOT NULL, > > > `amenity_id` int(11) NOT NULL, > > > `specify` varchar(100) NOT NULL default 'yes', > > > PRIMARY KEY (`id`) > > > ); > > > > The idea is to set values like this: > > > > 'no' ....................if unchecked > > > 'yes' ..................if checked > > > 'whatever'........... if checked and a string 'whatever' is inserted > > > > In other words I need to associate to each checkboxes an additional > > > input text field to be eventually filled only if the checkboxes are > > > previously checked > > > > I've found what it seems a perfect solution for this, but now I need > > > some help to implement it in CakePHP terms. > > > > Here it is: > > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/ > > > TR/html4/strict.dtd"> > > > <html> > > > <head> > > > <meta http-equiv="Content-Type" content="text/html; > > > charset=iso-8859-1"> > > > <title>Test Checkbox</title> > > > <script type="text/javascript"> > > > function CheckCheckBox(frm) > > > { > > > if (!frm.CheckThis.checked) > > > frm.CheckThis.focus() > > > } > > > </script> > > > </head> > > > <body> > > > <form> > > > <p><input type="checkbox" name="CheckThis"> > > > To insert your name check the box.</p> > > > <p> > > > Name: > > > <input type="text" name="UserName" onfocus="CheckCheckBox > > > (this.form)"></p> > > > </form> > > > </body> > > > </html> > > > > (see it in action here:http://www.html.it/articoli/1756/esempio.html > > > ) > > > > How you can see, the javascript function allows the user to input an > > > alternative value to yes/no only if the checkbox is previously checked > > > > So the point is: > > > how to get done this behaviour togheter with CakePHP default Form > > > Helper ? > > > Do you think it's possible somehow or another approach would be better > > > to achieve the same result ? > > > > Thanks a lot in advance for some suggestions > > > > Best regards > > > > fabio --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---