• Resolved JuiceByJ0sh

    (@juicebyj0sh)


    I’m assuming this shouldn’t be too much work, but for the life of me I cannot get it to run properly. I’m trying to have the drop down search field selector on pdb_list have a default value of “Email.” I’ve managed to achieve this visually, but as soon as I edit the sittings in the pdb-list-detailed.php file the search function seems to break. Not as important, but I would also love the ability to add some placeholder text in the search box. Any help is GREATLY appreciated. Thanks.

    https://www.ads-software.com/plugins/participants-database/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter JuiceByJ0sh

    (@juicebyj0sh)

    Checking back in on this. I have coding knowledge so even being pointed in the right direction would help. Have this completely set up except for the ideal search function. Trying to make it so a page just displays the proper list for the logged in user. Thanks again.

    Plugin Author xnau webdesign

    (@xnau)

    OK, well, I don’t know what you’ve done to modify the pdb-list-detailed.php template, so I can’t say what the problem is. That is the place to start, so you were on the right track and I thought you would figure it out.

    Anyway, a good way to get more control over the search UI is to look a the HTML generated by the plugin for a working search control. You can simply copy the HTML contained within the fieldset tags and then use that HTML in the template instead of the functions that generate the search UI, so you end up with this: (this is a fragment of the detailed template in which I have replaced part of the search form with the literal HTML from the web page.)

    <?php $this->search_sort_form_top(); ?>
    
      <?php if ( $filter_mode == 'filter' || $filter_mode == 'both' ) : ?>
    
        <fieldset class="widefat inline-controls">
          <legend>Search:</legend>
          <select id="search_field_select" name="search_field" class="search-item">
            <option value="none">(select)</option>
            <option value="first_name">First Name</option>
            <option value="last_name">Last Name</option>
          </select>
          <input name="operator" type="hidden" class="search-item" value="LIKE">
          <input id="participant_search_term" type="text" name="value" class="search-item" value="">
          <input name="submit_button" type="submit" value="Search">
          <input name="submit_button" type="submit" value="Clear">
        </fieldset>
      <?php endif ?>

    So, that is just an example, but the idea is now you can easily set the default selection for the dropdown and add a placeholder to your text input. It’s not as flexible, you have to manually add all your dropdown values, but it’s easy to see how to modify the form for your purposes.

    Thread Starter JuiceByJ0sh

    (@juicebyj0sh)

    This is exactly what I was looking for. Everything you said here worked great. My other attempts were making this harder than it should have been. Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Search Form Fields’ is closed to new replies.