Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2002
    Posts
    47
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Why won't it submit?

    I am constantly having problems using javascript to submit a form. Here's a very simple example that just won't work and I can't figure out why. Anyone? Thanks.

    Code:
    <form method="post" action="deleteQuestionaire.asp" name="deleteQn">
    <input type="hidden" name="QnId">
    </form>
    
    <script language="javascript">
    <!--
    var deleteMessage = "Are you sure you want to do this?"
    
    function deleteQuestionaire( QnId )
    {
    	if ( confirm(deleteMessage) )
    	{
    		document.deleteQn.QnId.value = QnId;
    		document.deleteQn.submit();
    	}
    }
    //-->
    </script>
    
    <a href="javascript:void(0);" onClick="deleteQuestionaire('5');"><font size="1">Delete</font>

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    FL, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What happend was you placed spaces between the ( ) { functions.

    You had: deleteQuestionaire( QnId )
    is should be deleteQuestionaire(QnId)

    same with the confirm.
    Somehting as simple as that, doesn't that just get you mad!

    ------


    <form method="post" action="deleteQuestionaire.asp" name="deleteQn">
    <input type="hidden" name="QnId">
    </form>
    <script language="javascript">
    <!--
    var deleteMessage = "Are you sure you want to do this?"
    function deleteQuestionaire(QnId){
    if (confirm(deleteMessage)){
    document.deleteQn.QnId.value = QnId;
    document.deleteQn.submit();
    }
    }
    //-->
    </script>



    <a href="javascript:void(0);" onClick="deleteQuestionaire('5');"><font size="1">Delete</font>


    ------


    HappyScripting
    CYWebmaster.com - See why we dot com!!
    ACJavascripts.com - Cut & Paste Javascripts!
    SimplyProgram.com - Personal Blog


  •  

    Posting Permissions

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