Reading query string parameter on form load.

Comments

2 comments

  • Avatar
    Lucas Drege

    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});

    }

     

     

     

     

    1
    Comment actions Permalink
  • Avatar
    Aamir Babar

    Thanks Lucas. That resolved the issue.

    0
    Comment actions Permalink

Please sign in to leave a comment.