0

I'm modifying some code of a text search box, now I have the following code

  $categories = maybe_unserialize(get_option('_fm_categories',array()));
    $pluginsurl = plugins_url();
    $comcat = '';
    $sw = 6;
    if($cat_view == 'compact') {
        $comcat = "<div class='col-md-3'>".'<label for="wpdm-cats-compact">'.__('Category:','wpdmap').'</label>'.wpdm_dropdown_categories('wpdm-cats-compact', '', 'wpdm-cats-compact', 0)."</div>";
        $sw = 3;
    }
    $html = '
    <div class=\'w3eden\'>
    <form id="srcp" style="margin-bottom: 10px">
    <div  class="row">
    <input type="hidden" name="category" id="initc" value="'.$category.'" />
    <span class="col-md-'.$sw.'">
    <label for="src">'.__('Search Package','wpdmap').':</label>
    <input type="text" class="form-control" name="src" placeholder="'.__('Search Package','wpdmap').'" id="src">
    </span>
    <a href="#" id="wpdmap-home">Buscar</a>

    '.$comcat.'

    <span class="col-md-3">
    <label for="order_by">'.__('Orden por:','wpdmap').'</label>
    <select name="order_by" id="order_by" class="selectpicker">
    <option value="date">'.__('Publish Date','wpdmap').'</option>
    <option value="modified">'.__('Last Updated','wpdmap').'</option>
    <option value="view_count">'.__('View Count','wpdmap').'</option>
    <option value="download_count">'.__('Download Count','wpdmap').'</option>
    <option value="package_size_b">'.__('Package Size','wpdmap').'</option>
    </select>
    </span>
    <span class="col-md-3">
    <label for="order">'.__('Orden:','wpdmap').'</label>
    <select name="order" id="order" class="selectpicker">
    <option value="DESC">'.__('Descending Order','wpdmap').'</option>
    <option value="ASC">'.__('Ascending Order','wpdmap').'</option>
    </select>
    </span>

    </div><br class="clear"/>
    </form>
    <div class="row">
    <div class="col-md-12">
    <div class="breadcrumb">
    <a href="#" id="wpdmap-home">'.__('Inicio','wpdmap').'</a> <i class="fa fa-angle-right icon icon-angle-right"></i>
    <span id="inp">'.__('All Packages','wpdmap').'</span>
    </div>
    </div>
    </div>';

But when I press the enter button to search nothing happened, I solved this issue with a button with the following code

<a href="#" id="wpdmap-home">Search</a>

And now it works perfectly when I click that button, but now I want it to work when I enter the text and just press enter.

  • The PHP is irrelevant to your question. Post the rendered HTML please. Also, your form appears to be missing the `action` and `method` attributes – j08691 Aug 09 '18 at 17:04
  • Also missing the end of the form/div, which makes me assume there is more code involved. – William_Wilson Aug 09 '18 at 17:06
  • Write down whole code, more than this one, and please check out the `tags` before posting the question – Mr CaT Aug 09 '18 at 17:12
  • Sorry, here is the code about that section –  Aug 09 '18 at 19:57

0 Answers0