Disable form

Is there any way to programmatically disable a form, or parts thereof (preferably the submit button)? Tried to embed code as under the process part of form.md, i.e. for a form element:

disabled: {% code-goes-here %}

but it does not seem to parse. Any suggestions?