Over a million developers have joined DZone.

Disable Your Form

DZone's Guide to

Disable Your Form

Free Resource
// This function disable your entire form. Its purpose is to disable a form field, in order for your ajax request to do its job without being disturbed.

"cond" is the condition. True will disable all your form, False will unlock it.
"myForm" is the ID of your 
function DisableForm(myForm,cond){ var node_list = getElementById(myForm).getElementsByTagName('input'); for (var i = 0; i < node_list.length; i++) { var node = node_list[i]; if (node.getAttribute('type') == 'checkbox' || node.getAttribute('type') == 'submit') node.disabled = cond; else node.readOnly = cond; } };

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}