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

260
Views
How to clear all input fields after getting form validation in jsf

Here i have jsf code for input fileds that have an form validator.

<h:form id="myForm">
     <script>
      function resetform() {
            document.getElementById("anomalies-list-form").reset();
      }
    
     </script>
      <h:panelGrid>
            <h:outputText value="Source IP"/>
             <h:panelGroup>
                    <h:inputText id="SourceIP" size="13" value="#{dataListBean.sourceIp}" title="Enter first few letters for searching similar records"  >
                            <f:validator validatorId="SQLInjectionValidator"/>
                    </h:inputText>
                            <h:message style="color:red" for="SourceIP"/>
            </h:panelGroup>
    
             <h:outputText value="IP"/>
             <h:panelGroup>
                    <h:inputText id="IP" size="13" value="#{dataListBean.destIp}">
                            <f:validator validatorId="SQLInjectionValidator"/>
                    </h:inputText>
                            <h:message style="color:red" for="IP"/>
            </h:panelGroup>
             <h:outputText value=""/>
             <h:panelGroup>
                  <h:commandButton id="show" value="Show" action="#{dataListBean.showSelectedType}"/>
                  <h:commandButton id="clear" value="Clear" onclick="resetform()">
                  </h:commandButton>
             </h:panelGroup>
       </h:panelGrid>
    </h:form>

if i get a validation on any filed i want clear all filed with clear button but it is not working.

about 4 years ago · Juan Pablo Isaza
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!