Select to view content in your preferred language

Can't set CHECKBOX to be a required field

2479
3
Jump to solution
10-01-2012 08:59 AM
KeithGanzenmuller
Frequent Contributor
I'm having trouble setting several checkboxes to "required".
In Studio when I open my form the checkbox "required" property is grayed out.
The checkbox is False be default and I want to require the user to confirm they have checked a serial number before saving the form data.
It is a text field in the GDB and has a coded value domain that only allows True or False values.

Thanks
Keith
Tags (3)
0 Kudos
1 Solution

Accepted Solutions
HannahFerrier
Deactivated User
Hi Keith,

This behavior has been included by design as of ArcPad 7.

The CHECKBOX Control does not support the required attribute because of the nature of the control (eg. can only be true/false, not null)

The need for further clarification about the CheckBox Control behavior in the Customizing ArcPad Help has been noted by the ArcPad Dev Team and should be included in future versions of ArcPad and the new Customizing ArcPad Online Help

Thanks,

Hannah

View solution in original post

0 Kudos
3 Replies
HannahFerrier
Deactivated User
Hi Keith,

This behavior has been included by design as of ArcPad 7.

The CHECKBOX Control does not support the required attribute because of the nature of the control (eg. can only be true/false, not null)

The need for further clarification about the CheckBox Control behavior in the Customizing ArcPad Help has been noted by the ArcPad Dev Team and should be included in future versions of ArcPad and the new Customizing ArcPad Online Help

Thanks,

Hannah
0 Kudos
ThaiTruong
Deactivated User
Keith,

You can force user to check the checkbox(es)  by using form/page validation.
For example, on page 1 of your form, you have a checkbox control named "Check1".  This code below will help you get started:

Have this subroutine somewhere in your VBScript:
Sub ValidateChk(pThisEvent)
 Dim pControls
   Dim pThisForm, pThisPage
  
   Set pThisPage = pThisEvent.Object
   Set pThisForm = pThisPage.Parent
   Set pControls = pThisForm.Pages("PAGE1").Controls

 If pControls.Item("Check1").Value = False Then
  ThisEvent.MessageText ="Checkbox is required."
  ThisEvent.Result = False
  Exit Sub
 End If
End Sub


Then, under Page 1, OnValidate Event, call the subroutine above:
Call ValidateChk(ThisEvent)
0 Kudos
KeithGanzenmuller
Frequent Contributor
Excellent, thanks for the code. That will do the trick.
0 Kudos