How to place two divergent standard notices concerning mandatory completion in the Popover of a bootstrap search field that has two Buttons?

Asked

Viewed 50 times

-1

In other words, each button should trigger a different message. I have this field that has two buttons and I need each of them to present a different warning message in case of not filling. But the idea is not to fill out the form and use the button #1.

The idea is as follows: The first button does not act through the form field, it serves to open a modal that is part of the researcher’s assistance. And the second button is that acts with the code that is inserted in the form field, will open a page to play the campaign whose code is indicated in the field.

If anyone can help I really appreciate!

 <input color="red" class="tftextinput3" type="text" id="searchresultsquery" class="searchTerm" placeholder="Pesquise promoções ou indique um betcode e clique play. Boa-sorte?"  autofocus name="q" title="" required="required"/>

  <button type="submit" src="https://www.clubesorte.org/c_elements/img/logos/logo_pesquisar02.png" class="searchButton2" >
    <i id="fa-search" class="fa fa-search"></i>

          <button type="submit" src="https://www.clubesorte.org/c_elements/img/logos/logo_pesquisar02.png" class="searchButton" >
    <i id="fa-search" class="fa fa-play"></i>
  • I can put or change the warning message with this code: oninvalid="this.setCustomValidity('Search active campaigns')"... inserted in the imput of the form/search field, but I wanted to insert a message like this when you click on the two buttons and each one with a different message.

  • 1

    If the first btn is not to send it should be a button type button, and not type Submit

  • 1

    Hi! Thanks for the suggestion, I hadn’t thought about it. I already changed, and as this button will open a modal related to the search do not need to put warning.

1 answer

0

Solved! After all we can choose to put two divergent warnings on two buttons within a search field, or simply undo the "required" message from one of the buttons. Through the suggestion made by hugocsl this situation has been resolved and can be very useful when we need to place two buttons within a search field or a search engine. It serves to create two related actions and when we do not want to put buttons below the researcher’s field.

The suggestion of hugocsl was to change the first type Submit button to type button.

Look at the drawing below, it is a researcher by Juvecriativa Portugal. The first button opens a search modal in a table and the second button will open a page or can be used for something else, for example to open a real search from a search engine.

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.