Jump to content
Sign in to follow this  
Mark Wheeler

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

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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...