Support » Plugin: Post My CF7 Form » Wanted to map dynamic dropdown.
Wanted to map dynamic dropdown.
-
https://i.imgur.com/k9NYhz6.png Here is the dashboard.
Looks like I messed up the question. Here it is simpler terms:
I have displayed dynamic dropdown using CF7 Smart Grid Design Extension on the frontend. Using this plugin now I want to map it to custom taxonomy i.e. Categories. But in the dashboard only two option is displayed i.e checkbox and filter option, in which I wanted Dynamic Dropdown. What did I miss here?dynamic dropdown[…] doesn’t show up in the dashboard
that’s how it is designed.
Dynamic dropdowns can have multiple sources (posts, taxonomy, filter…) and therefore it is difficult to constrain its mapping to taxonomy. (it would require quite a lot of extra coding/maintenance to make sure the mapping only works for taxonomy sources.
Hence, create a normal dropdown menu with no options (or checkboxes), and map it to a taxonomy. The Post My CF7 plugin will then automatically populate it with the terms of the taxonomy you mapped it (so you get the same result as the dynamic dropdown).
I created a normal dropdown menu in the form with no options and mapped it to the taxonomy which has categories with terms in it, but in the frontend, the dropdown doesn’t show any option. Is there anything I missed? Thank you so much for your time sir.
Mapping Dashboard: https://i.imgur.com/VolUZWZ.png
Frontend: https://i.imgur.com/i37bJiC.pngbut in the frontend, the dropdown doesn’t show any option. Is there anything I missed
Once the form is mapped and published it should have the taxonomy terms populated in the drop-down.
Check to see if you have any errors on the server?
Hi Aurovarata. I can see Uncaught ReferenceError: jQuery is not defined in console in the end of this code.
(function( $ ) {
‘use strict’;
(function(){ //make scope local to this script
$( document).ready(function() {
var fname;
var cf7Form = $(“div#cf7_2_post_9543a23950 form.wpcf7-form”);
var $input;
if(cf7Form.is(‘div.cf7-smart-grid.has-grid form.wpcf7-form’)){
//if the smart grid is enabled, execute the loading once the grid is ready
cf7Form.on(‘cf7SmartGridReady’, function(){
preloadForm($(this));
});
}else{
preloadForm(cf7Form);
}
// function to load all the data into the form
function preloadForm(cf7Form){
var data = ”;
if(‘function’ == typeof $.fn.post2CF7FormData) data = cf7Form.post2CF7FormData(‘cf7_2_post_9543a23950’);
else if( ‘undefined’ != typeof window[‘cf7_2_post_9543a23950’] ) data = window[‘cf7_2_post_9543a23950’];
fname = ‘<input type=”hidden” name=”_cf72post_nonce” value=”cf7_2_post_9543a23950″ />’;
cf7Form.find(‘input[name=_wpcf7]’).parent().append(fname);
if(0 === data.length){
cf7Form.trigger(“cf7_2_post_9543a23950”, data);
return false;
}
fname = JSON.parse(data.menu_283);
cf7Form.find(‘select[name=menu-283]’).addClass(‘js-select2’).append(fname);
$(“.js-select2″, cf7Form).each(function(){
$(this).select2();
})
if(data.map_post_id !== undefined){
fname = ‘<input type=”hidden” name=”_map_post_id” id=”cf2_2_post_id” value=”‘ + data.map_post_id + ‘” />’;
cf7Form.find(‘input[name=_wpcf7]’).parent().append(fname);
}
fname = ‘<input type=”hidden” name=”_map_author” id=”cf7_2_post_user” value=”1″ />’;
cf7Form.find(‘input[name=_wpcf7]’).parent().append(fname);
/* trigger the formMapped event to let other scripts that the form is now ready */
cf7Form.trigger(“cf7_2_post_9543a23950”, data);
//console.log(‘cf7_2_post_9543a23950 form ready’);
}//end preloadForm()
}); //document ready
})(); //call local function to execute it.
})( jQuery );I solved this one. Even though this error is gone, taxonomy field isn’t populated.
Sorry to trouble you Sir. The problem is solved. Thank you. 😀
Sorry to trouble you Sir.
no trouble. Glad you got it to work finally!
Hi @wpsubash ,
how did you solve the problem regarding the not visible select-options in the frontend?
Thanks!
Rob
@robertdrost please do start a new thread if you do not get a reply from @wpsubash
- You must be logged in to reply to this topic.