No control on required fields on TableForm

11 messages Options
Embed this post
Permalink
easydoor-4

No control on required fields on TableForm

Reply Threaded More More options
Print post
Permalink
I built a page with a search Form and two FormTable

When i select a value in the SelectList of the search Form, i fill the two
FormTable
Each FormTable contains a required Field
When i click on the Valid Button, there is no control and the required fields
which are not filled are not yellow (like in your example), the page is
refreshed and the two FormTable are empty ...

I tried this case without search Form and the control is well done ...

Could you give me quickly an answer to this issue, i think that the search
Form disturbs the Form Table behavior

See the code below :

.htm code file

<br>
<h2>$title</h2>
<br>
$formSearch
$tableInterv
$tableTps

.java code file

package vdo.actedu.page;

import java.util.List;

import net.sf.click.control.Form;
import net.sf.click.control.Option;
import net.sf.click.control.Select;
import net.sf.click.control.Submit;
import net.sf.click.control.TextField;
import net.sf.click.extras.control.FieldColumn;
import net.sf.click.extras.control.FormTable;
import vdo.actedu.hibernate.Atelier;
import vdo.actedu.hibernate.AtelierDAO;
import vdo.actedu.hibernate.AtelierIntervenant;
import vdo.actedu.hibernate.AtelierIntervenantDAO;
import vdo.actedu.hibernate.AtelierTemps;
import vdo.actedu.hibernate.AtelierTempsDAO;

public class MoveInscriptionPage extends BorderPage {

public String title = "Transfert d'inscriptions";
public String atelierId = "";

    public Form formSearch = new Form();

    public FormTable tableInterv = new FormTable();
    public FormTable tableTps = new FormTable();

    Atelier atelier = new Atelier();

