allow passing of the form dom node
Cleaned up the method to determine if the form name was passed or not.