[Form] allow template to set the onsubmit tag - check correction

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| Refs tickets  | #1739
| License       | MIT
| Doc PR        | -

Replaced !is_null with isset to prevent php errors