    //Déclaration listes de sélection
    private Select atelierSceSelect = new Select("atelier.libelle","Atelier
Source");
    private Select atelierSelect = new Select("atelier.id","Atelier Cible");
    private Select intervSceSelect = new Select("intervenant.nom");
    private Select intervSelect = new Select("intervenant.id");
    private Select tempsSceSelect = new Select("temps.libelle");
    private Select tempsSelect = new Select("temps.id");

    List<Atelier> ateliers = new AtelierDAO().findAll();
    List<AtelierIntervenant> intervenantsSce = null;
    List<AtelierIntervenant> intervenantsCible = null;
    List<AtelierTemps> tempsSce = null;
    List<AtelierTemps> tempsCible = null;

    public MoveInscriptionPage() {

     //Formulaire intégrant la liste de sélection Atelier Cible
     formSearch.setErrorsPosition("middle");
     formSearch.setLabelAlign("right");

     atelierSceSelect.setReadonly(true);
     formSearch.add(atelierSceSelect);

     atelierSelect.add(new Option(0,""));
atelierSelect.addAll(ateliers,"id","libelle");
atelierSelect.setListener(this,"onChangeAtelier");
     atelierSelect.setAttribute("onChange","form.submit()");
     formSearch.add(atelierSelect);

     //Tableau listant les Intervenants de l'atelier Cible
        tableInterv.setClass("cgvo");
        tableInterv.setHoverRows(true);
     tableInterv.getForm().setErrorsPosition("middle");
     tableInterv.getForm().setButtonAlign("center");
     tableInterv.getForm().setLabelAlign("right");

        FieldColumn column = new FieldColumn("intervenant.id", "Intervenant
Source", intervSceSelect);
        column.getField().setReadonly(true);
        tableInterv.addColumn(column);

        column = new FieldColumn("intervenant.nom", "Intervenant Cible",
intervSelect);
        column.getField().setRequired(true);
        tableInterv.addColumn(column);

     //Tableau listant les Temps de l'atelier Cible
        tableTps.setClass("cgvo");
        tableTps.setHoverRows(true);
     tableTps.getForm().setErrorsPosition("middle");
     tableTps.getForm().setButtonAlign("center");
     tableTps.getForm().setLabelAlign("right");

     column = new FieldColumn("temps.id", "Temps Source", tempsSceSelect);
     column.getField().setReadonly(true);
        tableTps.addColumn(column);

        column = new FieldColumn("temps.libelle", "Temps Cible", tempsSelect);
        column.getField().setRequired(true);
        tableTps.addColumn(column);

     //Boutons Valider et Retour liés aux TableForm
     Submit validButton = new Submit(" Valider ", this, "onValid");
     validButton.setAttribute("class","button1");
     Submit cancelButton = new Submit(" Retour ", this, "onCancel");
     cancelButton.setAttribute("class","button1");

     tableTps.getForm().add(validButton);
     tableTps.getForm().add(cancelButton);
    }

    public boolean onChangeAtelier() {

     //Peuplement de la table des Intervenants de l'Atelier Source
        intervenantsSce = new AtelierIntervenantDAO().findByAtelierString
(atelierSceSelect.getValue());
     intervSceSelect.addAll
(intervenantsSce,"intervenant.id","intervenant.nom");
        tableInterv.setRowList(intervenantsSce);

     //Peuplement de la liste de sélection des Intervenants Cible
     intervenantsCible = new AtelierIntervenantDAO().findByAtelier(new Integer
(atelierSelect.getValue()));
     intervSelect.add(new Option(0,""));
     intervSelect.addAll
(intervenantsCible,"intervenant.id","intervenant.nom");

     //Peuplement de la table des Temps de l'Atelier Source
        tempsSce = new AtelierTempsDAO().findByAtelierString
(atelierSceSelect.getValue());
        tempsSceSelect.addAll(tempsSce,"temps.id","temps.libelle");
        tableTps.setRowList(tempsSce);

     //Peuplement de la liste de sélection des Temps Cible
     tempsCible = new AtelierTempsDAO().findByAtelier(new Integer
(atelierSelect.getValue()));
     tempsSelect.add(new Option(0,""));
     tempsSelect.addAll(tempsCible,"temps.id","temps.libelle");

     return true;
    }

    public void onInit() {

     atelierId = getContext().getRequestParameter("id");

        //Si l'id de l'atelier est renseigné et que l'on n'est pas en Post
(Bouton Enregistrer)
        if (atelierId != null && !getContext().isPost()) {

         //On récupère l'atelier passé en paramètre
         atelier = new AtelierDAO().findById(new Integer(atelierId));

         //Mise en session de l'Atelier
         getContext().setSessionAttribute("atelier",atelier);
        } else
         //On récupère l'atelier de la session
         atelier = (Atelier)getContext().getSessionAttribute("atelier");

        //Mise à jour du libellé de l'Atelier Source
atelierSceSelect.add(atelier.getLibelle());
    }

    public boolean onValid() {

     if (tableInterv.getForm().isValid() && tableTps.getForm().isValid()) {

            //Transfert des Inscriptions

     }
        return true;
    }

    public boolean onCancel() {
            setRedirect(AdmAtelierPage.class);
        return true;
    }

    public boolean onSecurityCheck() {

        if (getContext().hasSession()) {
            return true;
        } else {
            setRedirect(LoginPage.class);
            return false;
        }
    }
}


Bob Schellink-2

Re: No control on required fields on TableForm

Reply Threaded More More options
Print post
Permalink
Hi,

The attached Page contains references to Hibernate classes which we
don't have access to. I suggest you create a new Page without those
references so we can easily test it.

kind regards

bob

easydoor wrote:

> I built a page with a search Form and two FormTable
>
> When i select a value in the SelectList of the search Form, i fill the two
> FormTable
> Each FormTable contains a required Field
> When i click on the Valid Button, there is no control and the required fields
> which are not filled are not yellow (like in your example), the page is
> refreshed and the two FormTable are empty ...
>
> I tried this case without search Form and the control is well done ...
>
> Could you give me quickly an answer to this issue, i think that the search
> Form disturbs the Form Table behavior
>
> See the code below :
>
> .htm code file
>
> <br>
> <h2>$title</h2>
> <br>
> $formSearch
> $tableInterv
> $tableTps
>
> .java code file
>
> package vdo.actedu.page;
>
> import java.util.List;
>
> import net.sf.click.control.Form;
> import net.sf.click.control.Option;
> import net.sf.click.control.Select;
> import net.sf.click.control.Submit;
> import net.sf.click.control.TextField;
> import net.sf.click.extras.control.FieldColumn;
> import net.sf.click.extras.control.FormTable;
> import vdo.actedu.hibernate.Atelier;
> import vdo.actedu.hibernate.AtelierDAO;
> import vdo.actedu.hibernate.AtelierIntervenant;
> import vdo.actedu.hibernate.AtelierIntervenantDAO;
> import vdo.actedu.hibernate.AtelierTemps;
> import vdo.actedu.hibernate.AtelierTempsDAO;
>
> public class MoveInscriptionPage extends BorderPage {
>
> public String title = "Transfert d'inscriptions";
> public String atelierId = "";
>
>     public Form formSearch = new Form();
>
>     public FormTable tableInterv = new FormTable();
>     public FormTable tableTps = new FormTable();
>
>     Atelier atelier = new Atelier();
>
>     //Déclaration listes de sélection
>     private Select atelierSceSelect = new Select("atelier.libelle","Atelier
> Source");
>     private Select atelierSelect = new Select("atelier.id","Atelier Cible");
>     private Select intervSceSelect = new Select("intervenant.nom");
>     private Select intervSelect = new Select("intervenant.id");
>     private Select tempsSceSelect = new Select("temps.libelle");
>     private Select tempsSelect = new Select("temps.id");
>
>     List<Atelier> ateliers = new AtelierDAO().findAll();
>     List<AtelierIntervenant> intervenantsSce = null;
>     List<AtelierIntervenant> intervenantsCible = null;
>     List<AtelierTemps> tempsSce = null;
>     List<AtelierTemps> tempsCible = null;
>
>     public MoveInscriptionPage() {
>
>      //Formulaire intégrant la liste de sélection Atelier Cible
>      formSearch.setErrorsPosition("middle");
>      formSearch.setLabelAlign("right");
>
>      atelierSceSelect.setReadonly(true);
>      formSearch.add(atelierSceSelect);
>
>      atelierSelect.add(new Option(0,""));
> atelierSelect.addAll(ateliers,"id","libelle");
> atelierSelect.setListener(this,"onChangeAtelier");
>      atelierSelect.setAttribute("onChange","form.submit()");
>      formSearch.add(atelierSelect);
>
>      //Tableau listant les Intervenants de l'atelier Cible
>         tableInterv.setClass("cgvo");
>         tableInterv.setHoverRows(true);
>      tableInterv.getForm().setErrorsPosition("middle");
>      tableInterv.getForm().setButtonAlign("center");
>      tableInterv.getForm().setLabelAlign("right");
>
>         FieldColumn column = new FieldColumn("intervenant.id", "Intervenant
> Source", intervSceSelect);
>         column.getField().setReadonly(true);
>         tableInterv.addColumn(column);
>
>         column = new FieldColumn("intervenant.nom", "Intervenant Cible",
> intervSelect);
>         column.getField().setRequired(true);
>         tableInterv.addColumn(column);
>
>      //Tableau listant les Temps de l'atelier Cible
>         tableTps.setClass("cgvo");
>         tableTps.setHoverRows(true);
>      tableTps.getForm().setErrorsPosition("middle");
>      tableTps.getForm().setButtonAlign("center");
>      tableTps.getForm().setLabelAlign("right");
>
>      column = new FieldColumn("temps.id", "Temps Source", tempsSceSelect);
>      column.getField().setReadonly(true);
>         tableTps.addColumn(column);
>
>         column = new FieldColumn("temps.libelle", "Temps Cible", tempsSelect);
>         column.getField().setRequired(true);
>         tableTps.addColumn(column);
>
>      //Boutons Valider et Retour liés aux TableForm
>      Submit validButton = new Submit(" Valider ", this, "onValid");
>      validButton.setAttribute("class","button1");
>      Submit cancelButton = new Submit(" Retour ", this, "onCancel");
>      cancelButton.setAttribute("class","button1");
>
>      tableTps.getForm().add(validButton);
>      tableTps.getForm().add(cancelButton);
>     }
>
>     public boolean onChangeAtelier() {
>
>      //Peuplement de la table des Intervenants de l'Atelier Source
>         intervenantsSce = new AtelierIntervenantDAO().findByAtelierString
> (atelierSceSelect.getValue());
>      intervSceSelect.addAll
> (intervenantsSce,"intervenant.id","intervenant.nom");
>         tableInterv.setRowList(intervenantsSce);
>
>      //Peuplement de la liste de sélection des Intervenants Cible
>      intervenantsCible = new AtelierIntervenantDAO().findByAtelier(new Integer
> (atelierSelect.getValue()));
>      intervSelect.add(new Option(0,""));
>      intervSelect.addAll
> (intervenantsCible,"intervenant.id","intervenant.nom");
>
>      //Peuplement de la table des Temps de l'Atelier Source
>         tempsSce = new AtelierTempsDAO().findByAtelierString
> (atelierSceSelect.getValue());
>         tempsSceSelect.addAll(tempsSce,"temps.id","temps.libelle");
>         tableTps.setRowList(tempsSce);
>
>      //Peuplement de la liste de sélection des Temps Cible
>      tempsCible = new AtelierTempsDAO().findByAtelier(new Integer
> (atelierSelect.getValue()));
>      tempsSelect.add(new Option(0,""));
>      tempsSelect.addAll(tempsCible,"temps.id","temps.libelle");
>
>      return true;
>     }
>
>     public void onInit() {
>
>      atelierId = getContext().getRequestParameter("id");
>
>         //Si l'id de l'atelier est renseigné et que l'on n'est pas en Post
> (Bouton Enregistrer)
>         if (atelierId != null && !getContext().isPost()) {
>
>          //On récupère l'atelier passé en paramètre
>          atelier = new AtelierDAO().findById(new Integer(atelierId));
>
>          //Mise en session de l'Atelier
>          getContext().setSessionAttribute("atelier",atelier);
>         } else
>          //On récupère l'atelier de la session
>          atelier = (Atelier)getContext().getSessionAttribute("atelier");
>
>         //Mise à jour du libellé de l'Atelier Source
> atelierSceSelect.add(atelier.getLibelle());
>     }
>
>     public boolean onValid() {
>
>      if (tableInterv.getForm().isValid() && tableTps.getForm().isValid()) {
>
>             //Transfert des Inscriptions
>
>      }
>         return true;
>     }
>
>     public boolean onCancel() {
>             setRedirect(AdmAtelierPage.class);
>         return true;
>     }
>
>     public boolean onSecurityCheck() {
>
>         if (getContext().hasSession()) {
>             return true;
>         } else {
>             setRedirect(LoginPage.class);
>             return false;
>         }
>     }
> }
>
>
>
               
easydoor-4

Re: No control on required fields on TableForm

Reply Threaded More More options
Print post
Permalink
Find below the page test code without references to Hibernate
and the two java beans Intervenant.java et Temps.java

Html code page

<br>
<h2>$title</h2>
<br>
$formSearch
$tableInterv
$tableTps
------------------------------------------------------
Java code test page

package vdo.actedu.page;

import java.util.ArrayList;
import java.util.List;

import net.sf.click.Page;
import net.sf.click.control.Form;
import net.sf.click.control.Option;
import net.sf.click.control.Select;
import net.sf.click.control.Submit;
import net.sf.click.extras.control.FieldColumn;
import net.sf.click.extras.control.FormTable;
import vdo.actedu.hibernate.Atelier;
import vdo.actedu.hibernate.AtelierIntervenant;
import vdo.actedu.hibernate.AtelierTemps;
import vdo.actedu.hibernate.Intervenant;
import vdo.actedu.hibernate.Temps;

public class ZformTablePage extends Page {

        public String title = "Anomalie Form Table";
        //public String atelierId = "";

    public Form formSearch = new Form();

    public FormTable tableInterv = new FormTable();
    public FormTable tableTps = new FormTable();

    Atelier atelier = new Atelier();

    //Déclaration listes de sélection
    private Select atelierSceSelect = new Select("Atelier Source");
    private Select atelierSelect    = new Select("Atelier Cible");
    private Select intervSceSelect  = new Select("nom");
    private Select intervSelect     = new Select("id");
    private Select tempsSceSelect   = new Select();
    private Select tempsSelect      = new Select();

    //List<Atelier> ateliers = new AtelierDAO().findAll();
    List<AtelierIntervenant> intervenantsSce = null;
    List<AtelierIntervenant> intervenantsCible = null;
    List<AtelierTemps> tempsSce = null;
    List<AtelierTemps> tempsCible = null;

    public ZformTablePage() {

    //Formulaire intégrant la liste de sélection Atelier Cible
    formSearch.setErrorsPosition("middle");
    formSearch.setLabelAlign("right");

    atelierSceSelect.setReadonly(true);
    formSearch.add(atelierSceSelect);

                atelierSelect.addAll(new String[] {"","Atelier Cible
1","Atelier Cible 2","Atelier Cible 3"});
                atelierSelect.setListener(this,"onChangeAtelier");
    atelierSelect.setAttribute("onChange","form.submit()");
    formSearch.add(atelierSelect);

    //Tableau listant les Intervenants de l'atelier Cible
        tableInterv.setClass("cgvo");
        tableInterv.setHoverRows(true);
    tableInterv.getForm().setErrorsPosition("middle");
    tableInterv.getForm().setButtonAlign("center");
    tableInterv.getForm().setLabelAlign("right");

    FieldColumn column = new FieldColumn("id","Intervenant Source",
intervSceSelect);
        column.getField().setReadonly(true);
        tableInterv.addColumn(column);

        column = new FieldColumn("nom","Intervenant Cible", intervSelect);
        column.getField().setRequired(true);
        tableInterv.addColumn(column);

    //Tableau listant les Temps de l'atelier Cible
        tableTps.setClass("cgvo");
        tableTps.setHoverRows(true);
    tableTps.getForm().setErrorsPosition("middle");
    tableTps.getForm().setButtonAlign("center");
    tableTps.getForm().setLabelAlign("right");

    column = new FieldColumn("id","Temps Source", tempsSceSelect);
    column.getField().setReadonly(true);
        tableTps.addColumn(column);

        column = new FieldColumn("libelle","Temps Cible", tempsSelect);
        column.getField().setRequired(true);
        tableTps.addColumn(column);

    //Boutons Valider et Retour liés aux TableForm
    Submit validButton = new Submit("    Valider    ", this, "onValid");
    validButton.setAttribute("class","button1");

    tableTps.getForm().add(validButton);
    }

    public boolean onChangeAtelier() {

    //Peuplement de la table des Intervenants de l'Atelier Source
    List<Intervenant> list = new ArrayList<Intervenant>();
    list.add(new Intervenant(1,"Interv Sce 1"));
    list.add(new Intervenant(2,"Interv Sce 2"));
    list.add(new Intervenant(3,"Interv Sce 3"));

    intervSceSelect.addAll(list,"id","nom");
    tableInterv.setRowList(list);

    //Peuplement de la liste de sélection des Intervenants Cible
    List<Intervenant> list2 = new ArrayList<Intervenant>();
    list2.add(new Intervenant(1,"Interv Cible 1"));
    list2.add(new Intervenant(2,"Interv Cible 2"));
    list2.add(new Intervenant(3,"Interv Cible 3"));
    intervSelect.add(new Option(0,""));
    intervSelect.addAll(list2,"id","nom");

    //Peuplement de la table des Temps de l'Atelier Source
    List<Temps> list3 = new ArrayList<Temps>();
    list3.add(new Temps(1,"Temps Sce 1"));
    list3.add(new Temps(2,"Temps Sce 2"));

    tempsSceSelect.addAll(list3,"id","libelle");
        tableTps.setRowList(list3);

    //Peuplement de la liste de sélection des Temps Cible
    List<Temps> list4 = new ArrayList<Temps>();
    list4.add(new Temps(1,"Temps Cible 1"));
    list4.add(new Temps(2,"Temps Cible 2"));
    list4.add(new Temps(3,"Temps Cible 3"));
    tempsSelect.add(new Option(0,""));
    tempsSelect.addAll(list4,"id","libelle");

    return true;
    }

    public void onInit() {
    atelierSceSelect.add("Atelier Source");
    }

    public boolean onValid() {

    if (tableInterv.getForm().isValid() && tableTps.getForm().isValid()) {

    }
        return true;
    }
}
-------------------------------------------------------------
Intervenant Java Bean

package vdo.actedu.hibernate;

public class Intervenant  {

    private int id;
    private String nom;

    public  Intervenant() {
    }

    public  Intervenant(int id, String nom) {
    this.id = id;
        this.nom = nom;
    }

        public int getId() {
                return id;
        }

        public void setId(int id) {
                this.id = id;
        }

        public String getNom() {
                return nom;
        }

        public void setNom(String nom) {
                this.nom = nom;
        }
}
---------------------------------------------------
Temps java Bean

package vdo.actedu.hibernate;

public class Temps {

    private int id ;
    private String libelle;

    public  Temps() {
    }

    public  Temps(int id, String libelle) {
        this.id = id;
        this.libelle = libelle;
    }

        public int getId() {
                return id;
        }

        public void setId(int id) {
                this.id = id;
        }

        public String getLibelle() {
                return libelle;
        }

        public void setLibelle(String libelle) {
                this.libelle = libelle;
        }
}







easydoor-4

Re: No control on required fields on TableForm

Reply Threaded More More options
Print post
Permalink
Hi Bob,

Tell me if the code is good for you to reproduce the issue

Thanks

easydoor-4

Re: No control on required fields on TableForm

Reply Threaded More More options
Print post
Permalink
Hi Bob,
Could you answer to my issue, i need a solution

Thanks




Bob Schellink-2

Re: No control on required fields on TableForm

Reply Threaded More More options
Print post
Permalink
Hi,

The FormTables are only created when the select is submitted. When you
submit the FormTable it doesn't exist in the Page and you need to
recreate them.

I can see two ways to solve this.

  - store the value of the select in the session and each time the page
is invoked, create the FormTables based on the select value.

  - make you page stateful (Page.setStateful) which ensures that the
created FormTables are still available on subsequent requests. When
going down the stateful Page route, you won't want Click to nullify the
Table rows, so set Table.setNullifyRowListOnDestroy(false).

Personally I think it would be easier to break the functionality across
multiple pages where the first page passes the selection to the second
page, similar to a wizard based approach.

Hope this helps.

bob

easydoor wrote:
> Hi Bob,
> Could you answer to my issue, i need a solution
>
> Thanks
>
>
>
>
>

easydoor-4

Re: No control on required fields on TableForm

Reply Threaded More More options
Print post
Permalink
Is it possible to have a direct support on Skype for example about FormTable ?
Because i meet some difficulties ...
Thanks

easydoor-4

Re: No control on required fields on TableForm

Reply Threaded More More options
Print post
Permalink
I meet this error when i try to fill up the rowList of the FormTable

[Click] [error] handleException: java.lang.NullPointerException
        at vdo.actedu.page.MoveInscrip23Page.initTabForm
(MoveInscrip23Page.java:138)
        at vdo.actedu.page.MoveInscrip23Page.onInit(MoveInscrip23Page.java:103)
        at net.sf.click.ClickServlet.processPage(ClickServlet.java:509)
        at net.sf.click.ClickServlet.handleRequest(ClickServlet.java:331)
        at net.sf.click.ClickServlet.doPost(ClickServlet.java:267)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:188)
        at org.apache.catalina.core.ApplicationDispatcher.invoke
(ApplicationDispatcher.java:679)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest
(ApplicationDispatcher.java:461)
        at org.apache.catalina.core.ApplicationDispatcher.doForward
(ApplicationDispatcher.java:399)
        at org.apache.catalina.core.ApplicationDispatcher.forward
(ApplicationDispatcher.java:301)
        at net.sf.click.ClickServlet.processPage(ClickServlet.java:645)
        at net.sf.click.ClickServlet.handleRequest(ClickServlet.java:331)
        at net.sf.click.ClickServlet.doPost(ClickServlet.java:267)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)




Bob Schellink-2

Re: No control on required fields on TableForm

Reply Threaded More More options
Print post
Permalink
You receive the NPE on line 138 of your MoveInscrip23Page. Use your
debugger and put a breakpoint above line 138 and inspect which variable
is null and why.

easydoor wrote:

> I meet this error when i try to fill up the rowList of the FormTable
>
> [Click] [error] handleException: java.lang.NullPointerException
> at vdo.actedu.page.MoveInscrip23Page.initTabForm
> (MoveInscrip23Page.java:138)
> at vdo.actedu.page.MoveInscrip23Page.onInit(MoveInscrip23Page.java:103)
> at net.sf.click.ClickServlet.processPage(ClickServlet.java:509)
> at net.sf.click.ClickServlet.handleRequest(ClickServlet.java:331)
> at net.sf.click.ClickServlet.doPost(ClickServlet.java:267)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:269)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:188)
> at org.apache.catalina.core.ApplicationDispatcher.invoke
> (ApplicationDispatcher.java:679)
> at org.apache.catalina.core.ApplicationDispatcher.processRequest
> (ApplicationDispatcher.java:461)
> at org.apache.catalina.core.ApplicationDispatcher.doForward
> (ApplicationDispatcher.java:399)
> at org.apache.catalina.core.ApplicationDispatcher.forward
> (ApplicationDispatcher.java:301)
> at net.sf.click.ClickServlet.processPage(ClickServlet.java:645)
> at net.sf.click.ClickServlet.handleRequest(ClickServlet.java:331)
> at net.sf.click.ClickServlet.doPost(ClickServlet.java:267)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>
>
>
>
>

easydoor-4

Re: No control on required fields on TableForm

Reply Threaded More More options
Print post
Permalink
Ok Bob, I found the error, but I stumbled on another problem.

My FormTable contains 2 columns, 1 column with a TextField
and 1 column with a Select List

FieldColumn column = new FieldColumn
("nomIntervSce", "Intervenant Source", new TextField("","",30));
column.getField().setReadonly(true);
tableInterv.addColumn(column);

column = new FieldColumn("idIntervCible", "Intervenant Cible",
 intervSelect);
 
column.getField().setAttribute("onChange",
"handleChange('form_intervCible',form);");
column.getField().setRequired(true);
tableInterv.addColumn(column);

I initialize the first column in the onInit Method

intervsSce = new AtelierIntervenantDAO().findByAtelier(atelierSce.getId());

for (Iterator iter = intervsSce.iterator(); iter.hasNext();) {

AtelierIntervenant ai = (AtelierIntervenant) iter.next();

transInterv=new TransInterv(ai.getIntervenant().getId(),
ai.getIntervenant().getNom(),0);
transIntervs.add(transInterv);
}
//La rowList contient le Bean de mappage TransfertInterv
tableInterv.setRowList(transIntervs);

I want to capture the value of the Select List intervSelect to update
the second column of the FormTable
but i don't find this value even in the debug mode !

I added an onchange attribute on the intervSelect to update the rowList

    public void buildSelects() {

    intervSelect.bindRequestValue();

        if (StringUtils.isEmpty(intervSelect.getValue())) {
            // No Intervenant Cible selected, exit early
            return;
        }
        updateRowList();
    }
But the intervSelect contains always no value !

That's my first question and the second one is :

If I've several lines, what is the meaning to access of the value of the
intervSelect on the line 1 and 2, and 3 ...

Could you give me an help with example code, it's urgent
because my customer needs this function.

The FormTable seems not to be very clear for me on these points :

1/Do not populate the FormTable rowList in the Page's onRender() method.

2/ table.setRenderSubmittedValues(false), what does it means ?

I hope that's enough clear for you !


Bob Schellink-2

Re: No control on required fields on TableForm

Reply Threaded More More options
Print post
Permalink
easydoor wrote:

>
> I added an onchange attribute on the intervSelect to update the rowList
>
>     public void buildSelects() {
>
>     intervSelect.bindRequestValue();
>
>         if (StringUtils.isEmpty(intervSelect.getValue())) {
>             // No Intervenant Cible selected, exit early
>             return;
>         }
>         updateRowList();
>     }
> But the intervSelect contains always no value !


 From what you describe above, this should work.

If you use FireBug, check under the "Net" panel that the Select onchange
submit does in fact post the Select value and other Form fields to the
server.


>
> That's my first question and the second one is :
>
> If I've several lines, what is the meaning to access of the value of the
> intervSelect on the line 1 and 2, and 3 ...


Not sure I understand the question above.


>
> Could you give me an help with example code, it's urgent
> because my customer needs this function.
>
> The FormTable seems not to be very clear for me on these points :
>
> 1/Do not populate the FormTable rowList in the Page's onRender() method.


FormTable rowList must be populated during the Page onInit event (which
occurs *before* onProcess) because those values are needed in the
onProcess event, in order to set the Field values.

If you only set the FormTable rowList in the onRender event (which
occurs *after* onProcess) then the Field values won't be known.

>
> 2/ table.setRenderSubmittedValues(false), what does it means ?


This specifies whether the values submitted in the browser should be
displayed or not. Usually you want to display them. Sometimes however,
you want to have a "Cancel" button which does not apply the submitted
values. For this case you do not want to display the submitted values,
but rather the values as they are in the database.

kind regards

bob