two related item child

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
esit2018
Posts: 2
Joined: Fri Sep 28, 2018

28 Sep 2018

Hi,

I have two related item child with refresh, but I can only refresh one of the related item child. I have a lookup field named Maquina, it's a parent. And two related item child, one is a horquilla list an the other is a bombas list. I want refresh the two child list when I select a Maquina in the lookup field. This is my javascript code:
//first filter on page load
setHashhorquilla();
setHashbomba();
//and attach an on-change handler that will call the filtering function wherever the value of the field changes
fd.field('Maquina').control().change(function() {
setHashhorquilla();
setHashbomba();
});

//this is the actual function that filters the list
function setHashhorquilla(){
//get value
var value = fd.field('Maquina').value();
//alert("Maquina"+value);
if (value == "(None)") {
value = "";
}
value = encodeURIComponent(escape(value)).replace(/\-/g, "%252D");
//set the URL’s hash value. An explanation on this is at the end of the article.
window.location.hash = "InplviewHash" + $(".related-horquilla [webpartid]").attr("webpartid") + '=FilterField=Modelo_x003a_ID-FilterValue=' + value;
}
function setHashbomba(){
//get value
var value = fd.field('Maquina').value();
//alert("Maquina"+value);
if (value == "(None)") {
value = "";
}
value = encodeURIComponent(escape(value)).replace(/\-/g, "%252D");
//set the URL’s hash value. An explanation on this is at the end of the article.
window.location.hash = "InplviewHash" + $(".related-bomba [webpartid]").attr("webpartid") + '=FilterField=Modelo_x003a_ID-FilterValue=' + value;
}

Thanks for your help.
Ruben

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

01 Oct 2018

Hi!

You just need to implement minor changes in function setHashbomba():

Code: Select all

function setHashbomba(){
    //get value
    var value = fd.field('Maquina').value();
    //alert("Maquina"+value);
    if (value == "(None)") {
        value = "";
    }
    value = encodeURIComponent(escape(value)).replace(/\-/g, "%252D");
    //set the URL’s hash value. An explanation on this is at the end of the article.
    var hash = window.location.hash;
    window.location.hash = hash + "#InplviewHash" + $(".related-bomba [webpartid]").attr("webpartid") + '=FilterField=Modelo_x003a_ID-FilterValue=' + value;
}

esit2018
Posts: 2
Joined: Fri Sep 28, 2018

01 Oct 2018

Many thanks. The code run perfectly.

Ruben Cayuelas

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 21 guests