Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8966803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:06:03+00:00 2026-06-15T17:06:03+00:00

I am experiencing a problem with Ajax and PrimeFaces. What the page should do

  • 0

I am experiencing a problem with Ajax and PrimeFaces.

What the page should do :

-User choses between “Cas 1” and “Cas 2” (radiobuttons)

-Once a case is validated, an Ajax query should display one input text area for “cas 1” and several for “cas 2”. The text in input text area should be saved in a database

What really happens :

-User choses between “Cas 1” and “Cas 2”

-The input text area(s) display correctly on the first time and then wont change again if you switch between “Cas 1” and “Cas 2”. Also, the text isnt saved in the database.

Separately (without the radiobuttons), both “Cas 1” and “Cas 2” work correctly

Here is the code I am using :

<html xmlns="http://www.w3.org/1999/xhtml" 
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:p="http://primefaces.org/ui"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:c="http://java.sun.com/jsp/jstl/core">

<h:body>
    <h:form id="form">

        <p:messages id="messages" showDetail="true" autoUpdate="true"/>

        <h:panelGrid columns="1" >
            <h:outputText value="Cas 1 : sélection « travail identique pour l’ensemble des CDC » ou un seul CDC" />
            <h:outputText value=" " />
            <h:outputText value="Cas 2 : sélection « travail différent suivant les CDC »" /> 

            <p:selectOneRadio id="CasTrois" value="#{growlBean.casTrois}" required="true"> 
                <f:selectItem itemLabel="Cas 1" itemValue="1" />                               
                <f:selectItem itemLabel="Cas 2" itemValue="2" />
                <p:ajax  event="change" update="displayTrois" />
            </p:selectOneRadio>                                
        </h:panelGrid>

        <h:panelGrid columns="1" id="displayTrois">
            <c:if test="${growlBean.casTrois == 1}">
                <h:outputText value="Expliquer succinctement en quoi consiste l’affaire." />
                <h:outputText value="Donner notamment les informations liées à l’affaire mais ne figurant pas dans les CDC." />
                <h:outputText value=" " />
                <h:outputText value="Exemple" style="font-weight:bold; color: green"/>
                <h:outputText value="Relance en quantité 1 de tous les sous-ensembles de tous les CDC" style="font-weight:bold; color: green"/>
                <h:panelGrid columns="2">
                    <h:panelGrid columns="1">
                        <p:inputTextarea  rows="8" cols="100" required="false" validatorMessage="Le champ doit être rempli"
                                          value="#{growlBean.natureDesTravaux}" autoResize="true"  >
                            <p:ajax event="keyup" listener="#{growlBean.setNatureDesTravaux(natureDesTravaux)}"/>
                        </p:inputTextarea>  
                    </h:panelGrid>                                       
                </h:panelGrid>
            </c:if>

            <c:if test="${growlBean.casTrois == 2}">
                <h:outputText value="Expliquer succinctement en quoi consiste l’affaire." />
                <h:outputText value="Donner notamment les informations liées à l’affaire mais ne figurant pas dans les CDC." /> 
                <p:dataTable id="TableauNatrureTravaux" value="#{growlBean.listCdcAffaire2}" var="detailCdc" >
                    <f:facet name="header">
                        <h:outputText value="Nature des Travaux"/>
                    </f:facet>
                    <p:column >
                        <h:panelGrid columns="1">
                            <p:outputLabel for="textTravaux" value="#{detailCdc.cdcId.outillageId.numeroOutil} #{detailCdc.cdcId.outillageId.designation}" />
                            <p:inputTextarea id="textTravaux" rows="8" cols="100" value="#{detailCdc.natureTravauxPourFla}"      
                                             autoResize="true" required="false" validatorMessage="test" >
                                <f:validateLength minimum="1" />
                                <p:ajax event="keyup" listener="#{detailCdc.setNatureTravauxPourFla(natureTravauxPourFla)}"/>
                            </p:inputTextarea>
                        </h:panelGrid> 
                    </p:column>  
                </p:dataTable>
            </c:if>
        </h:panelGrid>               

    </h:form>        
</h:body> 

Can someone help me trying to refresh the page and save the text?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:06:05+00:00Added an answer on June 15, 2026 at 5:06 pm

    To have the radio buttons work correctly change your displayTrois element to the following, (If this doesn’t resolve it you will need to post your bean information and include the listener):

    <p:panel id="displayTrois">
    <h:panelGrid columns="1" rendered="${growlBean.casTrois == 1}">
                <h:outputText value="Expliquer succinctement en quoi consiste l’affaire." />
                <h:outputText value="Donner notamment les informations liées à l’affaire mais ne figurant pas dans les CDC." />
                <h:outputText value=" " />
                <h:outputText value="Exemple" style="font-weight:bold; color: green"/>
                <h:outputText value="Relance en quantité 1 de tous les sous-ensembles de tous les CDC" style="font-weight:bold; color: green"/>
                <h:panelGrid columns="2">
                    <h:panelGrid columns="1">
                        <p:inputTextarea  rows="8" cols="100" required="false" validatorMessage="Le champ doit être rempli"
                                          value="#{growlBean.natureDesTravaux}" autoResize="true"  >
                            <p:ajax event="keyup" listener="#{growlBean.setNatureDesTravaux(natureDesTravaux)}"/>
                        </p:inputTextarea>  
                    </h:panelGrid>                                       
                </h:panelGrid>
    
    
        </h:panelGrid>
        <h:panelGrid columns="1" rendered="${growlBean.casTrois == 2}">
                <h:outputText value="Expliquer succinctement en quoi consiste l’affaire." />
                <h:outputText value="Donner notamment les informations liées à l’affaire mais ne figurant pas dans les CDC." /> 
                <p:dataTable id="TableauNatrureTravaux" value="#{growlBean.listCdcAffaire2}" var="detailCdc" >
                    <f:facet name="header">
                        <h:outputText value="Nature des Travaux"/>
                    </f:facet>
                    <p:column >
                        <h:panelGrid columns="1">
                            <p:outputLabel for="textTravaux" value="#{detailCdc.cdcId.outillageId.numeroOutil} #{detailCdc.cdcId.outillageId.designation}" />
                            <p:inputTextarea id="textTravaux" rows="8" cols="100" value="#{detailCdc.natureTravauxPourFla}"      
                                             autoResize="true" required="false" validatorMessage="test" >
                                <f:validateLength minimum="1" />
                                <p:ajax event="keyup" listener="#{detailCdc.setNatureTravauxPourFla(natureTravauxPourFla)}"/>
                            </p:inputTextarea>
                        </h:panelGrid> 
                    </p:column>  
                </p:dataTable>
        </h:panelGrid>   
    </p:panel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am experiencing a problem with an ASPX page not executing a CustomValidator. The
I'm experiencing a strange problem in IE with an ajax request. It works fine
I'm creating a page to help diagnose the problem our users are experiencing with
So, I'm experiencing a very frustrating problem. I am making an AJAX call (via
I'm experiencing a problem with Fancybox on my portfolio. It works on every page
I'm experiencing a strange problem while trying to use the Ajax.BeginForm method of ASP.NET
I'm experiencing a very strange problem with Rails and ajax using jQuery (although I
i am currently experiencing a problem were i get *** glibc detected *** ./efit:
I am experiencing a problem with some Javascript - please see my site and
I'm experiencing a problem inserting values into a SQLite database. The data I download

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.