Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
Show preloader gif only when input fields are filled?

I have a site built via flask that takes the information provided by the user and performs some action . I also have a loader that shows up when this action is done in the background, the trouble is , if the user were to click on the button "process" without filling the details , the loader is still shown .

How do i make the loader appear only when all the input fields are entered by the user and then clicks on "process" button

   <form action="/result" method="post">
    <tbody>
 <tr>
        <td><input type='text' name="ip" id='ipadd' required="required" placeholder="8.8.8.8" pattern="((^|\.)((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]?\d))){4}$" value style="margin-bottom: 5px;" autocomplete="off"></td>

       </tr>
    </tbody>

  </table>

  <button  class="btn btn-outline btn-success"  style="padding-right: 15pt;"onclick="loading();">Process</button>
   </form>


  <script type="text/javascript">// <![CDATA[
        function loading(){
            $("#loading").show();
            $("#content").hide();
        }
// ]]></script>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Since your field is required you could hide or disable the button if the form is :invalid via CSS, e.g.

form:invalid button {
   pointer-events: none;
   opacity: .4;
}
<form>
    <input type='text' name="ip" id='ipadd' required="required"
           placeholder="8.8.8.8" 
           pattern="((^|\.)((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]?\d))){4}$" />
            
    <button>Send</button>
</form>

about 4 years ago · Juan Pablo Isaza Report

0

do a check that if input field is empty then return else execute your api call/loader, or disable your process button till value is null

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!