Multiple pages validations before form submitting - scheming 3.0.0
Mohab25 opened this issue · 2 comments
Hi, i'm updating to ckanext-scheming version 3.0.0 to have the new feature of splitting form to multiple pages , now after clicking next on the first page which i assume takes to the next page, i get a Validation error for one of the required fields of the next page, which i suppose means the form is submitted as a whole before the next page fields are filled,
is this the expected behavior?, how to get the validation only on the current page fields ?
here is a yaml sample:
dataset_fields:
- start_form_page:
title: Detailed Metadata
description:
These fields improve search and give users important links
field_name: title
label: Title
required: true
- field_name: description
label: Description
required: true
- field_name: owner_org
label: Responsible Organisation Name
required: true
preset: dataset_organization
help_text: Organisation responsible for the metadata record.
- start_form_page:
title: Identification
description:
These fields improve search and give users important links
field_name: notes
label: Abstract
required: true
form_snippet: markdown.html
form_placeholder: eg. Some useful notes about the data
help_text: Brief narrative summary of the content of the resource.
- field_name: doi
label: DOI
required: false
help_text: Digital Object Identifier of the metadata record (if any)
validators: doi_validator
thx,
Yes each page does submit the data back to ckan so the validation for all metadata fields needs to pass.
You can either move all required fields to the first page or use a custom required validator for your fields that depends on the page being submitted or the state being set to 'active' (so that it applies to normal API calls too)
A custom validator like this would be useful for other people in your situation, if you go this route consider submitting it for inclusion in ckanext-scheming so that it can be used automatically.