Avatar of Whing Dela Cruz
Whing Dela Cruz
Flag for Anguilla asked on

Send form to asp server side

Hi experts, I need to use <a><a/> hyperlink to submit form to asp server. Instead of using button I need to use hyperlink to call function and submit form to asp server. I have no idea how possible is this. Thank you!

<!DOCTYPE html>
<html>
<body>
  <form class="modal-content animate" action="GetUser.asp" method="post">
      <br>
      <div id="ModalNav3">
         <table class="four">
            <tr>
               <td>&nbsp; &nbsp; &nbsp; User name :</td>
               <td><input type="text" name="usrname" class="i22" id="ccnum" ></td>
            </tr>
            <tr>
               <td>&nbsp; &nbsp; &nbsp; Password :</td>
               <td><input type="password" name="psw" require class="i22" id="ppw"></td>
            </tr>
         </table>
            <br>
         <div id="myDiv1">
            <a href="javascript:iSubmit()" ><font size="4">Submit Form!</a>
         </div>
            <input type="text" name="x-1" value="e1" hidden="true"/>
      </div>
  </form>
<script>
function iSubmit()
   {
     alert("summitted");
   }
</script>
</body>
</html>
ASPHTMLJavaScript

Avatar of undefined
Last Comment
Whing Dela Cruz

8/22/2022 - Mon
Manuel Marienne-Duchêne

<a href="#" onclick="iSubmit();" ><font size="4">Submit Form!</a>
Whing Dela Cruz

ASKER
What I need is that, I need to submit usrname, psw, and x-1 to server side not using the button but maybe using the function on script. Thanks!
Manuel Marienne-Duchêne

<form class="modal-content animate" action="GetUser.asp" method="post" id="myForm">


function iSubmit()
   {
     document.getElementById("myForm").submit();
     alert("summitted");
   }
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Whing Dela Cruz

ASKER
Hello Manuel, Its working, but please allow me to add one question. base on the code above i wanted to change the value of e1 during the running of function. can I do that here? e1 is hidden from the form so i can only change its value during the running of the function. Thanks!


function iSubmit()
   {
     document.getElementById("e1").value = "1975";
     document.getElementById("myForm").submit();
     alert("summitted");
   }
ASKER CERTIFIED SOLUTION
Manuel Marienne-Duchêne

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Whing Dela Cruz

ASKER
Thank you Manuel, Its working..