iOS required fields bug?

4499
8
08-10-2015 11:52 AM
BenAller
New Contributor III

I’m editing an AGOL-hosted related table in Collector 10.3.2 and the required fields seem to work in Android but not in iOS. One is a date field (pump date), one is a short integer (pump volume).  Although I set the default values of both to “” in the definition template, the pump date defaults to null and the pump volume defaults to 0 in iOS, but neither are required. Do you know how I can require them in iOS or is this a bug? 

Thanks,

Ben

Android.pngiOS.PNG

0 Kudos
8 Replies
PaulCone
New Contributor III

I started a project in April and the required fields were working correctly in iOS then, but they are not now.  I have suspected ESRI broke something with an update, as we are using a hosted service.  This is a good clue.  I will test on Android and report back.

0 Kudos
PaulCone
New Contributor III

I just had my colleague test this on his Android phone and it is not requiring the fields as it should, so I am suspecting this is not an iOS specific thing.  I did post about this on a thread earlier this year but I haven't heard anything since.

Re: Collector can't handle required fields, i.e. Nulls Not Allowed?

0 Kudos
ScottPrindle
Esri Regular Contributor

Are you able to make a call to Esri Support Services? If this is in fact a bug, that would get another pair of eyes on the issue and be the quickest way to bring it to the development team's attention.

Thanks,

Scott

0 Kudos
PaulCone
New Contributor III

I emailed a Solution Engineer in the Olympia office who has seen my implementation and he said he's asked the development team about this.

0 Kudos
TroyProctor
New Contributor III

I'm having the same issue on iOS.

0 Kudos
ScottPrindle
Esri Regular Contributor

Hey Troy,

What version of Collector for ArcGIS on iOS are you currently seeing this issue on?

0 Kudos
TroyProctor
New Contributor III

Version 10.3.5. Which I think is the most recent.

Troy

0 Kudos
PaulCone
New Contributor III

Someone at ESRI gave me the following informal suggestion...

"ArcGIS Online and Collector use editing templates (which are defined in ArcMap).  Editing templates require a default value.  So, when you define a field with “Allow NULL Values” equals “No”, and do not specify a default value, then default values are added to the template when the service is created.

These default values are a space (“ “) for text fields, a zero (0) for numeric fields, and a date in 1899 for date fields.

You can see this by creating a service with “Allow NULL Values” equals “No”, no default values, publish the service, and then have a look at the template section of the service REST URL JSON.

Development is aware of this issue and is working on a solution. However there is no target date. The challenge is that this issue is not limited to Collector – it really is an ArcGIS platform-wide issue.

There really is no good workaround, but one “workaround” that you may want to consider is:

Specify default values for all fields (ArcMap will do this in the editing template if you don’t).

Use CAPS for required field names, so that it is more obvious for users.

Set defaults for text fields to something like “REQUIRED”, and for numeric fields to something like -99.

And then train your users that a field name in CAPS is required.

Another workaround, although risky and with its own issues is to edit the default values out of the template.

This blog and linked doc explains how to open up the REST URL JSON in admin mode:

http://blogs.esri.com/esri/arcgis/2014/10/19/updating-hosted-feature-services-in-arcgis-online/ 

You need to be careful, as if you make a mistake you will corrupt the service. So make sure you can easily recreate the service!

For example, your service looks something like:

  "templates" : [

    {

"name" : "Required_Test",

      "description" : "",

      "drawingTool" : "esriFeatureEditToolPoint",

      "prototype" : {

"attributes" : {

"DOUBLE_R" : 0,

          "TEXT_R" : " ",

          "DATE_R" : -2209161600000,

          "TEXTDOMAIN_R" : " "

}

      }

    }

  ],

Using the admin capability, go and delete all the attributes under that have a default field setup and change the last edit data to “”  (There is an issue with the last edit date at the top – if you don’t change it to "" you will get a validation error). The edited template section would look something like this:

"templates" : [

    {

"name" : "Required_Test",

      "description" : "",

      "drawingTool" : "esriFeatureEditToolPoint",

      "prototype" : {

"attributes" : {

}

      }

    }

  ],

Here are the screenshots of the required fields. You will see the required text and the submit button disabled. After you fill out the fields and have a valid location the submit button will activate.

This is a bit of a hack. What you will notice is that editing the template breaks the editing in ArcGIS Online."