Ticket Form
Advanced
Using JavaScript to control the form

Ticket Form - Using JavaScript to control the ticket elements

Query the DOM node

You can query the DOM node of the ticket elements. This allows you to assign properties and call methods on the elements during runtime.

HTML
<ab-create-ticket
  id='my-ticket-form'
  ticketFormID='YOUR-TICKET-FORM-ID'
  // ...additional attributes
></ab-create-ticket>

Using JavaScript to add properties and call methods

JavaScript
// Get the DOM node of the Ticket Form
const ticketform = document.getElementById('my-ticket-form');
 
const userID = 'a64427d6';
const username = 'John Doe';
const email = 'john@doe.com';
 
// Set the users details
ticketform.userID = userID;
ticketform.username = username;
ticketform.email = email;
 
// Programmatically open the Ticket Form
ticketform.open();

See all the available attributes and methods in the Ticket Form Reference.


Aidbase Docs © 2024