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

214
Views
Cómo resaltar el campo de texto vacío al enfocarse en JSF con color rojo

Creé una página web JSF en la que quiero validar el enfoque, es decir, el color del borde del campo de texto debe cambiar a rojo si el usuario lo dejó sin completar. Estoy llamando al método de resaltadoBorder () en el evento Cambiar pero no funcionó. Por favor, sugiérame de la manera correcta. Soy nuevo en la parte JSF.

codigo xhtml

 <div class="control-row"> <div class="table"> <div class="cell cell-label1"> <h:outputLabel value="#{pprmsgs.specialist_surname}"> <font style="color: red">*</font> </h:outputLabel> </div> <div class="cell"> <h:inputText styleClass="p-name-demo exempt nameExempt" id="demoSurNameId" tabindex="4" value="#{specialistViewManager.specViewBean.givenName}" onchange="initialCaps(this);setInputDirty();highlightBorder(this);" maxlength="50" autocomplete="off"> <p:ajax event="blur" global="false"></p:ajax> </h:inputText> </div> </div> </div>

Script.js: en este archivo he implementado el método resaltarBorder() para cambiar el color del borde del cuadro de entrada

 function highlightBorder(Stringobj) { if(Stringobj.value == "") { $(this).css({ "border":"2px solid red" }); } else { $(this).css({ "border":"" }); } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Pruebe el evento onkeyup en lugar de onchange.

 <input type="text" onkeyup="myFunction()">
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!