Hey @sajadakbari ,
Please check this code snippet. We have added a jQuery after_form_load hook for prefill values for user if needed.
Regards
hey @benjirahmed
i did it, but didn’t work
i added it to functions.php please check it:
function metformy(){
?>
<script>
jQuery(‘#metform-wrap-dc2c9c7-19538’).on(‘metform/after_form_load’, function(e, data){
console.log(‘s’);
data[ ‘schoolname’ ] = localStorage.school_name; // data[ YOUR_INPUT_NAME ] = YOUR_INPUT_VALUE
data[ ‘schoolcode’ ] = localStorage.school_code; // data[ YOUR_INPUT_NAME ] = YOUR_INPUT_VALUE
data[ ‘managername’ ] = localStorage.manager_name; // data[ YOUR_INPUT_NAME ] = YOUR_INPUT_VALUE
data[ ‘managermobile’ ] = localStorage.manager_mobile; // data[ YOUR_INPUT_NAME ] = YOUR_INPUT_VALUE
return data;
});
</script>
<?php
}
add_action(‘after_form_load’, ‘metformy’, 100);
Hey @sajadakbari ,
It seems you have added the code as wordpress hook and that will not work. Please add the code as normal script and hopefully the code will work. I have already informed you earlier that it is jQuery after form load hook.
But after adding the code as script if it doesn’t work as expected please open a support ticket at our support center. We will help you to solve the problem.
Regards