Skip to content

Instantly share code, notes, and snippets.

@ahsannayem
ahsannayem / Thank you page delay
Created September 8, 2023 04:50
Fluent Forms' Thank you page delay
$form.on('fluentform_submission_success', function() {
setTimeout(function(){ window.location.assign("http://www.mozilla.org");}, 5000);
});
const textarea = document.getElementById('TextArea_ID'); // Replace the id
textarea.addEventListener('input', function() {
const minTextLength = 10; // Set Minimum required text length
if (textarea.value.length < minTextLength) {
textarea.setCustomValidity('Please enter at least ' + minTextLength + ' characters.');
} else {
textarea.setCustomValidity('');
}
@ahsannayem
ahsannayem / Admin Table For Ninja Table
Last active September 27, 2023 06:01
Show table on the WordPress Deshboard
add_action( 'admin_menu', function () {
add_menu_page( 'Admin View', 'NT Admin', 'manage_options', 'myplugin/myplugin-admin-page.php', function () {
$tableId = 173; // This is ninja table ID;
ninjaRenderTableOnAdmin($tableId);
}, 'dashicons-tickets', 6 );
} );
// Global function to render a table in admin panel
function ninjaRenderTableOnAdmin($tableId)
{
@ahsannayem
ahsannayem / Booking Date Fluent Forms
Created July 6, 2023 09:44
Fluent Forms Validate the Date
add_filter('fluentform_validate_input_item_input_date', function ($errorMessage, $field, $formData, $fields, $form) {
$fieldName = 'weddingdate';
$target_form_id = 104;
if ($target_form_id != $form->id) {
return $errorMessage;
}
.fluent_form_98 .switch input[type="checkbox"] {
position: relative;
width: 34px;
height: 14px;
margin-right: 10px;
margin-left: 10px;
-moz-appearance: none;
-webkit-appearance: none;
background: rgb(107,114,128);
outline: none;
@ahsannayem
ahsannayem / Date Range Calculator
Last active July 1, 2023 16:36
Date range Calculator For Fluent Forms
var from = "from"; //change the name attribute of the from date field
var to = "to"; //change the name attribute of the to date field
var showHere = "showHere"; //change the name attribute of show difference field
let fp = flatpickr("#ff_91_from", {}); // Your Form's ID
let fp2 = flatpickr("#ff_91_to", {}); // Your Form's ID
function getDayDiff(input_name_1, input_name_2) {
var $date1 = $form.find('input[name='+input_name_1+']');
var time2 = (new Date()).getTime();