Skip to main content
Participating Frequently
Jul 31, 2019 4:57 PM UTC
Question

msig_lock is null

I am getting msig_lock is null error when I do the following:

var m = this.getField('dt2_member_sig_'+n);

    var msig_lock = m.getLock();

    msig_lock.action = 'Include';

    msig_lock.fields = mfields;

Anyone have any ideas?

This topic is closed to new replies. Start a new post to keep the conversation going.

11 replies

Legend
Jul 31, 2019 5:22 PM UTC

Still, since we have no other ideas, I suggest putting the validation in. Who knows what could have happened, or what bugs it may uncover...

Translate
Participant
Jan 16, 2020 5:30 PM UTC

below is my code for creating a form based on a condition:

			var sShield = this.getField(nShield).value;
			this.getTemplate('PostDiveReport').spawn(this.numPages, false, false);
			this.pageNum = this.numPages-1;
			var pageFields = [
				{field:this.addField('Detail'+nDiverNum, 'text', this.pageNum, [387.36, 748.08, 468.55, 728.66]), value:'', property:'center'},
				{field:this.addField('Troop'+nDiverNum, 'text', this.pageNum, [501.09, 747.98, 581.46, 728.66]), value:'', property:'center'},
				{field:this.addField('SJS'+nDiverNum, 'text', this.pageNum, [387.48, 727.83, 468.51, 707.55]), value:'', property:'center'},
				{field:this.addField('Date'+nDiverNum, 'text', this.pageNum, [501.17, 727.83, 581.82, 707.55]), value:'', property:'center'},
				{field:this.addField('Shield'+nDiverNum, 'text', this.pageNum, [505.31, 699.32, 582, 685.7]), value:'shield', property:'center'},
				{field:this.addField('PostDiveReviewNarrative'+nDiverNum, 'text', this.pageNum, [30.48, 669.71, 581.04, 84.33]), value:'', property:'comment'},
				{field:this.addField('PostDiveSeniorDiverSignature'+nDiverNum, 'signature', this.pageNum, [30.48, 53.18, 305.35, 33.02]), value:'', property:'sig1'},
				{field:this.addField('PostDiveDivisionDivingOfficerSignature'+nDiverNum, 'signature', this.pageNum, [306.76, 53.61, 581.56, 33.45]), value:'', property:''}
			];
			pageFields.forEach(function (ai) {
				ai.field.textFont = font.HelvB;
				ai.field.textSize = 0;
				if (ai.property === 'center') {
					ai.field.alignment = 'center';
				}
				if (ai.property === 'comment') {
					ai.field.multiline = true;
					ai.field.doNotScroll = true;
				}
				if (ai.value === 'shield') {
					ai.field.value = sShield;
				}
				if (ai.property === 'sig1') {
					var f = this.getField('PostDiveSeniorDiverSignature'+nDiverNum);
					var oLock = f.getLock();
					oLock.action = 'Include';
					oLock.fields = ['Detail'+nDiverNum, 'Troop'+nDiverNum, 'SJS'+nDiverNum, 'Date'+nDiverNum, 'Shield'+nDiverNum, 'PostDiveReviewNarrative'+nDiverNum, 'PostDiveSeniorDiverSignature'+nDiverNum];
					f.setLock(oLock);
				}
			});

 var oLock = f.getLock(); seems to always return null?

 

actual returned erroro: TypeError: oLock is null
37:Document-Level:main

Line 37 is actually the var oLock line?

Translate
Bernd Alheit
Community Expert
Community Expert
Jan 16, 2020 5:41 PM UTC

May be that the locks of the field are not set.

Translate
Legend
Jul 31, 2019 5:19 PM UTC

Suggest checking m.type (perhaps writing to the console) before continuing with the getLock.

Translate
Jeff1776Author
Participating Frequently
Jul 31, 2019 5:21 PM UTC

It is a signature field.

this.addField('dt2_member_sig_'+n, 'signature', this.pageNum, [30.37, 117.44, 441.07, 97.28])

Translate