Display another list fields in popup and save within single form

Hello there,
I'm trying to enter data in two list with single form in sharepoint online.
I have one form and I want to achieve add popup box with some fields ( like form with in form). And when user click on popups save button data should be entered in that list.
After inserting data I want to display that data in current form.
Is there any way I can get this?

Thanks in advance.
Have a good day ahead.

Hello @harshp924,

You can try out List or Library control. It allows you to add, edit, view items from within the form.

Please find the examples in our documentation here.

Thanks @mnikitina
i was trying to use list or library control but it shows the following error,

Hello @harshp924,

Most likely the issue is the language. The form is designed for one language, but List View for List or Library has a different name and cannot load. You can rename List View, to have the same name in this language.

Hello @mnikitina,
Thanks for quick response.....!
I am sorry i don't get your point,
I check my current view name and links for both users (one user's language is English and others is German), but i don't get any aspected result.
For English User it will not showing any error, but for German it shows above error,

I attached Screen shots for lists view here,

1>This is English User

2>This is German User

TIA.

Hello @harshp924,

Is the name of the list translated to German?

Please try to connect to a different list. Are you getting the same error message?

Thanks,
I think sharepoint is internally change current view name, so i change view name as "1" and it's work.

Hello @mnikitina,
I am getting this error while save Edit or new Form.

Hello @harshp924,

I'm sorry! Seems it was an issue on our side. Could you please try to save the form again and let me know if you get the same error or not.

Thank you!

Hello @mnikitina,
Yes, it is working fine now,
Can you tell me how can I achieve limitation of Fields that i was trying to enter with 'List or Library' Control,
For example, i have column 'hours' on my list and I want to allow each user can enter only four records in a list, and the total of these four records should be a maximum of 20.

Likewise, 'Hours' for first, second, third, and fours record is 5, so total is 20.
Now user can not enter the fifth record.

Please let me know if you don't get it,

Thanks.

Hello @harshp924,

You can calculate the total by the column. Please see this post for the code sample:

And you can use the below code to disable Add New Item button if the total is greater than or equal to 20:

fd.field('Total').$on('change', function(value){
    if(value >= 20) {
        fd.control('SPDataTable0').buttons[0].disabled = true;
    }
});

Thanks, @mnikitina,

I think it will solve my problem, but is there any way that i can only show data of only current logged in users.
Like when i use list and library control, i can see all data of list, i don't want this, like is there any way that i can only see an entry that added by the current user or i can only see any particular entry that added by user?
I hope you get my point,
Thanks In Advance.
Have a good day.

Hello @harshp924,

You can filter items in List or Library control dynamically. Please see this post from more details:

Hello, @mnikitina
Here is code i am useing and its completely work,
fd.spRendered(function() {
var dt = fd.control('SPDataTable0');
dt.ready().then(function() {
filterDT();
});

//filter List or Library with new value when Search field changes
fd.field('Search').$on('change', function() {
    filterDT();
});

function filterDT(){
    dt.filter = "<Contains><FieldRef Name='Title'/><Value Type='Text'>"
        + fd.field('Search').value + "</Value></Contains>";
    dt.refresh();
}

});

My problem is, it is showing all data even if it contains single latter/word, is there any way that i can check strictly and display only after complete match success.
also, I don't wan's use on change event, can i use some other jquery method for example blur, focusOut, focusIn like?

Also, can we set any value from form's field in List or Library control (list or library control's new item form)?

Hello @harshp924,

You can use Eq comparison operator instead of Contains like this:

dt.filter = "<Eq><FieldRef Name='Title'/><Value Type='Text'>"
        + fd.field('Search').value + "</Value></Eq>";

Hello @mnikitina,
is there any way we can change name of list column for different users language, i don't wont to change any thing in SharePoint list.

image

Hello @harshp924,

You can change the column headers using jQuery. Please see the code sample.

fd.control('SPDataTable1').ready().then(function(dt) {

    var header = $(fd.control('SPDataTable1').$el).find('th');
    //change header
   //3 is a column index
    $(header[3]).html('New header');

});

Thanks, @mnikitina.
Perfectly works for me.

1 Like