chess251
Canvas Initiate

Able to pre-populate lookup dropdown from querystring, but not able to save

Hello,

 

I have searched the forum several times, tried some suggestions but still cannot get this right.

 

I'm trying to save the value of a lookup dropdown which is prepopulated from a querystring. Here is my code:

 

var myParam = "";

NWF.FormFiller.Events.RegisterAfterReady(function(){

JSRequest.EnsureSetup();
myParam = JSRequest.QueryString['ProjectID'];
//alert('myParam = ' + myParam);

PopulateProjectTitle(myParam);

});

function PopulateProjectTitle(myParam){
var endTime = Number(new Date()) + 20000; // try for 20 seconds
var interval = 500;

(function p(){

// If the condition is met, we're done!
if (ProjectLoaded()){
var proj = NWF$("#" + Project).val(myParam);
NWF.FormFiller.Functions.ProcessOnChange(proj);

//make Project field read-only after populating
//NWF$("#" + Project).prop('readonly',true);

}

// If the condition isn't met but the timeout hasn't elapsed, go again

else if (
Number(new Date()) < endTime){
setTimeout(p, interval);
} else {

// don't set the default value, the user will have to set

return;

}

})();

}

function ProjectLoaded(){

// "" is the default value for "Please select a value..."

if (NWF$("#" + Project).val(myParam) == "")
return true;
else
return false;
}

PopulateProjectTitle(myParam);

 

The autopopulate is working great, but when clicking the button to save, the dropdown defaults back to 'Select a value..'

 

Any assistance will be greatly appreciated. I'm using Nintex Forms O365 Classic version.

 

Thank You!!

0 Kudos
Reply
1 Reply
chess251
Canvas Initiate

Able to pre-populate lookup dropdown from querystring, but not able to save dropdown value

Hello,

 

I have searched the forum several times, tried some suggestions but still cannot get this right.

 

I'm trying to save the value of a lookup dropdown which is prepopulated from a querystring. Here is my code:

 

var myParam = "";

NWF.FormFiller.Events.RegisterAfterReady(function(){

JSRequest.EnsureSetup();
myParam = JSRequest.QueryString['ProjectID'];
//alert('myParam = ' + myParam);

PopulateProjectTitle(myParam);

});

function PopulateProjectTitle(myParam){
var endTime = Number(new Date()) + 20000; // try for 20 seconds
var interval = 500;

(function p(){

// If the condition is met, we're done!
if (ProjectLoaded()){
var proj = NWF$("#" + Project).val(myParam);
NWF.FormFiller.Functions.ProcessOnChange(proj);

//make Project field read-only after populating
//NWF$("#" + Project).prop('readonly',true);

}

// If the condition isn't met but the timeout hasn't elapsed, go again

else if (
Number(new Date()) < endTime){
setTimeout(p, interval);
} else {

// don't set the default value, the user will have to set

return;

}

})();

}

function ProjectLoaded(){

// "" is the default value for "Please select a value..."

if (NWF$("#" + Project).val(myParam) == "")
return true;
else
return false;
}

PopulateProjectTitle(myParam);

 

The autopopulate is working great, but when clicking the button to save, the dropdown defaults back to 'Select a value..'

 

Any assistance will be greatly appreciated. I'm using Nintex Forms O365 Classic version.

 

Thank You!!

0 Kudos
Reply