The idea was right, but the code didn't work. The way for modifying the value was the problem. It worked for me (with jQuery):
$('input[name="variable"]').val(true);