Jump to content

how to set and clear a value when a form is submitted


Mark Wheeler

Recommended Posts

It’s my first post so here I go.

 

I have been taking a course on HTML and I’m already familiar with C.

 

I need to submit a value from a hidden input field when the form is submitted, this works fine, however what I need to do is submit a new value 2 seconds after the first one has been submitted.

 

I need to make this happen without any additional buttons.

The code below (without CSS) writes the value to my application just fine but I dont know how to submit a second value 2 seconds later.

 

Hoping someone can help

 

<!DOCTYPE html><html><!-- InstanceBegin template="/Templates/BW500.dwt" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title>BW500</title> <!-- InstanceEndEditable --> <link rel="stylesheet" type="text/css" href="css/styles.css" media="screen"> <script type="text/javascript" src="js/convert.js"></script> </head> <body> <div id="outer_wrapper"> <div id = "wrapper"> <div id = "banner"> <h1>BW500</h1> </div> <div id ="logo"> <img src="images/logo_siemens.jpg"> </div> <div id ="topnav"> <ul> <li><a href='index.html'>Process</a></li> <li><a href='status.html'>status</a></li> <li><a id="onlink" href='control.html'>Control</a></li> <li><a href='PID.html'>PID</a></li> <li><a href='spa.html'>Parameters</a></li> <li><a href='Manuals.html'>Manuals</a></li> <li><a href='network.html'>Network</a></li> </ul> </div> <div id ="data"> <table id="table_data"> <!-- InstanceBeginEditable name="data" --> <form action="control.html" method="post" id="resets"> <tr> <td>Reset Total 1</td> <td><input type="submit" name="Reset"value="256"></input></td> </tr> <tr> <td>Reset total 2</td> <td><input type="submit" name="reset"value="512"></input> </td> </tr> <script language="JavaScript">control(<?--#exc cmd_argument='printf("%i",outReadUword(16 ))'-->)</script> <?--#exec cmd_argument='SsiOutput( "", "Write Failed" )'--> <?--#exec cmd_argument='scanf("reset", "%u", OutWriteword( 16 ))'--> <?--#exec cmd_argument='printf( "%i",outReadUword(16 ))'--> </form> <!-- InstanceEndEditable --> </table> </div> <div id ="copywrite"> <p>Copywrite Siemens Canada Limited</p> </div> </div> </div> </body><!-- InstanceEnd --></html>

 

control.html

Link to comment
Share on other sites

I have noticed that I have to use input type as "submit" or the value of 256 or 512 is not written to the applicaton on the server.

Your third suggestion may be the answer, I will take a look.

Many thanks for your help and suggestions.

Link to comment
Share on other sites

HI Dave

 

Thanks for the hints I have my code working thanks to you.

 

I changed my submit buttons to type "button" and pass the values in to the function that I need to write.

 

{
document.getElementById("t1").value = value_in;
document.getElementById("resets").submit();
alert("Totalizer reset");
document.getElementById("t1").value =0;
document.getElementById("resets").submit();
}
Many thanks for your help
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...