1 |
dpavlin |
950 |
/* Frey::Action */ |
2 |
|
|
|
3 |
|
|
/* clear radio buttons */ |
4 |
|
|
function clear_radio(form_id,name) { |
5 |
|
|
console.log( 'clear_radio '+form_id+'.'+name ); |
6 |
|
|
var form = document.getElementById( form_id ); |
7 |
|
|
if ( ! form ) console.error( form_id + ' not found' ); |
8 |
|
|
|
9 |
|
|
for ( var i = 0 ; i < form[name].length - 1 ; i++ ) { |
10 |
|
|
form[name][i].checked = false; |
11 |
|
|
} |
12 |
|
|
var radio = form[name][ form[name].length - 1 ]; |
13 |
|
|
if ( ! radio ) console.error( 'last radio button not found' ); |
14 |
|
|
radio.checked = true; /* free type input radio button */ |
15 |
|
|
|
16 |
|
|
var new_value = document.getElementById( 'new-' + name ).value; |
17 |
|
|
console.log( new_value ); |
18 |
|
|
radio.value = new_value; |
19 |
|
|
}; |
20 |
|
|
|