Java/Web Manual
  SoftPLC    Font size:      

SmartForm

SmartForm is a servlet that allows users to change values within their SoftPLC using only a browser. It uses standard HTML codes that are processed by the servlet. SmartForm determines which value is to be changed by the name parameter of the the HTML element called form. It is important to know that you can only have one input element with a name parameter per form block. Below are some examples of what is improper and proper:

Not allowed:
<form action="/servlet/SmartForm" method="get">
  <input type="text" name="N7:0" size="10">
  <input type="submit" name="submit_button">
</form>
Allowed:
<form action="/servlet/SmartForm" method="get" >
  <input type="text" name="N7:0" size="10">
  <input type="submit">
</form>

In the above example, the fact that the submit button had the name="submit_button" parameter would prevent the SmartForm servlet from working properly.

Not allowed:
<form action="/servlet/SmartForm" method="get">
    <select name="F10:0">
        <option value="1">Up</option>
        <option value="2">Down</option>
        <option value="4">Idle</option>
    </select> 
    <input type="hidden" value="true" name="do_addition">
    <input type="submit" value="Change Value" name="submitter">
</form>
Allowed:
<form action="/servlet/SmartForm" method="get">
    <select name="F10:0">
        <option value="1">Up</option>
        <option value="2">Down</option>
        <option value="4">Idle</option>
    </select> 
    <input type="submit" value="Change Value">
</form>

In the previous example, the 2 name tags in the hidden field and submit button are what is disallowed.

Text Field

To change a word or float value (ie: N7:0 or F10:0) in the SoftPLC to a user-specified value, simply use the HTML codes below in your webpage. The user would enter the desired new value and click the submit button or press enter.

<form action="/servlet/SmartForm" method="get">
    <input type="text" name="N7:0" size="10">
    <input type="submit">
</form>

List Box

To change a word or float value (ie: N7:0 or F10:0) to a specific value using a listbox, simply add the HTML codes below to your webpage. You can add, remove, change, and/or reorder the option elements in order to have a different list of possible, seletable values.

<form action="/servlet/SmartForm" method="get">
    <select name="N7:0">
        <option value="1">Up</option>
        <option value="2">Down</option>
        <option value="4">Idle</option>
    </select> 
    <input type="submit" value="Change Value">
</form>

Radio List

To change a word or float value (ie: N7:0 or F10:0) to a specific value using a radio button list, simply add the HTML codes below to your webpage. You can add/remove/change the input tags for different selectable radio buttons. The name parameter is what is used to distinguish the value in the SoftPLC.

<form action="/servlet/SmartForm" method="get">
    <input name="N7:0" type="radio" value="1">Up
    <input name="N7:0" type="radio" value="2">Down
    <input name="N7:0" type="radio" value="4">Idle
    <input type="submit" value="Set Machine">
</form> 

Push Buttons

To change a specific bit's state (ie: N7:0/0), you have 3 options. You can set the bit to ON or OFF (1 or 0) or you can toggle the bit. Please notice that there are 3 separate FORM blocks; this is because you can only have one named form element per form block.

<form action="/servlet/SmartForm" method="get">
    <input type="SUBMIT" name="N7:0/0,ON"     value="Turn Bit ON">
</form>
<form action="/servlet/SmartForm" method="get">
    <input type="SUBMIT" name="N7:0/0,OFF"    value="Turn Bit OFF">
</form>
<form action="/servlet/SmartForm" method="get">
    <input type="SUBMIT" name="N7:0/0,TOGGLE" value="TOGGLE Bit">
</form>