Commit e6694a4b authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Provide JS for getting the radio value when doing an AJAX request

parent 1e2d200b
......@@ -77,6 +77,22 @@ function form_render_select($element, Form $form) {
return $result;
}
function form_get_value_js_select($element, Form $form) {
$formname = $form->get_name();
$name = $element['name'];
return <<<EOF
var select = document.forms['$formname'].elements['$name'];
data['$name'] = new Array();
for (var i = 0; i < select.length; i++) {
if (select[i].selected) {
data['$name'].push(select[i].value);
}
}
log(data['$name']);
EOF;
}
function form_render_select_set_attributes($element) {
$element['rules']['validateoptions'] = true;
return $element;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment