I have a web map I am putting together for field data collection. When I first began configuring it in field maps on AGOL I had one field set as radio buttons. After checking it in the app I decided I would prefer it as a switch. After changing it back to a switch, it now fails to display as anything other than a combobox. I even have "No Value" disabled now and it now defaults to that for some unknown reason instead of the default value I have setup in my GDB. Was working at first but for some reason now just unexplainably doesn't work? Has anyone dealt with this issue or similar? I have some conditional visibilities applied to groups and some calculated expressions for non-related fields this shouldn't have any interference.
So far field maps configuration has been extremely frustrating, and I feel like it needs to be improved. I find myself afraid to edit anything for fear of it breaking my smart forms.
Solved! Go to Solution.
For it to render as a switch the domain must hold two and only two values AND your feature template must default to one of those two values. If either of those two items are not satisfied it will render as a combobox even if you have it set to a switch.
I believe the same is true for the radio buttons except you can have more than two options in your domain, but a default value will need to be added to your feature templates for that field.
Since it is defaulting to "no value" it appears you don't have a default value set in your feature template or the value that is set is no longer in your domain.
For it to render as a switch the domain must hold two and only two values AND your feature template must default to one of those two values. If either of those two items are not satisfied it will render as a combobox even if you have it set to a switch.
I believe the same is true for the radio buttons except you can have more than two options in your domain, but a default value will need to be added to your feature templates for that field.
Since it is defaulting to "no value" it appears you don't have a default value set in your feature template or the value that is set is no longer in your domain.
Thanks this is helpful. I have the default values set in my GDB settings but for some reason there are no templates in the templates tab for both features and related tables. I suppose I need to figure out how to ensure there are templates.
@JustinReynolds , maybe you can help me out, I still have that problem.
My ESRI platform is in french, but i'll translate along the way!
Here is the field properties:
{
"name": "entretien_requis",
"type": "esriFieldTypeInteger",
"alias": "entretien_requis",
"sqlType": "sqlTypeOther",
"nullable": false,
"editable": true,
"domain": {
"type": "codedValue",
"name": "DomEntretienRequis",
"mergePolicy": "esriMPTDefaultValue",
"splitPolicy": "esriSPTDefaultValue",
"codedValues": [
{
"name": "oui",
"code": 1
},
{
"name": "non",
"code": 0
}
]
},
"defaultValue": 0
}
As you can see, my domain contains 2 values, coded 0 and 1, and the default value is 0.
Here is the configuration of this field in Field Maps Designer:
Name of field: entretien_requis
Type d'entrée/input type: Bouton basciule/switch button
And then the possible values: non or oui
You can also see the default value is present ("non") and greyed out.
However, I don't see a switch button in the field maps app.
I recharged the map, and this is what I get:
On loading form, "Aucune valeur" means no value/null, however it should be by default "non" or 0:
Then when clicking on the list, the shown options are correct.
Then when closed again, "non" is selected but still no switch button.
Thanks for your help.
Hello,
Aside from having a default value at the layer (schema) level defined for that field, you will need to confirm that the feature template has a default of 0 defined as well. In field maps designer you will find templates at the page next to "Form".
If there isn't a template default set for that field then you will need to set it and that would solve your problem. Everything else seems to be in order.
This problem may have been caused in ArcGIS Pro before you published it.
Assuming you published this service from ArcGIS Pro, I suspect your feature templates were not honored when published because they were not actually "stored" as ESRI calls it. You can check the templates in Pro to see if what you published has the values "stored". This is in Pro 2.9.x.
From the Manage Templates Pane, select a template and view it properties.
The blue line to the left of the field indicates that the default value as NOT been stored in the feature template. If the default is <null> then that is okay, but for an field with a default value that is a problem. There appears to be a bug "or a feature" with this as a "Field that is using the geodatabase default value" are not actually honored when published. This is an issue we saw way back in Pro 2.5 and we reported it. It appeared fix in 2.6 and 2.7 and then in 2.8 it appears to have reverted back to being a problem. At any rate storing the values seems to fix the issue with feature templates once published.
Right Click the field and choose to "store" the value.
After storing the value the line will change from blue to green.
Viewing the field again after having stored and save it the fields having default values stored (which may or may not be the same as the geodatabase default value) will be gray.
Hope this helps.
Hi Justin,
Thanks for a great explanation.
However, these fields were added directly through the API as it is a hosted feature layer and not through Pro. But I just managed (10 minutes ago) to create a template for the fields with API (I wrote my code here). Everything seems to work in Field Maps.
However, now I wonder if I need a default value at all? Why need the template and a default value?
Thanks!
The default in the template should be sufficient to drive the form functionality that you need. If you want a default value for the field for when a form is bypassed or as a fall back it can be done with python. We use python to add or change default values by hitting an endpoint in the ArcGIS REST API as we have had no luck doing it with the Python API.
We also manage our Feature Templates and Domains dynamically based changes in various business databases for hosted services at scale (100s of changes across 1000's of feature services everyday) making calls to the appropriate methods in the ArcGIS Python API.
Glad you got it working. It felt like the templates were the issue you were running up against.