Reading query string parameter on form load.
Hi,
How can i read query string parameter on form load and based on that parameter i make a rest service api (pass the parameter), get the response and pre-populate certain form fields.
Thanks
-
Hi Aamir,
For this we can use JS injected into a form, please see below script. I will also send you the sample application via email.
//Generic Method to read parameter
function urlParam(name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.search);
return (results !== null) ? results[1] || 0 : false;
}
eFormEvents.onFormLoadComplete = function () {
var controlName = 'Name'; //eForm UI Control name where value must be written
var controlValue = urlParam('Name'); // URL key passed in Query
eFormHelper.setFieldValue({fieldId: controlName, value: controlValue}); // Sets value from url to textbox
var controlName = 'EmployeeID';
var controlValue = urlParam('Emp');
eFormHelper.setFieldValue({fieldId: controlName, value: controlValue});
}

Please sign in to leave a comment.
Comments
4 comments