0% found this document useful (0 votes)
69 views2 pages

1 Applicant Info Button

This document is a user script designed to create a red button on a specific webpage that, when clicked, autofills a form with predefined values. The script waits for the page to load, then appends the button and defines the autofill functionality for various input fields and dropdowns. It allows users to manually submit the form after autofilling the necessary information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views2 pages

1 Applicant Info Button

This document is a user script designed to create a red button on a specific webpage that, when clicked, autofills a form with predefined values. The script waits for the page to load, then appends the button and defines the autofill functionality for various input fields and dropdowns. It allows users to manually submit the form after autofilling the necessary information.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

// ==UserScript==

// @name Applicant Info Button


// @namespace http://tampermonkey.net/
// @version 0.1
// @description Click on the button and autofill information
// @author AyonVaiya
// @match https://payment.ivacbd.com/*
// @grant none
// ==/UserScript==

(function() {
'use strict';

// Wait until the page is fully loaded


window.addEventListener('load', function() {
// Create the red button
const redButton = document.createElement('button');
redButton.innerText = 'Autofill Form';
redButton.style.position = 'fixed'; // Fixed position for the button
redButton.style.top = '140px'; // Adjust the position to the top
redButton.style.right = '20px'; // Adjust the position to the right
redButton.style.backgroundColor = 'red';
redButton.style.color = 'white';
redButton.style.border = 'none';
redButton.style.padding = '10px 20px';
redButton.style.fontSize = '16px';
redButton.style.cursor = 'pointer';

// Append the button to the body


document.body.appendChild(redButton);

// Predefined form values


const formData = {
webfile_id: 'BGDKV021FF25',
webfile_id_repeat: 'BGDKV021FF25',
visit_purpose: 'Better Medical Treatment',
highcom: '5', // Value for "Khulna"
ivac_id: '3', // Value for "IVAC, KHULNA"
visa_type: '13', // Value for "MEDICAL/MEDICAL ATTENDANT VISA"
family_count: '1', // Value for "1" family member
};

// Function to autofill the form


function autofillForm() {
document.querySelector('input[name="webfile_id"]').value =
formData.webfile_id;
document.querySelector('input[name="webfile_id_repeat"]').value =
formData.webfile_id_repeat;
document.querySelector('textarea[name="visit_purpose"]').value =
formData.visit_purpose;

// Select the correct option in the High Commission dropdown


const highcomSelect = document.querySelector('select[name="highcom"]');
if (highcomSelect) {
highcomSelect.value = formData.highcom;
highcomSelect.dispatchEvent(new Event('change'));
}

// Select the correct option in the IVAC Center dropdown


const ivacSelect = document.querySelector('select[name="ivac_id"]');
if (ivacSelect) {
ivacSelect.value = formData.ivac_id;
ivacSelect.dispatchEvent(new Event('change'));
}

// Select the correct option in the Visa Type dropdown


const visaTypeSelect =
document.querySelector('select[name="visa_type"]');
if (visaTypeSelect) {
visaTypeSelect.value = formData.visa_type;
visaTypeSelect.dispatchEvent(new Event('change'));
}

// Select the correct option in the Family Count dropdown


const familyCountSelect =
document.querySelector('select[name="family_count"]');
if (familyCountSelect) {
familyCountSelect.value = formData.family_count;
familyCountSelect.dispatchEvent(new Event('change'));
}

// Now you can manually click the "Submit" button


const submitButton = document.querySelector('#submitButton');
if (submitButton) {
// Enable the button if it's disabled
if (submitButton.hasAttribute('disabled')) {
submitButton.removeAttribute('disabled');
}
// Leave the button clickable for manual click
}
}

// When the red button is clicked, autofill the form


redButton.addEventListener('click', autofillForm);
});
})();

You might also like