You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by "WarnerJan Veldhuis (JIRA)" <ji...@apache.org> on 2010/02/15 14:03:28 UTC

[jira] Commented: (CLK-582) No field validation on FormTable

    [ https://issues.apache.org/jira/browse/CLK-582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12833792#action_12833792 ] 

WarnerJan Veldhuis commented on CLK-582:
----------------------------------------

Have you got any further with this one? I don't seem to get it to work either.



> No field validation on FormTable
> --------------------------------
>
>                 Key: CLK-582
>                 URL: https://issues.apache.org/jira/browse/CLK-582
>             Project: Click
>          Issue Type: Bug
>          Components: extras
>    Affects Versions: 1.5.3
>         Environment: Linux Apache mySQL
>            Reporter: Christophe FOIRET
>            Priority: Critical
>
> 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;
>         }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.