Skip to content

Instantly share code, notes, and snippets.

View morosmo's full-sized avatar
🎯
Focusing

D-E-V morosmo

🎯
Focusing
  • Morosoft
  • Rawalpindi
  • 21:24 (UTC +05:00)
View GitHub Profile
/// PROBLEM ///
// Listing grid of a CPT.
// Each row has an EDIT button.
// The button opens a JetPopup with a form inside.
// After editing the fields, I cannot configure a REDIRECT action in the form, as it refreshes the page and the listing returns to the first page.
// If the edit occurred on page 10, it's a hassle to have to return to the page where you were before EDITING every time.
// 👉 Place inside an HTML widget on the page where the popup will open.
jQuery(document).ready(function ($) {
$(window).on("jet-popup/render-content/ajax/success", function (event, params) {
$(document).on("jet-form-builder/ajax/on-success", function () {
@Lonsdale201
Lonsdale201 / code
Last active March 20, 2025 02:30
JetFormBuilder - Formless Action success reload jetengine lisitng grid with ajax
(function($) {
'use strict';
/**
* Developer note:
* This code use the native "fetch" function to intercept AJAX calls
* for the 'remoovehouuse' endpoint. When it detects a successful (HTTP 200)
* response with `{"code":"success"}`, it automatically reloads all Listing Grids
* that have the class ".formless-ajax.elementor-widget-jet-listing-grid".
* Change the .formless-ajax if you want to use different class target
@VictorPietro
VictorPietro / close_jetpopup_after_jetformbuilder_successful_submit.js
Created January 15, 2025 06:27
Close a JetPopup after successful JetFormBuilder submit
jQuery(document).ready(function($) {
// Listen for the JetFormBuilder submit success event
$(document).on('jet-form-builder/ajax/on-success', function() {
// Wait for 2 seconds after the form is successfully submitted
setTimeout(function() {
// Simulate a click on the popup close button
$('.jet-popup__close-button').trigger('click');
}, 2000); // Time in milliseconds (2 seconds)
});
});
@Crocoblock
Crocoblock / jet-engine-macros-shortcode.php
Last active March 2, 2025 16:12
Register [jet_engine_macros] shortcode to use JetEngine macros anywhere
<?php
/**
* How to use:
* 1. Add this code to your website with any code snippets plugin or into functions.php of your active theme.
* 2. In your admin area go to JetEngine/Macros Generator, generate and copy macros you need.
* 3. Use this macros anywhere with shortcode in following format: [jet_engine_macros macros="%generated_macros%"]
*
* Real world example:
* [jet_engine_macros macros="%jet_engine_field_name|event_date|field_value%"]
*/
@Qubadi
Qubadi / gist:aedf82f9cb08070612f7e4d88ac0d70a
Created May 4, 2024 23:26
Jetformbuilder: Auto-fill and format date inputs from MM/DD/YYYY to DD/MM/YYYY
This jQuery script automatically populates the JetFormBuilder form date inputs with today's date in MM/DD/YYYY format and
updates corresponding hidden fields to the DD/MM/YYYY format upon form submission. The script ensures that the dates are
visible and considered 'selected' by the user, improving data accuracy and user experience without manual entry. It supports
multiple date fields and can easily be configured to handle various date and hidden field IDs, making it ideal for ensuring
consistent date formatting and handling across front-end displays and back-end processing.
1. Firstly, copy the custom HTML code and paste it into your snippet plugins. Create a new HTML snippet and save it as "footer".
2. Create a date field and a hidden field. Name both fields and change the IDs to your preferred IDs:
{ visible: 'YOUR DATE FIELD NAME/ID', hidden: 'YOUR HIDDEN FIELD NAME/ID' },
3. Add the hidden field name to Jetformbuilder's post-submit action (content) to display the date format as DD/MM/YY.
@Crocoblock
Crocoblock / code.html
Last active April 16, 2025 09:23
JetFormBuilder Do something on form submit
<script>
document.addEventListener( 'DOMContentLoaded', function() {
const {
addAction,
} = window.JetPlugins.hooks;
addAction( 'jet.fb.observe.after', 'example/onSubmit', init );
function init( observable ) {
@Crocoblock
Crocoblock / code.php
Created December 20, 2023 13:34
JetAppointment Exclude not full-duration slots
<?php
add_filter( 'jet-apb/time-slots/slots-html/slots-list', function( $slots, $format, $dataset, $date, $service, $provider ) {
$duration = jet_apb()->calendar->get_schedule_settings( $provider, $service, null, 'default_slot' );
foreach ( $slots as $time => $slot ) {
if ( $slot['to'] - $slot['from'] < $duration ) {
unset( $slots[ $time ] );
}
@Crocoblock
Crocoblock / code.js
Last active February 20, 2025 18:58
JetFormBuilder JS
//jQuery submit success
jQuery( document ).on( 'jet-form-builder/ajax/on-success', function( event, response, $form ) {
//do something
} );
//wp hook on submit
//https://gist.github.com/Crocoblock/d6d1828a785ad55addb8f497deb7f3ba
//to get Observable that represents the form with ID of 128
let observable = JetFormBuilder[128];
@Crocoblock
Crocoblock / jfb-call-hook.php
Last active August 21, 2025 05:12
JetFormBuilder Call Hook action
<?php
add_action( 'jet-form-builder/custom-action/test-hook', function( $request, $action_handler ) {
//get value of field field1
$value = $request['field1'];
//or using jet_fb_context()->resolve_request()
$value = jet_fb_context()->resolve_request()['field1'];
@ihslimn
ihslimn / jsf-dv-meta.php
Created June 26, 2023 08:36
JetSmartFilters Meta Dynamic Visibility
<?php
add_filter( 'jet-smart-filters/query/meta-query-row', function( $row ) {
if ( in_array( $row['key'], array( '__reload_provider' ) ) ) {
$row = array();
}
return $row;