The below link will open the webform (New Ticket) in a dialog and prepopulate its fields with some data:

<a href="/form/new-ticket?uid={{ field_uid }}&nid={{ field_nid }}" class="btn btn-success btn-lg webform-dialog webform-dialog-normal">Submit</a>

I would like to once a user will click the above link:

  1. Detect that the New Ticket webform is being loaded.
  2. Fire some calculation in custom code.
  3. Then set the value of a text field element on that webform = to the calculation result.

I believe a CustomWebformHandler.php file can do the job but I am not sure how to detect that the webform is being loaded so my custom code (calculation) will start right awa !!!

I was thinking of using a controller that will be fired when when the url of the webform will be visited but it did not work for me since the webform is opened in a dialog !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.