I agree with Fred. It's much easier to write your javascript in a separate
.js file instead of adding inline javascript. Inline javascript tends to
become difficult to maintain over time.
In jQuery you could write something like this:

$(':checkbox[name="broadcastRecipientRadio"][value="all"]').click(function(event)
{
    $(':checkbox[name="broadcastRecipientRadio"]').attr('checked',
'checked');
});

An even better way to write it would be to observe all checkboxes that have
the value "all" and automatically check related checkboxes when clicked. You
would only have to write it once and just include it on every page:

$(':checkbox[value="all"]').click(function(event)
{
    var checkbox = $(this);
    var name = checkbox.attr('name');
    $(':checkbox[name="' + name + '"]').attr('checked', 'checked');
});

Once you break out of using inline javascript, it all of a sudden becomes
much friendlier :)

--
Hector


On Tue, Oct 6, 2009 at 1:20 PM, vinnyman <vboisv...@simexperts.com> wrote:

>
> My guess here is that the need of a JavaScript function was to catch an
> event
> without having to refresh the page.  Your example is correct as long as you
> don't mind the refresh.  Hence I find it's more or less relevant here.
> --
> View this message in context:
> http://www.nabble.com/Form-from-INI-multiOptions-tp22568875p25775900.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>

Reply via email to