I testing on d7.demo.civicrm.org (4.0.7) and demo.civicrm.org to create a contribution form with "on behalf" of organization. In both demo sites (and a local install of 3.4.7) it is silently failing to create the org based on the "on behalf of" profile. On behalf is required and it submits without error. But upon search no such organization exists and nothing is linked to the user you submitted - the membership stays on the individual instead of being by relationship.
This may be related to fact that the values entered into the "on behalf" profile are not shown on the contribution form's confirmation screen.