Javascript to access lookup Fields on Create

I would like to set up the editable flags on some fields in a Form depending on the contend uf an lookup Field.

The Code as followed does not work, the fd.field('Status').widget.text() is empty.
On the browser I can see, that the content of my lookup field is filled after the appearing of the form.

Any suggestions ?

Code:

window.fd = fd;

fd.spRendered(function() {
fd.field('Status').ready().then(function(field) {
//set Lookup field value once the field loads

alert(fd.field('Status').widget.text());

 if (fd.field('Status').widget.text() == '30 Disponiert' ) 
	{
        // Setting field PercentComplete to a disabled state
        fd.field('Menge').disabled = true;
    }
    else{
        // Setting field PercentComplete to an editable state
        fd.field('Menge').disabled = false;
    }

});
});

Ok, I have found the solution:
I have t ouse the internal ID to filter / select.
var StatusID = fd.field('Status').value.LookupId.toString();

And with this I can Filter a childe Table with XAML:

1 Like