Parse JSON on Likert control failing validation

Hello,

We are using the Public Forms service and Power Automate to capture the form details into a PDF and then onto a SharePoint Online site.

We are seeing an error on one of the Likert controls in one of our Parse JSON Power Automate actions:

{
"errors": [
{
"message": "Invalid type. Expected String but got Null.",
"lineNumber": 0,
"linePosition": 0,
"path": "[0]",
"schemaId": "#/items",
"errorType": "type",
"childErrors":
}
]
}

For some reason we are seeing a null value for the 'Accessing Health Services' section.

For reference, this is the control in our form:

Dear @chris.cundy,
Well, most likely it's submitted empty, like this:

You can set Likert Scale as required to avoid this:
image

Alternatively, you can set all values to N/A on form load with JavaScript:

fd.rendered(function () {
  fd.control('LikertScale1').value = ['N/A', 'N/A', 'N/A', 'N/A', 'N/A']
});

@Nikita_Kurguzov

I've reviewed a form that has been submitted and these values were selected:

image

Dear @chris.cundy,
This is clearly a different submit, as there are other values like Mental health: 2 that do not match:

@Nikita_Kurguzov

I've now found the correct item:

Now I can see that the user hasn't selected an item in the top line.

I will follow your guidance about making those bit required.

@Nikita_Kurguzov

I have added the javascript code however when I go to load the public form, the Likert options are not defaulting to "N/A".

/*****************************************************************************
The JavaScript code from this section will be executed while loading
the current form.

The following predefined variables can be utilized in the code:

fd - instance of the current form
$ - jQuery object

==============================================================================

fd.rendered(function () {
// This code is executed once the form is rendered

// Hide State field for all values of Country field except 'USA'
function updateStateVisibility() {
    var stateContainer = $(fd.field('State').$el).closest('.form-group');
    if (fd.field('Country').value === 'USA') {
        stateContainer.show();
    } else {
        stateContainer.hide();
    }
}

// Set initial State visibility
updateStateVisibility();

// Update State visibility after changing Country
fd.field('Country').$on('change', updateStateVisibility)

});

fd.beforeSave(function () {
// This code is exeuted before saving the form and
// may return Promise. The saving does not proceed until
// the Promise is resolved. If the Promise is rejected,
// the saving interrupts. This is the appropriate place
// for adding custom validation.

// Prevent saving if Start Date is greater than End Date
if (fd.field('StartDate').value > fd.field('EndDate').value) {
    throw Error('Start Date must not be greater than End Date.');
}

});

fd.saved(function (result) {
// This code is executed after saving the form

// Forwarding users to specific URL
window.location = '--- Some URL ---';

});

*****************************************************************************/
fd.rendered(function(){
fd.validators.push({
name: 'LikertScale validator',
error: 'Please ensure that the Personal Details section has been correctly filled out.',
validate: function() {
if (fd.control('LikertScale1').value.includes(null) || fd.control('LikertScale1').value.includes(undefined))
return false;

        return true;
    }
});

fd.validators.push({
    name: 'LikertScale validator',
    error: 'Please ensure that the Support Needs section has been correctly filled out.',
    validate: function() {
        if (fd.control('LikertScale1').value.includes(null) || fd.control('LikertScale1').value.includes(undefined))
            return false;

        return true;
    }
});

fd.validators.push({
    name: 'InkSketch Validator',
    error: "Please ensure that the Applicant has signed the form",
    validate: function(value) {
        if (fd.control('ApplicantSig').value == null)
            return false;

        return true;
    }
});

fd.validators.push({
    name: 'InkSketch Validator',
    error: "Please ensure that the Allocated Lead Worker hassigned the form",
    validate: function(value) {
        if (fd.control('AllSupWorkerSig').value == null)
            return false;

        return true;
    }
});

fd.rendered(function () {

fd.control('LikertScale2').value = ['N/A', 'N/A', 'N/A']
});

fd.rendered(function () {
fd.control('LikertScale1').value = ['N/A', 'N/A']
});

fd.rendered(function () {
fd.control('LikertScale3').value = ['N/A', 'N/A', 'N/A', 'N/A', 'N/A']
});

fd.rendered(function () {
fd.control('LikertScale3').value = ['N/A', 'N/A', 'N/A', 'N/A', 'N/A']
});

fd.rendered(function () {
fd.control('LikertScale4').value = ['N/A', 'N/A', 'N/A', 'N/A', 'N/A']
});

fd.rendered(function () {
fd.control('LikertScale5').value = ['N/A', 'N/A']
});

fd.rendered(function () {
fd.control('LikertScale6').value = ['N/A', 'N/A', 'N/A']
});

Dear @chris.cundy,
I see too much code, can you test it like this?
image