KRANTHI THEJ
unread,Apr 11, 2026, 6:59:18 AM (10 days ago) Apr 11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to xnat_discussion
Hi XNAT community,
We recently encountered an issue where the **Base XNAT Datatype dropdown in the Custom Form Generation wizard was empty** (showing "No choices to choose from"). After extensive debugging, we identified the root cause and a working fix. Sharing here in case others hit the same problem.
---
**Environment**
- XNAT version: 1.9.3.2 (build 681)
- Deployed via Docker (xnat-docker-compose)
---
**Root Cause**
The Custom Form wizard populates the datatype dropdown via `datatypeManager.js`, which calls the REST endpoint:
```
/xapi/role/displays/createable
```
On our instance, this endpoint was returning an error (`Invalid username and/or password`) despite valid credentials and correct user roles. The endpoint appeared registered in Swagger (`/xapi/v2/api-docs`) but failed at runtime — no exception was logged, and all other `/xapi/role/` endpoints (e.g. `/xapi/role/projects`) worked fine.
---
**Fix**
We modified `datatypeManager.js` to use the standard `/REST/search/elements` endpoint instead, which returns the same datatype information and works reliably.
File location inside the container:
```
/usr/local/tomcat/webapps/ROOT/scripts/xnat/app/formJson/datatypeManager.js
```
Changes made:
- Replaced the URL from `xapi/role/displays/createable` to `REST/search/elements?format=json&accessible=true`
- Updated the data mapping to read `ELEMENT_NAME` → `value` and `SINGULAR` → `label` from the new response format (nested under `ResultSet.Result`)
- Added a filter to exclude `template:sample` (a stale datatype that may exist on some instances)
To make the fix persist across container rebuilds, we mounted the modified file as a Docker volume in `docker-compose.yml`:
```yaml
volumes:
- ./xnat/datatypeManager.js:/usr/local/tomcat/webapps/ROOT/scripts/xnat/app/formJson/datatypeManager.js
```
---
**Questions for the XNAT team**
- Is `/xapi/role/displays/createable` known to have authentication issues in 1.9.3.2?
- Is there a planned fix in a future release?
- Would it make sense to fall back to `/REST/search/elements` if the primary endpoint fails?
Happy to share the full modified `datatypeManager.js` if useful.
Thanks,
Kranthi Thej Kandula
Euro-BioImaging/ CNR / University of Turin