Results 1 to 5 of 5

Thread: calling vbscript subroutine on form submit

  1. #1

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    calling vbscript subroutine on form submit

    Guys

    I want to call a vbscript sub which asks the user to cofirm something when they hit the form submit button. At the moment, the onclick attribute calls document.frm.submit(); however I want to ask the customer to confirm their action before submitting the document.

    I know how to do this in vb but not in javascript. I'd prefer to use vbscript than javascript as I am more familiar with vb but I don't know how to call the sub from this onclick event.

    Any ideas?!

    Cheers


    Peter
    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

  2. #2
    New Member
    Join Date
    Sep 2005
    Posts
    7

    Re: calling vbscript subroutine on form submit

    Try in the html declaration of your button following thing:

    <asp:button id="myID" onClick="call your script" runat="server" />

    in the codebehind you have your this document.frm.submit() standing. Normaly first the script will be called and then your code-behind.
    I'm not 100% sure but I've done this in my website and it is working fine

  3. #3
    Fanatic Member kaihirst's Avatar
    Join Date
    Jul 2005
    Location
    The Resaurant At the End of The Universe
    Posts
    633

    Re: calling vbscript subroutine on form submit

    Hi,

    do this...

    <script language="Javascript">
    function submitbutton() {

    if (confirm("are you sure")) = "true" then
    document.frm.submit()
    end if
    }
    </script>

    The for is to have no submit button, jsut a hidden button with a name and value then

    <%

    if request("hiddenname") <> "" then

    do something

    end if
    %>

    try that, and happy days..


    ta

    kai
    As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..

    A few things that make a good Developer a Great One.
    Methodical and a thorough approach to research and design inevitably leads to success.
    Forward thinking is the key to Flow of control.
    Never test in the design environment, always test in real time, you get the REAL results.
    CBSE & OOSE are the same animal, they just require different techniques, and thinking.
    SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them.
    The key to good design is explicit attention to both detail and response.
    Think Freely out of the "Box" you're in..... You will soar to better heights.

    Kai Hirst - MSCE, MCDBA, MCSD, MCP, MCAP, MSCT


  4. #4

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    Re: calling vbscript subroutine on form submit

    Quote Originally Posted by spyatnoon
    Try in the html declaration of your button following thing:

    <asp:button id="myID" onClick="call your script" runat="server" />

    in the codebehind you have your this document.frm.submit() standing. Normaly first the script will be called and then your code-behind.
    I'm not 100% sure but I've done this in my website and it is working fine
    I'm not using asp.net.......
    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

  5. #5

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    Resolved Re: calling vbscript subroutine on form submit [resolved]

    Quote Originally Posted by kaihirst
    Hi,

    do this...

    <script language="Javascript">
    function submitbutton() {

    if (confirm("are you sure")) = "true" then
    document.frm.submit()
    end if
    }
    </script>

    The for is to have no submit button, jsut a hidden button with a name and value then

    <%

    if request("hiddenname") <> "" then

    do something

    end if
    %>

    try that, and happy days..


    ta

    kai
    Sorry, been away sunning myself in the Costa Blanca....

    Currently have this:

    HTML Code:
    function confirmSubmit()
    {
    var agree = confirm("Are you sure you wish to continue?");
    if (agree)
    document.frm.submit();
    //return true;
    else
    return false;
    }
    I'm calling this from an a href tag:

    HTML Code:
    <a href='#' onclick='return confirmSubmit()'>Proceed</a>
    with the form header:

    HTML Code:
    <form name="frm" method="post" action="process.asp">
    Seems to work ok now, thanks.
    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width