Activating/deactivating options

566
1
10-31-2011 10:32 AM
anasmalkawi
New Contributor
I'm creating a form in ArcPad Studio 10 and would like to activate or deactivate selections based on answer given in previous selection.

Ex.

Question 1:       Is pipe above or below ground surface?
Answer options: Above, Below (Dropdown)

Question 2:       Height above ground?
Answer options: enter number

Is it possible to make Question 2 grayed out if the answer to Question one was "Below"?
Tags (3)
0 Kudos
1 Reply
RolfBroch
Occasional Contributor II
Yes, you can do that with a script like this:

Sub CheckToDisable()
  Dim cbx
  Set cbx = ThisEvent.Object
  If cbx.Value = "Below" Then
    cbx.Parent.Controls("lblHOG").Visible = False
    cbx.Parent.Controls("txtHOG").Visible = False
  Else
    cbx.Parent.Controls("lblHOG").Visible = True
    cbx.Parent.Controls("txtHOG").Visible = True
  End If
End Sub

and controls on a form like this:
<FORMS>
  <FORM name="frm_1" caption="Pipe info" width="130" height="130">
    <PAGE name="pag_1" caption="Page 1" sip="false">
      <LABEL name="lbPosition" x="2" y="2" width="68" height="10" caption="Pipe location:" tooltip="" group="true" border="false"/>
      <COMBOBOX name="cbxPosition" onselchange="Call CheckToDisable()" x="70" y="1" width="61" height="13" defaultvalue="" listtable="" listvaluefield="" listtextfield="" tooltip="" tabstop="true" border="false" sip="false" limittolist="false" sort="false">
        <LISTITEM value="Above" text="Above ground"/>
        <LISTITEM value="Below" text="Below ground"/>
      </COMBOBOX>
      <LABEL name="lblHOG" x="2" y="33" width="74" height="10" caption="Heigth above ground:" tooltip="" group="true" border="false"/>
      <EDIT name="txtHOG" x="77" y="31" width="29" height="12" defaultvalue="" tooltip="" tabstop="true" border="true" sip="false"/>
    </PAGE>
  </FORM>
</FORMS>

I have not tested this but it should work.

Rolf
0 Kudos