Form Submit button trigger programmatically?

Discussion to talk about software related topics only.
BillC
Posts: 72
Joined: Tue Oct 13, 2009 6:22 am
Location: Buckinghamshire, UK

Re: Form Submit button trigger programmatically?

Post by BillC »

Hi again Scott, I think this is what you need, you will need to change the "webpage.html" to whatever your netburner page that is going to recive the post is called. I dont think you need the value input to the submitchange routine.

Code: Select all

<SCRIPT TYPE="text/javascript">
<!-- 
function submitchange()
{
     /* What goes here to submit the form using post? */   
document.forms["myform"].submit(); 
    <!-- // alert("Test change"); -->
}
//-->
</SCRIPT>

<table>
<form name="myform" action="webpage.html" method="post">
  <tr>
    <td width=40> </td>
    <td>Enter data to post: <input type="text" name="textForm1" onChange="submitchange()" value="<!--FUNCTIONCALL WebTextForm1 -->"></td>
    <td><input type="submit" value="Submit"></td>
  </tr>
</form>
</table>
Is the webpage you are going to submit the data to the same webpage that output the form ? , if it is then you can use Ajax or similar type functions to submit the changes and display new/changed data to the page witout a page refresh, it looks a lot neater. Its not hard to do, let me know if you need some guidance, I have some code that does exactly this.

Bill
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Form Submit button trigger programmatically?

Post by sblair »

Thanks Bill, that had the missing piece!

I had to tweak it slightly for the MyDoPost and ExtractPostData to work properly.

<form name="myform" action="myform" method="post">

With the action as "myform" the ExtractPostData was able to pull it out from the URL.

Thanks again!
Scott
BillC
Posts: 72
Joined: Tue Oct 13, 2009 6:22 am
Location: Buckinghamshire, UK

Re: Form Submit button trigger programmatically?

Post by BillC »

Hi Scott, glad that you have got it working now.

Its a nice change for me to be able to answer a question, normally I am the one asking the questions.

Best of luck with your project.

Bill
Post Reply