Thanks Paul - looks like exactly what I am looking for. I am using jQuery, by the way. I'll post back my final results.
Jeremy Burns [email protected] On 11 May 2010, at 08:03, WebbedIT wrote: > I'm not great with js myself, but happy to give you my thoughts for > whatever they're worth. > > Which javascript library are you using (prototype/jQuery)? I find a > lot of people, including myself, don't always rely on the helper > instead preferring to work with their chosen js library direct. > > I've recently switched to jQuery and have a form with a group of radio > buttons and use the following to watch for a particular value being > selected to then display a group of extra fields or hide if that > option is unselected. > > Form Field: > echo $form->input('CampaignSignature.postal_address_id', array( > 'type'=>'radio', > 'onclick'=>'sectionToggle(this, \'#new-address\')', > )); > > Self written function echoed out at bottom of same view: > <script> > // <![CDATA[ > function sectionToggle(field, section) { > if ($(field).val() == 'new') { > $(section).show(); > } else { > $(section).hide(); > } > } > // ]]> > </script> > > Hope this helps, all you'd have to change for prototype is the $ > (field).val() == 'new' line of the function to $(field).getValue() == > 'new'. > > Paul > > 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 [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 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 [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
