Activate search from form inputs

[ad_1]

I have a form built with the calculated form fields plugin for selecting drive end information above a table. When selecting options from the form the information is added to the search box but the search is not activating unless I click inside it or press a key on my keyboard.

Is there a way I can activate the search without manually interacting with the search box?

<script type="text/javascript">


function displayColumns() {

//  console.log(jQuery("#fieldname13_1").val());
//  jQuery("fieldname13_1").val('Ft-Lb (Foot-Pound)').trigger('change')
//  var val="Ft-Lb (Foot-Pound)";
//  jQuery("fieldname13_1").trigger("change").val('Ft-Lb (Foot-Pound)');


//jQuery('.ninja_column_2').hide();
//jQuery('.ninja_column_3').hide();
//jQuery('.ninja_column_4').hide();
//jQuery('.ninja_column_5').hide();
//jQuery('.ninja_column_6').hide();
//jQuery('.ninja_column_7').show();

//jQuery('.ninja_column_2').css("display","none !important");
//jQuery('.ninja_column_3').css("display","none !important");
//jQuery('.ninja_column_4').css("display","none !important");
//jQuery('.ninja_column_5').css("display","none !important");
//jQuery('.ninja_column_6').css("display","none !important");
//jQuery('.ninja_column_7').css("display","none !important");

//jQuery('.ninja_column_2').css("visibility","hidden");
//jQuery('.ninja_column_3').css("visibility","hidden");
//jQuery('.ninja_column_4').css("visibility","hidden");
//jQuery('.ninja_column_5').css("visibility","hidden");
//jQuery('.ninja_column_6').css("visibility","hidden");
//jQuery('.ninja_column_7').css("visibility","hidden");

//jQuery(".ninja_column_2").addClass("hide_all");
//jQuery(".ninja_column_3").addClass("hide_all");
//jQuery(".ninja_column_4").addClass("hide_all");
//jQuery(".ninja_column_5").addClass("hide_all");
//jQuery(".ninja_column_6").addClass("hide_all");
//jQuery(".ninja_column_7").addClass("hide_all");

//jQuery("td .ninja_column_2").addClass("hide_all");
//jQuery("td .ninja_column_3").addClass("hide_all");
//jQuery("td .ninja_column_4").addClass("hide_all");
//jQuery("td .ninja_column_5").addClass("hide_all");
//jQuery("td .ninja_column_6").addClass("hide_all");
//jQuery("td .ninja_column_7").addClass("hide_all");

}



function buildSearch() {

  var a=jQuery('input[name="fieldname6_1"]:checked').val();
  if(a==null)
    a="";
  else
    a="""+a+'"';
  //var b=jQuery("#fieldname8_1").val();
  var c=jQuery("#fieldname9_1").val();
  var d=jQuery("#fieldname10_1").val();
  d=d.trim();


  var x=a + " " + c + " " + d;

//console.log( "a="+a );
//console.log( "c="+c );
//console.log( "d="+d );
//console.log( "x="+x );

  jQuery(".dataTables_filter input").val(x);
  jQuery(".dataTables_filter input").focus();
  jQuery(".dataTables_filter input").trigger("keypress").val(function(i,val){return val + ' ';});
  //displayColumns();
}

//jQuery(document).on("click", "#image1", function() {
jQuery(document).ready(function(e) {


  //click on the first option (images)
//  jQuery(document.body).on('click',"#fieldname6_1",function (e) {
  jQuery(document.body).on('click',"[id^=fieldname6_1]",function (e) {


//        var radioValue = jQuery("input[name=fieldname6_1]:checked").val();
//        if(radioValue){
//            alert("radioValue="+radioValue);
//        }

    //e.preventDefault();
    //e.stopPropagation();
    //move the screen to the next option
    
    jQuery('html, body').animate({
      scrollTop: jQuery("#fieldname9_1").offset().top-120
    }, 2000);

    //first unhighlight the image from all tools
    //jQuery(".dfield img").removeClass("select_tool");
//    jQuery("#fieldname6_1_rb8").prop('disabled', true).parent().css({backgroundColor:'#fcc'});
    jQuery("#fieldname6_1_rb0").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb1").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb2").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb3").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb4").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb5").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb6").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb7").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb8").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb9").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb10").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb11").parent().css({"opacity": ".15"});
    jQuery("#fieldname6_1_rb12").parent().css({"opacity": ".15"});

    //highlight the image
//console.log(this);
//console.log(this.parent().attr('name'));
//    jQuery(this).find("img").css("background-color","red");
//    jQuery(this).closest("img").css("background-color","red");
//    jQuery(this).parent().children("span").children("img").css("background-color","red");
    //jQuery(this).parent().css("background-color","red");
//jQuery("span").parent().css({"color": "red", "border": "2px solid red"});
jQuery(this).parent().css({"opacity": "1"});
    //jQuery("#image1").addClass("select_tool");

    buildSearch();
    jQuery("fieldname13_1").val('Ft-Lb (Foot-Pound)').trigger('change')


  });


  //click on the second option
  jQuery(document.body).on('change',"#fieldname8_1",function (e) {
//    e.stopPropagation();
    //move the screen to the next option
    jQuery('html, body').animate({
      scrollTop: jQuery("#fieldname10_1").offset().top-120
    }, 2000);
    buildSearch();
    jQuery("fieldname13_1").val('Ft-Lb (Foot-Pound)').trigger('change')
  });


  //click on the third option
  jQuery(document.body).on('change',"#fieldname9_1",function (e) {
//    e.stopPropagation();
    //move the screen to the next option
    jQuery('html, body').animate({
      scrollTop: jQuery("#fieldname13_1").offset().top-120
    }, 2000);
    buildSearch();
    jQuery("fieldname13_1").val('Ft-Lb (Foot-Pound)').trigger('change')
  });


  //click on the fourth option
  jQuery(document.body).on('change',"#fieldname10_1",function (e) {
    //e.preventDefault();
//    e.stopPropagation();
    //move the screen to the next option
    jQuery('html, body').animate({
      scrollTop: jQuery("#drive-ends-table").offset().top-120
    }, 2000);
	jQuery('.column-3').hide();
	jQuery('.column-4').hide();
	jQuery('.column-5').show();
	jQuery('.column-6').hide();
	jQuery('.column-7').hide();
	jQuery('.column-8').hide();

console.log(jQuery("#fieldname13_1").val());
    buildSearch();
  });

/*
  //change the search box as the calculated form field changes
  jQuery(document.body).on('change',"#fieldname7_1",function (e) {
    //e.stopPropagation();
//alert('calculated field changed');
    jQuery(".input-group input").val(jQuery("#fieldname7_1").val());
    jQuery(".input-group input").blur();
    jQuery("#fieldname7_1").focus();
var e = jQuery.Event("keydown");
e.which = 50; // # Some key code value
jQuery("#fieldname7_1").trigger(e);
    jQuery("#fieldname7_1").blur();
    jQuery(".fooicon").click();
  });
*/

});
</script>

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer