2 Replies Latest reply on Nov 21, 2007 5:34 AM by Ilya Shaikovsky

    Server side validation in a modalpanel

    gilles bruno Newbie

      Hello,
      I'm using a modalpanel in which i have a tabpanel.
      One for creation of a record in a DB, another for
      deleting records of the same table in the DB.
      I must do some server side validation for creating
      a record in the DB. For instance, if the record
      already exists (integrity constraint),
      i must show a error message. I was thinking
      of a with a rendered attribute
      and a <h:outputText> if the verification fails.
      Here is my code


      <rich:tab label="Create">
       <div id="divContainerTabCreateCompagnie" style="background-color: #AC996F;border: thick;width: 100%; height: 100%">
       <div id="sepCreationCompagnie"
       style="display:block;height:20px">
       </div>
       <div id="fieldCompagnie" style="display:block;height:100px;position:relative;left:70px;">
       <h:outputText id="codeCompagnieCreate" value="Code Compagnie : " style="font-weight:bold;"/>
       <h:inputText maxlength="2" label="codeCompagnie" id="codeCompagnieCreate2" binding="#{DetailHabilitation.codeCompagnieACreer}"
       value="#{DetailHabilitation.stringCodeCieACreer}" size="20"/>
       </div>
       <div id="fieldCompagnie2" style="display:block;height:100px;position:relative;left:70px;">
       <h:outputText id="nomCompagnieCreate"
       value="Nom Compagnie : " style="font-weight:bold;"/>
       <h:inputText label="nomCompagnie" id="nomCompagnieCreate2" binding="#{DetailHabilitation.nomCompagnieACreer}"
       value="#{DetailHabilitation.stringNomCieACreer}" size="20" maxlength="50"/>
       </div>
       <div id="buttonCreationCompagnie" style="display:block;height:30px;position:relative;left:150px;">
       <a4j:commandButton id="buttonCreateAffectation" actionListener="#{habilitationManagedBean.creerAffectation}"
       value="Create" reRender="messageCreationAffectation"/>
       </div>
       <webuijsf:panelLayout binding="#{DetailHabilitation.divMessageCreation}" rendered="#{DetailHabilitation.messageCreationCompagnie}" id="messageCreationCompagnie"
       style="display:block;height:30px;">
       <h:outputText id="labelCreationCompagnie" rendered="#{DetailHabilitation.messageCreationCompagnie}" binding="#{DetailHabilitation.outputTextMessageCreationAffectation}" value="TOTO"></h:outputText>
       </webuijsf:panelLayout>
      </div>
      </rich:tab>
      



      The creation of records in the DB works. The deleting too.
      But i don't succeed in makink work the server side validation. My message doesn't appear. Any help. How do you do server side validation with modalpanel
      Thanks a lot.

      Gilles