Note that there are some explanatory texts on larger screens.

plurals
  1. POhtml: stop page refresh when entering a value
    text
    copied!<p>I have a table created in a html form.</p> <p>The first column displays data pulled from a web server and the second column allows for changing the value and then submitting the new value to the web server. I also have another table that is pulling live data from the web server that needs to be refreshed every 20 seconds. At the moment I have the entire page refreshing every 20 seconds.</p> <p>The problem is when the page refreshes if you have started to type a value into the table cell the value is lost after the refresh. I have tried some JavaScript to retain the values in cookies and this has worked so far. But I wondered if there was a way to simply stop the refresh from happening if the cursor has been selected in the input box in the table cell.</p> <pre><code>&lt;form id=form1 name=f1 method=post action=/scripts/write-tags autocomplete=on&gt; &lt;input type=hidden name=tag1 value=9&gt; &lt;input type=hidden name=tag2 value=61&gt; &lt;input type=hidden name=tag3 value=44&gt; &lt;input type=hidden name=tag4 value=25&gt; &lt;input type=hidden name=back value=/savetest.htm&gt; &lt;input type=hidden name=page value=1&gt; &lt;table id=data border="1" cellpadding="10" width="700" style="font-family:Arial; font-size:15px";&gt; &lt;th&gt;Operation&lt;/th&gt;&lt;th&gt;Value&lt;/th&gt;&lt;th&gt;New Value&lt;/th&gt; &lt;tr&gt; &lt;td width="400"&gt;Enter the Value of the desired motor RPM&lt;/td&gt; &lt;td width="100"&gt;[[130]]&lt;/td&gt; &lt;td width="100"&gt;&lt;input type=text size=3 name=data1 value="[[9]]"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="400"&gt;Enter the Value of the Target FOP in feet (TVD)&lt;/td&gt; &lt;td width="100"&gt;[[61]]&lt;/td&gt; &lt;td width="100"&gt;&lt;input type=text size=3 name=data2 value="[[61]]"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="400"&gt;Enter the Value of the Shutdown Delay in minutes&lt;/td&gt; &lt;td width="100"&gt;[[256]]&lt;/td&gt; &lt;td width="100"&gt;&lt;input type=text size=3 name=data3 value="[[44]]"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="400"&gt;Enter the Value of the Flow Rate Delay in seconds&lt;/td&gt; &lt;td width="100"&gt;[[24]]&lt;/td&gt; &lt;td width="100"&gt;&lt;input type=text size=3 name=data4 value="[[25]]"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="700"&gt;&lt;input style="font-family:Arial; font-size:15px;"type=submit name=submit value=&amp;nbsp;OK&amp;nbsp;&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>I have updated some example code. The web server is built into a PLC. The tag and data name refers to a value in the PLC. The value inside the [[]] is the value that needs to be refreshed and the input value is for changing the value. Apologies if this is too vague. I appreciate the help but cant post too much code for confidential reasons. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload