Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation Error for Select Component and Data Source Type URL #5523

Open
Leeloo5E opened this issue Feb 22, 2024 · 4 comments
Open

Validation Error for Select Component and Data Source Type URL #5523

Leeloo5E opened this issue Feb 22, 2024 · 4 comments

Comments

@Leeloo5E
Copy link

Describe the bug

When using the Select component with the DataSource "URL" selected, a validation error occurs in the browser console.

If you use several of these select components with "URL", the browser becomes increasingly slower and even stops. The form is also hardly usable anymore.

Version/Branch

├── @formio/js@5.0.0-rc.39 ├── @formio/core@2.0.0-rc.10

Steps To Reproduce

  1. Install Formio JS and create form builder
  2. Create a select component
  3. Go to data section and select "URL" as Data Source Type
  4. Set a Data Source URL
  5. Save the form
  6. Open form in Viewer

Expected behavior
No error. Form works well.

Actual behavior

Validator error: Failed to validate available values in select component 'organizationalUnitName': data source url is not valid}

Additional context
Seems the error is cause from
https://github.com/formio/core/blob/v2.0.0-rc.10/src/process/validation/rules/validateAvailableItems.ts#L141

@lane-formio
Copy link
Contributor

My initial suggestion is to update core to the latest rc to see if that has resolved.
Otherwise, I'd suggest using the latest stable release versions.

@radovan-jupa
Copy link

I tried @formio/js 5.0.0-rc.47 with @formio/core 2.1.0-dev.tt.3 (both latest versions) and I have same issue.

@radovan-jupa
Copy link

radovan-jupa commented Apr 24, 2024

I think that problem could be function isValidateableSelectComponent. The function does not check value of validation settings onlyAvailableItems but only existence of this property. Even though the component has disabled validation of onlyAvailableItems (validate.onlyAvailableItems = false), it still performs validation on the available values.

https://github.com/formio/core/blob/master/src/process/validation/rules/validateAvailableItems.ts#L17

function isValidateableSelectComponent(component: any): component is SelectComponent {
    return (
        component &&
        !!component.validate?.hasOwnProperty('onlyAvailableItems') &&     // probably should be !!component.validate?.onlyAvailableItems
        component.type === 'select' &&
        component.dataSrc !== 'resource'
    );
}

@lane-formio
Copy link
Contributor

Have you attempted this with formiojs@4.19.1 and core@2.0.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants