views:

13

answers:

1

I have a form that submits to a different page to the one it is on. I want to catch the onsubmit for the form and perfom some VBScript code.

Am I right in thinking like with Java code in a JSP, everything in <% %> will be evaluated before the html is rendered?

Here is a brief overview of my problem:

<form id="frm1" method="post" action="otherSite" onsubmit="<% logFormSubmit "submitted"%>">
    .
    .
    .
</form> 

The code in the onsubmit calls a sub, logFormSubmit on another asp page that takes a string argument as the action to be logged. The problem here is this happens before the form is submitted, because the <% %> code is evaluated before any html, or at least that's what I think is happening.

I can't log from he page the form submits to. Any suggestions on only calling the logFormSubmit sub when the form is submitted?

A: 

You could catch the form values programmatically, call the logFormSubmit function, and then return false for the submit form.

Moses
Thanks for your response. The page that the form submits to does not belong to me and I am not able to edit it so can't catch the form values that way. I have done something similar before but only when a form submits to itself. Given that I can't edit the target page, I'm not sure this is possible?
pedroAx
Answer no longer required. Thanks.
pedroAx