calling vbScript function from button input type

3.3k views Asked by At

I have the following function declared in the tag of a classic asp page that i did not write but need to edit;

<SCRIPT language="VBScript">
sub confirmuser(sSubtype, sAction)

    ' this prompts user to confirm their action and sets hidden form fields.
    ' current subtypes are 1) Free Trial 2) Equity 3) Mutual Funds.
    ' current actions are 1) subscribe 2) unsubscribe

    sConfirmMessage = "Clicking on the OK button below will " & sAction & " login <%=rtrim(session("WebID"))%> " & _
        "to the " & sSubtype
    if sSubtype = "Free Trial" then
        sConfirmMessage = sConfirmMessage & "."
    else
        if sAction = "subscribe" then
            sConfirmMessage = sConfirmMessage & " Research Package at the stated rates.  This charge will appear " & _
            "on your commission statement."
        else
            sConfirmMessage = sConfirmMessage  & " Research Package."
        end if
    end if

    ' if they click OK, then they want to go ahead and process.  Save the necessary info
    ' in the two hidden form fields and post the form.
    if msgbox(sConfirmMessage, VBOKCancel, "Please Confirm") = 1 then
        window.frmSub.subType.value = sSubType
        window.frmSub.action.value = sAction
        window.frmSub.submit()
    end if

end sub


</SCRIPT>

and in HTML input that is trying to execute the function;

<CENTER><INPUT type='button' value='Sign Up' id='subaction' name='subAction' language='VBScript' onclick="vbscript:confirmuser('Equity','subscribe')"></CENTER>

when trying to click the button i receive the error of;

"Uncaught ReferenceError: confirmuser is not defined"

this functionality currently is working in the website, so i don't know why I am receiving these errors, but I am no classic asp/vbscript guru so i was hoping someone could help me out.

0

There are 0 answers