Support » Theme: Donovan » Search field does not show alert if empty

  • Resolved steve92

    (@steve92)


    I noticed that if the search field and the submit button are clicked, the code continues the instruction.
    Instead, it should block the sending and show the alert, see attachment.

    Schermata-2021-05-28-alle-05-49-44

Viewing 1 replies (of 1 total)
  • Thread Starter steve92

    (@steve92)

    SOLVED!
    It was enough to add “required”

    searchform.php

    <form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
      <label>
        <span class="screen-reader-text"><?php echo esc_html_x( 'Search for:', 'label', 'donovan' ); ?></span>
        <input type="search" class="search-field"
        placeholder="<?php echo esc_attr_x( 'Search &hellip;', 'placeholder', 'donovan' ); ?>"
        value="<?php echo get_search_query(); ?>" name="s" required
        title="<?php echo esc_attr_x( 'Search for:', 'label', 'donovan' ); ?>" />
    </label>
       <button type="submit" class="search-submit">
       <?php echo donovan_get_svg( 'search' ); ?>
       <span class="screen-reader-text"><?php echo esc_html_x( 'Search', 'submit button', 'donovan' ); ?></span>
       </button>
    </form>
    • This reply was modified 4 months ago by steve92.
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.