Skip to content

Instantly share code, notes, and snippets.

View aimahdi's full-sized avatar
💭
Working on something bigger

Amimul Ihsan aimahdi

💭
Working on something bigger
View GitHub Profile
@aimahdi
aimahdi / url_redirect.js
Created August 15, 2021 05:57
JavaScript URL Redirect from a dropdown/chained select field
let urlbox = document.getElementById("ff_150_chained_select_Website_"); //changed id with your specific id
urlbox.onchange = function(){
let url = document.getElementById("ff_150_chained_select_Website_").value;
window.open(url);
}
@aimahdi
aimahdi / password_check.js
Created August 15, 2021 06:01
The code will make second passwords field's text red until the password matched
//Change id with your password field's id
let passwordOne = document.getElementById("ff_143_password");
let passwordTwo = document.getElementById("ff_143_password_again");
passwordTwo.addEventListener('keyup', function(){
let passwordTwo = document.getElementById("ff_143_password_again");
console.log(passwordTwo.value);
//code here
if(passwordTwo.value==passwordOne.value){
@aimahdi
aimahdi / range_slider_value_customize.js
Created August 15, 2021 06:03
This code will customize range slider's value and process
let slider = document.getElementById('ff_148_rangeslider');
let text = document.querySelector('.ff_range_value');
let text2 = document.querySelector('.ff_range_value_2');
slider.onchange=function(){
let value = document.getElementById('ff_148_rangeslider').value;
value *= 15;
@aimahdi
aimahdi / input_upparcase_convert.js
Created August 16, 2021 10:18
This snippet will capitalise input
let inputBox = document.getElementById("ff_150_input_text");
inputBox.addEventListener('input', function(){
inputBox.value = inputBox.value.toUpperCase();
});
@aimahdi
aimahdi / remove_email_footer_fluent_form.php
Created August 16, 2021 11:04
Remove email notification footer in WP Fluent Forms
@aimahdi
aimahdi / fluent_forms_alter_data_before_submission.php
Created August 16, 2021 11:52
Fluent Form alter data before submission
add_filter('fluentform_insert_response_data', 'your_custom_response_data_filter_function', 10, 3);
function your_custom_response_data_filter_function($formData, $formId, $inputConfigs)
{
if($formId != 151) {
return $formData;
}
$formData['email'] = 'test@gmail.com';
@aimahdi
aimahdi / fluent_forms_confirm_email.php
Created August 17, 2021 16:04
The code snippet will check if both email field are matched or not
add_filter('fluentform_validate_input_item_input_email', function($errorMessage, $field, $formData, $fields, $form) {
$target_form_id = 8;
if($form->id != $target_form_id ) {
return $errorMessage ;
}
if( $formData['email'] != $formData['email_1'] ){
$errorMessage= ['Error! Email does not match'];
@aimahdi
aimahdi / email_match_check.js
Created August 18, 2021 11:43
This code snippet will check if both email field matched or not.
let emailFieldOne = document.getElementById('ff_156_email');
let emailFieldTwo = document.getElementById('ff_156_email_1');
let submitButton = document.querySelector('.ff-btn-submit');
submitButton.style.display = 'none';
emailFieldTwo.insertAdjacentHTML('afterend', '<div id="customDiv" style="text-align:center; display:none; color:red;"></div>');
let displayed = false;
let customDiv = document.getElementById('customDiv');
@aimahdi
aimahdi / range_slider_rafi.js
Created August 28, 2021 10:28
This code will customize range slider's value and process
(function(){
let sliderValue = document.querySelector('.ff_range_value');
var number = 0;
sliderValue.insertAdjacentHTML('afterend', `<span class=range_calc style='display: block; width: 100%; text-align: center; font-size: 32px; font-weight: 600;'>$0</span>`);
document.querySelector('.range_calc').insertAdjacentHTML('afterend', "<span class='text' style='display: block; width: 100%; text-align: center; font-size: 32px; font-weight: 600;'> Potential Earnings </span>");
number = document.querySelector('.ff_range_value').innerText.split('$');
number = number[0]*15;
document.querySelector('.range_calc').innerText =`$${number}`;
add_action('fluentform_before_insert_submission', function ($insertData, $data, $form) {
if($form->id != 229) { // 229 is your form id. Change the 229 with your own login for ID
return;
}
$redirectUrl = home_url(); // You can change the redirect url after successful login
if (get_current_user_id()) { // user already registered
wp_send_json_success([
'result' => [