Commit f741e6eb authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Disable number field in expiry element when 'no end date' is set

parent 9ad21e18
......@@ -66,7 +66,11 @@ function form_render_expiry($element, Form $form) {
$seconds = null;
}
$numberinput = '<input ' . ($form->get_ajaxpost() ? 'onchange="' . $name . '_change()" ' : '');
$numberinput = '<input ';
if ($form->get_ajaxpost()) {
$numberinput .= 'onchange="' . $name . '_change()"';
$numberinput .= $values['units'] == 'noenddate' ? ' disabled="disabled"' : '';
}
$numberinput .= 'type="text" size="4" ' . 'name="' . $name . '_number" ';
$numberinput .= 'id="' . $name . '_number" value="' . $values['number'] . "\">\n";
......@@ -101,6 +105,15 @@ function {$name}_change() {
seconds = mult * 365;
}
}
else {
seconds = 0;
}
if ($('{$name}_units').value == 'noenddate') {
$('{$name}_number').disabled = true;
}
else {
$('{$name}_number').disabled = false;
}
$('{$name}').value = seconds;
}
</script>
......
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