uncheck a box

629 views
Skip to first unread message

macsig

unread,
Sep 10, 2008, 2:29:02 PM9/10/08
to Prototype & script.aculo.us
Hello, is it possible through prototype uncheck a checkbox?

I'm working on a rails app and I need, when an action is submitted
unchecked some boxes within a rjs.


Thanks and have a nice day!



Sig

Diodeus

unread,
Sep 10, 2008, 3:04:58 PM9/10/08
to Prototype & script.aculo.us
There is nothing in Prototype to perform this task. Just use plain-old
JavaScript.

document.myform.mycheckbox.checked=false

sliver

unread,
Sep 10, 2008, 11:43:38 PM9/10/08
to Prototype & script.aculo.us

On Sep 10, 3:04 pm, Diodeus <diod...@gmail.com> wrote:
> There is nothing in Prototype to perform this task. Just use plain-old
> JavaScript.

That is not exactly true...

>
> document.myform.mycheckbox.checked=false

while this is a very direct way of doing so, Prototype does offer a
wrapper for the same command:

$('formId').getInputs('checkbox').invoke('setValue', false); // will
uncheck all checkboxes in the form

As long as you can access the checkboxes individually, you can simply
use:
$('someCheckboxId').setValue(false); // to uncheck it
Reply all
Reply to author
Forward
0 new messages