The following onClick event handler for the login button on a custom login form logs in the user with the values typed in the form and runs the main form:

function loginButton_onClick( )

   if form.rowset.parent.session.login( form.groupNameText.value, ; 

      form.userNameText.value, ; 

      form.password1.value ) 

      do MAIN.WFM 

   endif