Sorry for my late response, I did some pretty sloppy typing in there, this should work better:

$this->view->inlineScript()->appendScript('yourScript'); //in controller

<?php echo $this->inlineScript() ?> <!-- in your view -->

Bart

nolner schreef:
Is this in the controller, or the view? Either way I get something like:

Warning: Plugin by name AddInlineScript was not found in the registry. in
/var/www/SR_DEV/library/Zend/Form.php on line 2614

At the moment, I've solved this problem by using a ViewScript, and putting
the modified source in that,

n


Bart McLeod wrote:
Hi,

Use unobstrusive javascript! (As someone on this forum pointed me out a few months ago!).

Look in the source of your form to find the id of the individual radio,
then
$this->view->addInlineScript("document.getElementById('individual_radio_id').onclick=function(){alert('clicked radio ' + individual_radio_id');return true;};");

Dit not test this, so there may be a type mismatch somewhere. But it should work.

Bart

nolner schreef:
Hi,

I have a group of 2 radio buttons - I simply want to reveal a set of
different fields dependent on which radio is clicked. I can add an
onClick
handler as below - but it appears on both radio buttons - how can I add
different code to each?

        $payment = new Zend_Form_Element_Radio('cust_paym_type', array(
               'multiOptions' => array(
               'AC' => 'Account Number ',
               'CC' => 'Credit Card'),
               'onClick' => "show_cc()"
        ));

thx
nolner schreef:
Hi,

I have a group of 2 radio buttons - I simply want to reveal a set of
different fields dependent on which radio is clicked. I can add an
onClick
handler as below - but it appears on both radio buttons - how can I add
different code to each?

        $payment = new Zend_Form_Element_Radio('cust_paym_type', array(
               'multiOptions' => array(
               'AC' => 'Account Number ',
               'CC' => 'Credit Card'),
               'onClick' => "show_cc()"
        ));

thx

Reply via email to