ckan / ckan/ckanext-scheming

Formpages does not work when a required field is in the second page

Open
#386 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
102
Forks
182
PR merge metrics
No merged PRs in 30d

Description

ckan version: 2.10
ckanext-scheming: latest (installed on 01.07.2023)

have a field with ```required: true``` after the first form_page causes an error message while being in the first form_page.
It looks that the form_page only separates the field visually and ckan processes the whole field at once.

to reproduce the error:
scheming.yml -> Although the field "Resource" is a required field in the second form page, I cannot even see the second page, because in the first form_page I receive the error of not filling the Resource field as an obligatory field.

```
scheming_version: 2
dataset_type: test
about_url: http://example.com/the-camel-photos-schema

dataset_fields:

- start_form_page:
title: Basic Info
description: Required and core dataset fields

field_name: title
label: Title
preset: title
form_placeholder: eg. A descriptive title

- field_name: name
label: URL
preset: dataset_slug
form_placeholder: eg. my-dataset

- field_name: owner_org
label: Organization
preset: dataset_organization

- start_form_page:
title: Detailed Info
description:
These fields improve search and give users important links

field_name: tag_string
label: Tags
preset: tag_string_autocomplete
form_placeholder: eg. economy, mental health, government

- field_name: url
label: Source
required: true
form_placeholder: http://example.com/dataset.json
display_property: foaf:homepage
display_snippet: link.html

resource_fields:

- field_name: url
label: URL
preset: resource_url_upload

- field_name: name
label: Name
form_placeholder: eg. January 2011 Gold Prices

- field_name: description
label: Description
form_snippet: markdown.html
form_placeholder: Some useful notes about the data

- field_name: format
label: Format
preset: resource_format_autocomplete
```

Here a screenshot of the error:

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with the provided scheming.yml on CKAN 2.10 and ckanext-scheming latest, focusing on the required url field after the second form_page. Trace how form-page validation processes fields, then verify that the first page can be submitted without filling required fields on later pages and that the second page still validates its own required fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.