Filtering related items error

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

19 Sep 2018

Hi ,

I am trying to do the filtering using this article and i am getting this error:
filterissue.jpg
filterissue.jpg (28.81 KiB) Viewed 1609 times
How can i fix that?

User avatar
AlexZver
Posts: 232
Joined: Mon Aug 27, 2018

20 Sep 2018

Hi, Katy

What type of the field do you use as filtering field? Could you please provide the screenshot of your form with related items settings and your filtering code?

Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

20 Sep 2018

Hi Alex,
I believe the problem is that these two lists are not exactly related by look up, here is the situation:
Main list A (form) has a drop-down column with departments and the support list B has the same column with departments (it is text now but i can turn is to choice with drop-down). I need to have information from the list B to be shown for reference purpose only when they choose a department in list A - show only those lines from list B which are appropriate. Does it make sense? Should it work?

Correction: these lists are actually connected but main list A has a look -up to list B to get all the roles...

User avatar
AlexZver
Posts: 232
Joined: Mon Aug 27, 2018

21 Sep 2018

Hi Katy,

This should work proceeding from your description. To be more helpful I should have more details about your issue, so could you provide some more information? The screenshot of your form and the code would be relevant.

Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

21 Sep 2018

Sure.
This is the main form with related item:
filterissue1.jpg
filterissue1.jpg (201.93 KiB) Viewed 1590 times
I also tried to show All items without filter in the data source...

And here is the code:

setHash();

fd.field('IFSDepartments').change(setHash);

function setHash(){
var value = encodeURIComponent(escape(fd.field('IFSDepartments').value())).replace(/\-/g, "%252D");
window.location.hash = "InplviewHash" + $(".related-roles [webpartid]").attr("webpartid") + '=FilterField=Department-FilterValue=' + value;
}

User avatar
AlexZver
Posts: 232
Joined: Mon Aug 27, 2018

24 Sep 2018

Hi Katy,

The error is quite usual, I can't yet understand the reasons. Please try it on a different list, create new fresh lists to test the filtering itself with no extra fields or scripts. It helps us to figure out where the problem comes from.

Please, use either JS hash filtering or data source, not both. If you need dynamic filtering, please, stick to JS only.
Data source filtering does not update dynamically with values on the form, it only runs once when the form is opened.

Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

24 Sep 2018

Sure, i did a new list as main, used the same list for reference though.... the error is the same:
filterissue2.jpg
filterissue2.jpg (58.64 KiB) Viewed 1578 times
filterissue3.jpg
filterissue3.jpg (129.33 KiB) Viewed 1578 times
filterissue4.jpg
filterissue4.jpg (133.52 KiB) Viewed 1578 times

User avatar
AlexZver
Posts: 232
Joined: Mon Aug 27, 2018

24 Sep 2018

What about a brand new related items list? Is it the same behavior?

Please, try not to use both JavaScript and Data Source: Filter by form field.

Data Source: Filter by form field will only filter the results when you open the form, but won't work dynamically as you change IFSDepartments field, so it's best to leave it as Show all items from the view. This might be related to the error, so, please, change this setting.

Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

24 Sep 2018

I did a new reference list - same error.
I also switched to All items view in Data source - the same error, i've tested that before on my original list - didn't work

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

24 Sep 2018

Dear Katy,
If this is the case, please, remove the script entirely. Try to go to the form, click the small arrow near the Department column (appears when you move the cursor over it), and select any value for filtering:
Filters.png
Filters.png (7.8 KiB) Viewed 1567 times
What this essentially does is the same as the script. If you get the same error, please, try to do this outside the form, on the list itself.

Send us screenshots of the filtered list if this actually works in either the form, or the list itself.
Cheers

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 21 guests