How do UNcheck a checkbox in a form?

6164
9
06-22-2011 08:30 AM
DAVIDBISHOP
New Contributor
I'm creating a form with check boxes in ArcPad Studio (arcpad 10). Whenever the form runs on the desktop or Trimble the boxes are checked. I want the default set to uncheck. I typed in "False" in the default value field but that didn't work.

Do I have to write code? Surely, I don't have to write code do I? The arcpad help was VB based.
Tags (3)
0 Kudos
9 Replies
TimHopper
Occasional Contributor III
I'm surprised that you are having difficulty changing this as you should be able to tell ArcPad whether the box should be checked or not via the default value.

Check box controls should be used on text fields, as the values of True and False get recorded to the attribute table. 

The default value can be changed either via the control properties or by navigating the tree structure of the layer definition.  I've included screenshots of both of these locations.  You should type the words True and False in as shown here.  Do not put them between double quotes, such as "True".

After you've gone back and made sure that your axf looks like the screenshots I've provided are you still seeing that the check boxes are checked on by default?

Thanks.
0 Kudos
DAVIDBISHOP
New Contributor
Tim, do I have to have a form based on the axf file? I was creating a form using a .shp file.

I did it without the quotes and it didn't work.

David

I'm surprised that you are having difficulty changing this as you should be able to tell ArcPad whether the box should be checked or not via the default value.

Check box controls should be used on text fields, as the values of True and False get recorded to the attribute table. 

The default value can be changed either via the control properties or by navigating the tree structure of the layer definition.  I've included screenshots of both of these locations.  You should type the words True and False in as shown here.  Do not put them between double quotes, such as "True".

After you've gone back and made sure that your axf looks like the screenshots I've provided are you still seeing that the check boxes are checked on by default?

Thanks.
0 Kudos
TimHopper
Occasional Contributor III
David,

This process should work regardless of if you are utilizing an axf file or a shapefile with an associated .apl layer definition file.

I've attached screenshots of the apl file.

I've also attached a zip file containing a test shapefile and .apl file.

My guess is that you've got something going on with your data. I would create a new shapefile and test with it to see if the behavior is any different.  Look over the attached files, perhaps you will be able to determine what's going wrong with yours.
0 Kudos
JasonTipton
Occasional Contributor III
I've had the same problem. I didn't really put too much into figuring out why, i just scrapped the checkbox for now.

Tried setting default value to "False", but still reported "True".

I'm running Nomad 800 with ArcPad 10.1 Windows Mobile6.1. I'll go back and check it out and see if I can get it to work.
0 Kudos
TimHopper
Occasional Contributor III
Update:

I've been looking into this a little further and have some additional insight.

For those of you who say that the False value is not working, is it not working for a brand new feature you create or is it not working when you open the feature properties for an existing feature?

If you've set True and False default values for a checkbox control these will be honored when you create a new feature in ArcPad.

If you have existing features in your document with NULL values in those fields (perhaps you checked out data from ArcMap and those features didn't have any True or False value already listed) they will all have their checkbox controls set to True (checked on) if you open their feature properties.

This goes for shapefiles with empty cells and axf files which have actual NULL values.

So.  If I modify a feature which doesn't have a True or False value in it already, why am I forced to choose between True or False?  Why can't I keep it as a NULL value?

Starting with ArcPad 7.1, checkbox controls allow for a "3 state control".  You can modify these controls to take values of True, False, or NULL.  By default, these checkbox controls are a 2 state control (True or False, no NULL values).

This can be modified in ArcPad Studio by adding the allownulls=True attribute to the checkbox control.

Here's the catch:

For some reason (we'll find that out, possibly bug) the CHECKBOX control doesn't think that the allownulls attribute can be used.  However, it can be.

If you look in the Customizing ArcPad help doc and look at the CHECKBOX control properties you'll see that the allownulls attribute is not listed under the Attribute Descriptions for CHECKBOX.

The workaround is to manually add the allownulls attribute to the checkbox control through the tree view of the layer definition.

Here's the biggest catch:

Because the checkbox control doesn't think it can use the allownulls attribute, if you actually open up the EDITFORM for that particular layer it will wipe out all of the allownulls attributes that you've added to your checkbox controls.  So yes, the allownulls attribute works properly as long as you don't open the EDITFORM after you've made the modification.

After you've set all of the checkboxes to be a 3 state control (by adding the allownulls=True attribute) when you open the feature properties of an existing feature (which has NULL values in the checkbox fields) the box will be checked on but grayed out.  A grayed out checkbox means that a NULL value will be entered.  You can then cycle through all three options.

Attached is a screenshot of a checkbox control with this attribute added.  You would right-click on the <CHECKBOX> control and select "Add Attribute".  The Name will be allownulls and the Value will be True.

Remember, after making this modification, don't open the EDITFORM!

- More info to follow -
0 Kudos
TimHopper
Occasional Contributor III
Update:

This issue has been logged as a software defect.  The ArcPad team will be looking into..

(a) The issue where existing features with NULL values automatically have their boxes checked on, instead of null.

and

(b) the allowsnull attribute of the layer definition getting removed each time the edit form is opened.

For the time being, you must utilize the workflow I included with my previous post (6/23) in order to cause the check boxes of existing features with null attributes to be unchecked when you open the feature properties.
0 Kudos
GuyBuller
New Contributor
It appears that this issue is still not fixed perhaps it is low on the problems list.


if objRS.Fields("MAINDIR").Value = "" or objRS.Fields("MAINDIR").Value = "F"then
  
   msgbox "the field is: " + objRS.Fields("MAINDIR").Value + " Really it is!"

        objEditForm.Pages("pge2").Controls("chkMainDir").value = False
  else
   objChkMainDir.value = True
  end if

Even calling the control directly does not set the check box to false. There is a problem with the check box or the VBScript  is acting erratically.
0 Kudos
RolfBroch
Occasional Contributor II
I use CheckBoxes all over and I made a little applet testing this out and to me, it seems that checkboxes works as intended.

Test it out using the enclosed applet

Rolf
0 Kudos
RolfBroch
Occasional Contributor II
I use checkboxes all over and they work fine. Check out the enclosed applet to see what I do.

Rolf
0 Kudos