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

DynamicForm MultiChoice field doesn't work #1510

Closed
bva999 opened this issue Apr 11, 2023 · 8 comments · Fixed by #1709
Closed

DynamicForm MultiChoice field doesn't work #1510

bva999 opened this issue Apr 11, 2023 · 8 comments · Fixed by #1709
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:bug
Milestone

Comments

@bva999
Copy link

bva999 commented Apr 11, 2023

Category

[ ] Enhancement

[ x] Bug

[ ] Question

Version

[ 3.13.0 ]

Expected / Desired Behavior / Question

If list has MultiChoice field, it doesn't work on DymanicForm. On change of the field you get next error:

Observed Behavior

If list has MultiChoice field, it doesn't work on DymanicForm. On change of the field you get next error:

Error MultiChoice_selection TypeError: seletedItemArr_1.splice is not a function at DynamicField._this.MultiChoice_selection (DynamicField.js:344:1) at DropdownBase._this._onChange (Dropdown.base.js:36:1) at DropdownBase.<anonymous> (Dropdown.base.js:699:1) at pr (sp-pages-assembly_en-us_4cafeb97a327fa2ca2288389688aa683.js:69:54054) at ms (sp-pages-assembly_en-us_4cafeb97a327fa2ca2288389688aa683.js:69:91499) at Lc (sp-pages-assembly_en-us_4cafeb97a327fa2ca2288389688aa683.js:69:108084) at IKDZ.t.unstable_runWithPriority (sp-pages-assembly_en-us_4cafeb97a327fa2ca2288389688aa683.js:69:4739) at Ki (sp-pages-assembly_en-us_4cafeb97a327fa2ca2288389688aa683.js:69:50343) at Ac (sp-pages-assembly_en-us_4cafeb97a327fa2ca2288389688aa683.js:69:104823)

Thanks!

@ghost
Copy link

ghost commented Apr 11, 2023

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label Apr 11, 2023
@bva999
Copy link
Author

bva999 commented Apr 26, 2023

UPD: It doesn't work only when creating an item, when updating it works.

@bva999
Copy link
Author

bva999 commented Jul 19, 2023

Unfortunately with the new version (3.15.0) the bug has not been fixed.... And it’s been almost 4 months now

@bva999
Copy link
Author

bva999 commented Jul 19, 2023

private MultiChoice_selection = (event: React.FormEvent<HTMLDivElement>, item: IDropdownOption): void => {
    const {
      changedValue
    } = this.state;

    try {
      let selectedItemArr;
      if (changedValue === null && this.props.fieldDefaultValue !== null) {
        selectedItemArr = [];
        this.props.fieldDefaultValue.forEach(element => {
          selectedItemArr.push(element);
        });
      }
      else
        selectedItemArr = !changedValue ? [] : changedValue;

      if (item.selected) {
        selectedItemArr.push(item.key);
      }
      else {
        const i = selectedItemArr.indexOf(item.key);
        if (i >= 0) {
          selectedItemArr.splice(i, 1);
        }
      }

      this.setState({ changedValue: selectedItemArr });
      this.props.onChanged(this.props.columnInternalName, selectedItemArr);
    } catch (error) {
      console.log(`Error MultiChoice_selection`, error);
    }
  }

When Item is Created changedValue is a text value.
And this lines causes an error:

else
       selectedItemArr = !changedValue ? [] : changedValue;

     if (item.selected) {
       _selectedItemArr.push(item.key); ( ERROR HERE!!! )
     }

Because in this case selectedItemArr is not an array but text!!
PLEASE FIX IT! It’s been 4 months!!!

GuidoZam added a commit to GuidoZam/sp-dev-fx-controls-react that referenced this issue Jul 19, 2023
@GuidoZam
Copy link
Contributor

Hi @bva999 it should be fixed now.

@bva999
Copy link
Author

bva999 commented Jul 19, 2023

Hi @GuidoZam . Thank you.

@joelfmrodrigues
Copy link
Collaborator

@bva999 Thanks for raising the bug and confirming that it's still an issue as it was not marked as resolved as part of the latest release.
We welcome PRs to help resolve issues (@GuidoZam many thanks!) and since you knew where the issue was happening and what was causing it, you could have sent a PR to help speed up the resolution.
Every single maintainer of this repository works on it outside of working hours using their own personal time, so it will take whatever it takes for things to get fixed. We do our best with the time we have and greatly appreciate help from the community. If a person raises an issue and a PR is created to fix it, personally, this is a priority for me as more time was already invested in it.

@joelfmrodrigues joelfmrodrigues added the status:fixed-next-drop Issue will be fixed in upcoming release. label Sep 10, 2023
@joelfmrodrigues joelfmrodrigues added this to the 3.16.0 milestone Sep 10, 2023
@joelfmrodrigues
Copy link
Collaborator

PR merged and the fix should be available on the beta release within a few minutes.

@AJIXuMuK AJIXuMuK mentioned this issue Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants