If you need textfield for every checkbox, do not output them as group but do it individually.
On Aug 28, 4:01 pm, fabio <[email protected]> wrote: > Thanks again Dr.Loboto, > > that's what i came up to as well, but it works only for the last > checkbox of the list (or the first if i used 'before' parameter)... > what i need is a text field associated for each checkbox of a group of > checkboxes... don't know if it's possible at this point... :-( > > damn ! i think i'll end avoiding the FormHelper and coding it with > pure html even if like this i'm gonna loose all the benefits of Cake > > Anyway thank you again for your tips > > fabio > > On 28 Ago, 10:16, "Dr. Loboto" <[email protected]> wrote: > > > > > Read > > manual.http://book.cakephp.org/view/191/options-before-options-between-optio... > > > 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 <[email protected]> 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" <[email protected]> wrote: > > > > > echo $form->input('User.name', array('onfocus' => 'CheckCheckBox > > > > (this.form)')); > > > > > On Aug 27, 9:18 pm, fabio <[email protected]> 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 [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 -~----------~----~----~----~------~----~------~--~---
