add submit mechanism to javascript