Choose Lookup and showing stored/related data in second Field

Hope you guys having a good day as far.

I have a Question about Lookup Field based in Form.
All data are stored in one list. I´m using a Lookup1 to select a Product.

How can I show up, the stored and related URL for this Produkct?

I tried to set up a Second Lookup2 field. It is working, but ist not automatically populate the only on URL. I have choose the URL in the dropdown.

Is there a way to Populate Lookup2 automatically?

Thank you for our help.

Hi @Andruu,

You could try retrieving extra fields from the same SharePoint list with the same Lookup. Learn more from the sections of this article dedicated to extra fields: Lookup field — Plumsail SharePoint Forms Documentation

I have some problems with the documentation.

It is possible to pre-select the Value (URL) in Lookup2 when I already selected an Value in Lookup1 Field?
Currently I must select Lookup2 as well.

Many thanks for your help.

Hi @Andruu,

You can select a Lookup value with JavaScript using ID like so: Lookup control — Plumsail SharePoint Forms Documentation
This is the same for Field and Control.

You can do this whenever the value changes as described here.

It seems I did something wrong. Every change I made in JS they won´t effected my Form.
For Example I did some Test like this:

fd.spRendered(function () {
// This code is executed once the form is rendered

fd.control('Text1').placeholder = "Enter your name";
fd.control('Text2').placeholder = "Enter your name";
fd.control('RichText1').placeholder = "Enter your name";
fd.control('Lookup1').placeholder = "Enter your name";
fd.field('feuerdepot_x0020_vk').value = '1234';

// Populating Resolution Date with the current date when a user sets
// Status field to 'Resolved'
fd.field('Status').$on('change', function (value) {
    if (value === 'Resolved') {
        fd.field('ResolutionDate').value = new Date();
    }
})

});

Nothing from these take any effect in my form.

I have no experience in JS - can you give me a hint.

Thanks
Andre

Hi @Andruu,

The code seems fine, could you share screenshots of any errors in the browser's console (F12)?

@IliaLazarevskii

thanks for your help :slight_smile:

This is what i get:

Hi @Andruu,

I couldn't reproduce the issue. Could you export the form and send us the file at support@plumsail.com?

Hi @IliaLazarevskii,

unfortunately i can´t because my test period is over since yesterday. So would need to expand it to validate. :frowning:

So I can´t purchase without validating the problem, because we can´t use the Forms.

Hi @Andruu,

I'll post the solution from our email discussion here so that others can also use it.

Text fields don’t have a placeholder property, use the html property as described in this article.

The errors are most likely caused by using the wrong field names. The names are case-sensitive, so feuerdepot_x0020_vk should be feuerdepot_x0020_VK.

Also, since the lookup field takes time to load after the form is rendered, you need to use the ready() function (find more details on this here):

fd.field('feuerdepot_x0020_VK').ready(function(field) {
    fd.field('feuerdepot_x0020_VK').value = 1;
});

Note that assigning a string to a lookup doesn’t work. Assign it the option ID, as described here.