Possible Bug in Edit Form with Multi-Select

Home Forums Cascading dropdowns Possible Bug in Edit Form with Multi-Select

Viewing 27 reply threads
  • Author
    Posts
    • #15157
      Brent Caudill
      Participant

        Hi Alexander,

        I may have run into a bug in the Edit form when using a multi-select cascade. The issue presents itself when the multi-select field only has a single option available. When this is the case, the underlying SP field is not populated when loading the edit form (see attached image).

        The ‘All Options’ and ‘Selected Options’ boxes are outlined in red, and I have to remove the ‘selected option’ and add it back for it to update the SP field correctly. Otherwise, if you save the form without re-adding the selection, it saves the item with an empty SP field.

        If the multi-select field has more than one option available, it populates the underlying SP field with the selected option(s) correctly on load.

        I have updated my install to the latest version of DFFS (4.4.2.5) and Cascading Dropdowns (3.6.6)

        Any help resolving this would be appreciated.
        Thanks,
        Brent

        Attachments:
      • #15202
        Alexander Bautz
        Keymaster

          Hi,
          I have looked at it, and think I have found the cause. I’m away for the weekend, and will not be able to publish a new version until late Sunday – or possibly Monday.

          Alexander

        • #15222
          Alexander Bautz
          Keymaster

            Could you please test this new version to see if it behaves better?

            Get it here and replace it in “SPJS/DFFS/plugins”.

            As the “DFFS loader” has not been updated you might find the previous version cached. Look at the version information by hovering over the “Enhanced with DFFS” link below the DFFS enabled form, and ensure the cascading dropdown plugin has v3.6.7. If not, try opening the developer tools > network and clear the cache from there.

            Alexander

          • #15224
            Brent Caudill
            Participant

              Thanks for the quick response Alexander!

              I just ran through several tests and it appears to be fixed with v3.6.7

              Thanks again!
              Brent

            • #15282
              Alexander Bautz
              Keymaster

                Thanks for the feedback.

                Alexander

              • #27889
                Filipe Ribeiro
                Participant

                  I all,

                  I’m reviving this topic because lately I’m having this issue with Cascading and Multi Select, trying to tackle it for 5 days but no success. Here’s the info:

                  Version information
                  DFFS Loader: v1
                  DFFS frontend: 4.4.4.16 – November 28, 2019
                  DFFS frontend CSS: 4.53 /
                  Autocomplete: 1.6.42 – November 28, 2019
                  Cascading dropdowns: 3.7.32 – October 27, 2019
                  jQuery: 1.12.4
                  Lookup: 1.1.19 – October 27, 2019
                  Resource management: not loaded
                  SPJS-Utility: 1.340 – November 28, 2019
                  vLookup: 2.2.142 – November 28, 2019

                  Also attached some printscreens, first one is the real list on production server, the second one is a test I made only with cascading two fields from another list and without MultiSelect on dev server

                • #27893
                  Alexander Bautz
                  Keymaster

                    Can you also show me a screenshot of the source list where you get the data from?

                    Do you use single line of plain text in the source list and also single line or multiple line of PLAIN TEXT in the current list for the cascading dropdown fields?

                    Are you using any filters in the casc setup that makes the previous selected items not show in the current list of possible options?

                    Alexander

                  • #27895
                    Filipe Ribeiro
                    Participant

                      Screenshot of the source: Capture-casc03.PNG

                      Screeshot of the current: Capture-casc04.PNG and is filter Capture-casc05.PNG

                      Hope it clarifies

                    • #27902
                      Alexander Bautz
                      Keymaster

                        Can you confirm that the field “Entidades” is a multiline PLAIN TEXT field?

                        It’s hard to tell exactly what it could be without looking at it, but does it work if you do not use the filter CAML query?

                        Alexander

                      • #27904
                        Filipe Ribeiro
                        Participant

                          Sorry. Thank for quick replys

                          Field “Entidades” setup: Capture-casc06.PNG

                          Q: “…but does it work if you do not use the filter CAML query?”
                          A: No it does not. Same result as showed in Capture-casc01.PNG. Tested it before in a simple cascade on EditForm (Capture-casc02.PNG)

                          Attachments:
                        • #27907
                          Alexander Bautz
                          Keymaster

                            Try activating “debug” by setting

                            "debug": true

                            in the argument to the function spjs.casc.init and post the output / screenshot.

                            Alexander

                          • #27909
                            Filipe Ribeiro
                            Participant

                              Has requested

                              With CAML: Capture-casc07.PNG

                              Without CAML: Capture-casc08.PNG

                            • #27917
                              Alexander Bautz
                              Keymaster

                                All looks right, but I’m wondering how the source list date is created. Is it manually entered or based on some kind of integration writing the data from another date source?

                                The reason I ask is that I have seen similar problems when the source data contained invalid (and invisible) characters – like a line feed in a single line of text field.

                                Alexander

                              • #27924
                                Filipe Ribeiro
                                Participant

                                  Hi Alexander,

                                  Actually we’ve imported “Distrito” and “Concelho” from XLS into the database, to a another list called “DiCo”. This list then feeds fields in “Entidade”, then a third one, the problematic, gets data from “Entidade”, on NewForm the cascading is working fine but the edit does not.

                                  Don’t know what to try anymore. But did you succeed on fixing the problems when the source data contained invalid (and invisible) characters?

                                • #27927
                                  Filipe Ribeiro
                                  Participant

                                    Hi again

                                    Thanks to what you wrote I created a test list (Test_List) without imported data from external source. Created a cascading to read data from itself and I get no errors 😮

                                    Based on this, what you suggest? Check the imported data for “invalid”/invisible characters?

                                  • #27931
                                    Filipe Ribeiro
                                    Participant

                                      We found the issue

                                      On “Entidades” list we can have more them one “Setor de Atividade” (another list). Based on that, the data is loaded on a note field, multiline in “Entidades”, and the data as a line brake ;\n in the end. On the database this scenario is confirmed.

                                    • #27933
                                      Filipe Ribeiro
                                      Participant

                                        @Alexander your questions lead us to the problem. Thanks for the fast reply

                                      • #27935
                                        Alexander Bautz
                                        Keymaster

                                          I’m glad you identified the problem. As you already have figured out, the fix must be applied in the integration code to remove the invalid characters.

                                          Alexander

                                        • #27938
                                          Filipe Ribeiro
                                          Participant

                                            Can you help showing the direction to clear the invalid (linebrake) on save in NewForm.aspx? Or something?

                                            Unfortunately don’t know how to fix due to programming knowledge limitation 🙁

                                          • #27946
                                            Alexander Bautz
                                            Keymaster

                                              The invalid characters are removed when you save in NewForm by SharePoint already so the problem is that when you load the item in EditForm, the current data in the form does not match the values pulled from the datasource because your current form value is like this:

                                              Test value

                                              but the value pulled from the datasource is like this:

                                              Test
                                              value

                                              This means the form does not find the current value in the dataset and shows it as invalid.

                                              The best would be to fix the values as they are written to the list by your other code, but if this is not possible you can use this method and then loop over the dataset – removing any invalid characters. This method requires that you pull in all the data so if your dataset is large (over 5000 items) it might take some time to load the form.

                                              Let me know if you are not able to fix this in the other end and I can help you write the function to clean the data.

                                              Alexander

                                            • #27959
                                              Filipe Ribeiro
                                              Participant

                                                Hello @Alexander,

                                                Thanks for the reply, analysed the method you mention but I have doubts how to do it with it, and I don’t actually think how it will resolve. Let me explain a bit further the case. I will reference lists only by letters to simplify the explanation, we got:

                                                # List A (on EditForm.aspx)
                                                – Data was imported from .xls

                                                > Capture-SA-01.PNG
                                                > Capture-SA-02.PNG

                                                Result: All data seems fine, no “;”,no linebrake (\n or <br>) and no spacings. Also accessed database with MS Access to validate.

                                                # List B (on NewForm.aspx)
                                                – Acquires data from List A
                                                – Source field – SPFieldText
                                                — Destiny field – SPFieldNote, Plain text
                                                — “Method” through a cascading in DFFS

                                                > Capture-EntSA-01.PNG
                                                > Capture-EntSA-02.PNG
                                                > Capture-EntSA-03.PNG

                                                Result: All data has “;” and linebrakes

                                                # List C (on NewForm.aspx)
                                                – Acquires data from List B.

                                                # List C (on EditForm.aspx)
                                                – If we manage to fix the issue between #A and #B probably #C will be valid, but let’s problem at the time 🙂

                                                > Capture-casc01.PNG

                                                (PART 1/2)

                                              • #27965
                                                Filipe Ribeiro
                                                Participant

                                                  (PART 2/2) – The rest of the printscreens

                                                  Hope you can help me out sorting this issue ?

                                                • #27986
                                                  Filipe Ribeiro
                                                  Participant

                                                    Hello again,

                                                    Activated the debug on “Field:multiline” cascading and once you choose one option the field adds an linebrake 🙁

                                                    Check image for reference

                                                  • #27993
                                                    Alexander Bautz
                                                    Keymaster

                                                      The line feed you find in the textarea when using the debug:true is intended and is added by the CASC script to ensure the output when viewed in DispForm is split into separate lines and it is not a caused by invalid data in the source list.

                                                      The problem with locating the line feed in the source list is that SharePoint actually strips away and hides it when you view the data in the form. The only way to identify it is by querying the list and looking at the return value.

                                                      Do you get the error in all records in the list, or only some records?

                                                      Alexander

                                                    • #27998
                                                      Filipe Ribeiro
                                                      Participant

                                                        It’s giving me error in all records in EditForm (List B). Check image Capture-EntSA-05.PNG, the data from that field is saved with an “;\n” in NewForm.

                                                        If I edit the field and manually remove the “;\n”, when I access EditForm everything if fine

                                                      • #28002
                                                        Alexander Bautz
                                                        Keymaster

                                                          Sorry, but I’m a bit confused – do you mean editform of the source list for the cascadig dropdown or the current list where you use the cascading dropdown to pick the values?

                                                          Alexander

                                                        • #28005
                                                          Filipe Ribeiro
                                                          Participant

                                                            The EditForm of the final list (B) were origin data (A) is pulled into. From List A into List B

                                                          • #28033
                                                            Alexander Bautz
                                                            Keymaster

                                                              It’s unfortunately hard to troubleshoot without looking at it directly.

                                                              You wrote:

                                                              On “Entidades” list we can have more them one “Setor de Atividade” (another list). Based on that, the data is loaded on a note field, multiline in “Entidades”, and the data as a line brake ;\n in the end. On the database this scenario is confirmed.

                                                              Can you show me a screenshot of one of the items in your Entidade from DispForm so I can see the value in the field?

                                                              I also want to clarify that the linefeed (;\d) in the current list where you use the cascading dropdown in :multi mode is supposed to be there between all selected values. This is by design to make it more readable in DispForm. You can however change this when you call the Cascading dropdown function manually form Custom JS like described here: https://spjsblog.com/dffs/dffs-plugins/spjs-cascading-dropdowns/#Change_multichoiceDelimiter

                                                              You might want to try that and replace the multichoiceDelimiter to see if it works better for you. Please note that to do that you must and move the code to Custom JS and delete the settings from the Cascading dropdowns tab.

                                                              PS: I had not documented the multichoiceDelimiter parameter until today.

                                                              Alexander

                                                          Viewing 27 reply threads
                                                          • You must be logged in to reply to this topic.