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

381
Views
¿Cómo puedo obtener el valor del botón de radio JSF marcado usando JS?

Tengo una faceta JSF como esta:

 <h:form id="input-f"> <div> <h:outputLabel for="coord-x" value="Choose X:"/> <p:panelGrid columns="2"> <h:selectOneRadio id="coord-x" required="true" value="#{resultBean.newResult.r}"> <f:selectItem class="xGroup" itemValue="-2" itemLabel="-2"/> <f:selectItem class="xGroup" itemValue="-1.5" itemLabel="-1.5"/> <f:selectItem class="xGroup" itemValue="-1" itemLabel="-1"/> <f:selectItem class="xGroup" itemValue="-0.5" itemLabel="-0.5"/> <f:selectItem class="xGroup" itemValue="0" itemLabel="0"/> <f:selectItem class="xGroup" itemValue="0.5" itemLabel="0.5"/> <f:selectItem class="xGroup" itemValue="1" itemLabel="1"/> <f:selectItem class="xGroup" itemValue="1.5" itemLabel="1.5"/> <f:validateRequired/> </h:selectOneRadio > </p:panelGrid> </div> <div> <h:outputLabel>Available Y values: (-5 ... 5)</h:outputLabel> <p:panelGrid columns="2"> <p:inputText maxlength="17" name="y" id="coord-y" placeholder="(-5..5)" value="#{resultBean.newResult.y}"> </p:inputText> </p:panelGrid> </div> </h:form>

Y trato de usar el script JS para obtener valores de este formulario después de enviar el formulario:

 x = $("#input-f\\:coord-x input[type='selectOneRadio']:checked").val(); y = document.getElementById("input-f:coord-y").value;

Puedo obtener correctamente el valor "y", pero no puedo obtener el valor "x". El registro dice que "x" no está definido. Intenté usar el método .getElementById(), pero tampoco tuvo éxito. ¿Cómo puedo usar JS para verificar el valor "x"?

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!