You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Sid Ferreira <si...@gmail.com> on 2009/01/15 20:58:10 UTC

Forms

Guys, Im trying to make a small search engine, but It isn't working.follows
the code:

TML:
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
  <head>
    <title>Tibox Test App</title>
  </head>
  <body>
    <div id="wrap">
      <div id="top"></div>
      <div id="content">
        <div class="header">
          <h1>Allert</h1>
          <h2>Fast Support</h2>
        </div>
        <div class="middle">
  <style type="text/css">
    .lista {
      width: 100%;
    }
  </style>
  <form t:type="form" t:id="names" class="lista">
    <t:errors/>
    <table>
      <tr>
        <td><input t:type="TextField" t:id="dsQuery" /></td>
        <td width="15%"><input type="submit" value="Atualizar"/></td>
      </tr>
    </table>
  </form>
        </div>
        <div class="clear" id="clear"></div>
      </div>
      <div id="bottom"></div>
    </div>
    <div id="footer">
    </div>
  </body>
</html>

Java:
public class Start
{
    @Component(id = "names")
    private Form _form;

    private Long cdCliente = new Long(7);

    @Property
    private String dsQuery;
    @Component(id = "dsQuery")
    private TextField dsQueryField;

    void onValidateForm() {
      if (dsQuery == null || dsQuery.trim().equals("")) {
        _form.recordError(dsQueryField, "First Name is required.");
      }
    }

    Object onSuccess() {
      //    new Exception("E..." + dsQuery).printStackTrace();
      return this;
    }
}

It had no onSuccess, but didn't worked either.
Im using the same Start.java as response to the form.

-- 
Sidney G B Ferreira
Desenvolvedor Web - Tibox Innovations

Re: Forms - BeanEditor and t:select

Posted by stipenovi <ST...@GMAIL.COM>.
It seams that your *add="descriptionCreator" + <p:descriptionCreator>* is
right way.
Now is everything OK.
Thank you very much for help and for fast replay.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Forms-tp2427184p5713583.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Forms - BeanEditor and t:select

Posted by ICE Ernesto Arteaga Zavala <ar...@gmail.com>.
I do that in this way:

                      <t:form t:id="bankAccountForm">
<t:beaneditor t:id="bankAccountEditor" add="bank, button">
<p:bank>
<label for="bank">
<t:outputraw value="message:bank-label" />
</label>
<t:select t:model="model" t:encoder="encoder"
 value="user.bankAccount.bank" />
</p:bank>
<p:button>
<div class="t-beaneditor-row">
<t:submit t:mixins="jquery/button" />
</div>
</p:button>
</t:beaneditor>
</t:form>

2012/6/1 stipenovi <ST...@gmail.com>

> Can anyone help me:
>
> I have 2 entities: Description and Person with  unidirectional ManyToOne
> mapped relationship.
> Every description must have descriptionCreator (Person).
>
> I have this code in tml:
>
>
>
> I injected SelectModelFactory, and have SelectModel as @Property in page
> class. I also created PersonValueEncoder in separate class, added it in
> appModule...
> I setupRender i setup my selectModel with
> SelectModelFactory.create(personsList, "name") and checked with
> getOptions().size() that I have 3 options (I inserted 3 Persons in
> database).
>
> When call this form, it doesnt show select component, nor label, and there
> is no exceptions. So, everything is rendered OK, except that there is no
> select component for choosing Person for Description.
>
> Thanks
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Forms-tp2427184p5713581.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Saludos,

-------------------------------------------------------------------
"Nada que se consiga sin pena y sin trabajo
 es verdaderamente valioso."
                                          Joseph Addison
-------------------------------------------------------------------

ICE Ernesto Arteaga Zavala
Ingeniero de Desarrollo

Re: Forms - BeanEditor and t:select

Posted by stipenovi <ST...@GMAIL.COM>.
Can anyone help me:

I have 2 entities: Description and Person with  unidirectional ManyToOne
mapped relationship.
Every description must have descriptionCreator (Person).

I have this code in tml:



I injected SelectModelFactory, and have SelectModel as @Property in page
class. I also created PersonValueEncoder in separate class, added it in
appModule... 
I setupRender i setup my selectModel with
SelectModelFactory.create(personsList, "name") and checked with
getOptions().size() that I have 3 options (I inserted 3 Persons in
database).

When call this form, it doesnt show select component, nor label, and there
is no exceptions. So, everything is rendered OK, except that there is no
select component for choosing Person for Description.

Thanks

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Forms-tp2427184p5713581.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Forms

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 16 Feb 2012 08:58:30 -0200, stipenovi <ST...@gmail.com>  
wrote:

> I will post here...
>
> This is my simple code:
>
> *<t:form&lt;/b> t:inPlace="false" t:id="multiBeanForm"  
> t:zone="editorZone">
>     *<t:beaneditform&lt;/b> t:id="createForm" t:object="nodeTop"
> t:zone="editorZone"
>                         t:exclude="id, version, nodeLevel, level,
> dateCreated"/>
>     *<t:beaneditform&lt;/b> t:id="createDescriptionForm"
> t:object="descriptionText" t:zone="editorZone" />
>     *<t:errors/>*
>     *<input&lt;/b> t:type="Submit" t:id="done" value="Save"/>
> *</t:form>*
>
> Error is: */Form components may not be placed inside other Form  
> components.

The error message describes exactly what the problem is: you can put a  
Form inside another Form. BeanEditForm uses a Form inside it. Use  
BeanEditor instead of BeanEditForm.

> /*
> In page class I have 3 components:
>     @Component(id = "createForm")
>     private BeanEditForm createForm;
>     @Component(id = "createDescriptionForm")
>     private BeanEditForm createDescriptionForm;
>     @Component(id = "multiBeanForm")
>     private Form multiBeanForm;
>
> I have read one Lewis's replay where he said that is Ok to use two
> BeanEditForms in one Form.

It isn't.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Forms

Posted by stipenovi <ST...@GMAIL.COM>.
I will post here...

This is my simple code:

*<t:form&lt;/b> t:inPlace="false" t:id="multiBeanForm" t:zone="editorZone">
    *<t:beaneditform&lt;/b> t:id="createForm" t:object="nodeTop"
t:zone="editorZone"
                        t:exclude="id, version, nodeLevel, level,
dateCreated"/>
    *<t:beaneditform&lt;/b> t:id="createDescriptionForm"
t:object="descriptionText" t:zone="editorZone" />
    *<t:errors/>*
    *<input&lt;/b> t:type="Submit" t:id="done" value="Save"/>
*</t:form>*

Error is: */Form components may not be placed inside other Form components.
/*
In page class I have 3 components: 
    @Component(id = "createForm")
    private BeanEditForm createForm;
    @Component(id = "createDescriptionForm")
    private BeanEditForm createDescriptionForm;
    @Component(id = "multiBeanForm")
    private Form multiBeanForm;

I have read one Lewis's replay where he said that is Ok to use two
BeanEditForms in one Form.

Thanks for replay.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Forms-tp2427184p5489179.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Forms

Posted by Sid Ferreira <si...@gmail.com>.
I expected to see them inside the text fields
On Fri, Jan 16, 2009 at 10:45 AM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> Em Fri, 16 Jan 2009 08:35:54 -0300, Sid Ferreira <si...@gmail.com>
> escreveu:
>
>  I was losing the values anyway...
>>
>
> Ooops. I forgot to say that you should return null instead of this.
> And I just can't see why you say you're losing the fields values, as in no
> place in your code you print them in HTML nor the standard output.
>
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Sidney G B Ferreira
Desenvolvedor Web - Tibox Innovations

Re: Forms

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 16 Jan 2009 08:35:54 -0300, Sid Ferreira <si...@gmail.com>  
escreveu:

> I was losing the values anyway...

Ooops. I forgot to say that you should return null instead of this.
And I just can't see why you say you're losing the fields values, as in no  
place in your code you print them in HTML nor the standard output.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Forms

Posted by Sid Ferreira <si...@gmail.com>.
I was losing the values anyway...

On Fri, Jan 16, 2009 at 10:13 AM, Thiago H. de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> Em Thu, 15 Jan 2009 16:58:10 -0300, Sid Ferreira <si...@gmail.com>
> escreveu:
>
>     Object onSuccess() {
>>      //    new Exception("E..." + dsQuery).printStackTrace();
>>      return this;
>>    }
>>
>
> Never return "this" in a event handler method. This leads to loss of field
> values when they are not persisted in the session.
>
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Sidney G B Ferreira
Desenvolvedor Web - Tibox Innovations

Re: Forms

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 15 Jan 2009 16:58:10 -0300, Sid Ferreira <si...@gmail.com>  
escreveu:

>     Object onSuccess() {
>       //    new Exception("E..." + dsQuery).printStackTrace();
>       return this;
>     }

Never return "this" in a event handler method. This leads to loss of field  
values when they are not persisted in the session.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Forms

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 16 Jan 2009 05:59:00 -0300, Peter Stavrinides  
<P....@albourne.com> escreveu:

> As far as I know you can use a standard submit button.

You're absolutely correct. I *never* used the Submit component, and I'm  
writing Tapestry 5 applications since 5.0.5 (almost two years ago). :)

By the way, you don't need an onSuccess method to Tapestry update your  
objects with the values entered by the user. You use onSucess for doing a  
search or writing an object to a database, for example.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Forms

Posted by Peter Stavrinides <P....@albourne.com>.
As far as I know you can use a standard submit button.

-- 
If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Please visit http://www.albourne.com/email.html for important additional terms relating to this e-mail.

----- Original Message -----
From: "Sid Ferreira" <si...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Friday, 16 January, 2009 10:46:11 AM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Re: Forms

in the end I managed a different way:
created a pdsQuery with @Persist and onSuccess dsQuery sets pdsQuery and it
worked. But looks too lame.

In jumpstart Geoff used a common submit.

Also: is there a way to after the submit hide the Start? Keep it in
server.ext/app/ ?


On Fri, Jan 16, 2009 at 6:09 AM, Kristian Marinkovic <
kristian.marinkovic@porsche.co.at> wrote:

> hi sid,
>
> you need to use a Tapestry Submit component to submit the form.
> otherwise the request wont be processed by Tapestry
>
> g,
> kris
>
>
>
>
>
> Sid Ferreira <si...@gmail.com>
> 15.01.2009 20:58
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Forms
>
>
>
>
>
>
> Guys, Im trying to make a small search engine, but It isn't
> working.follows
> the code:
>
> TML:
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>  <head>
>    <title>Tibox Test App</title>
>  </head>
>  <body>
>    <div id="wrap">
>      <div id="top"></div>
>      <div id="content">
>        <div class="header">
>          <h1>Allert</h1>
>          <h2>Fast Support</h2>
>        </div>
>        <div class="middle">
>  <style type="text/css">
>    .lista {
>      width: 100%;
>    }
>  </style>
>  <form t:type="form" t:id="names" class="lista">
>    <t:errors/>
>    <table>
>      <tr>
>        <td><input t:type="TextField" t:id="dsQuery" /></td>
>        <td width="15%"><input type="submit" value="Atualizar"/></td>
>      </tr>
>    </table>
>  </form>
>        </div>
>        <div class="clear" id="clear"></div>
>      </div>
>      <div id="bottom"></div>
>    </div>
>    <div id="footer">
>    </div>
>  </body>
> </html>
>
> Java:
> public class Start
> {
>    @Component(id = "names")
>    private Form _form;
>
>    private Long cdCliente = new Long(7);
>
>    @Property
>    private String dsQuery;
>    @Component(id = "dsQuery")
>    private TextField dsQueryField;
>
>    void onValidateForm() {
>      if (dsQuery == null || dsQuery.trim().equals("")) {
>        _form.recordError(dsQueryField, "First Name is required.");
>      }
>    }
>
>    Object onSuccess() {
>      //    new Exception("E..." + dsQuery).printStackTrace();
>      return this;
>    }
> }
>
> It had no onSuccess, but didn't worked either.
> Im using the same Start.java as response to the form.
>
> --
> Sidney G B Ferreira
> Desenvolvedor Web - Tibox Innovations
>
>


-- 
Sidney G B Ferreira
Desenvolvedor Web - Tibox Innovations

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Forms

Posted by Sid Ferreira <si...@gmail.com>.
in the end I managed a different way:
created a pdsQuery with @Persist and onSuccess dsQuery sets pdsQuery and it
worked. But looks too lame.

In jumpstart Geoff used a common submit.

Also: is there a way to after the submit hide the Start? Keep it in
server.ext/app/ ?


On Fri, Jan 16, 2009 at 6:09 AM, Kristian Marinkovic <
kristian.marinkovic@porsche.co.at> wrote:

> hi sid,
>
> you need to use a Tapestry Submit component to submit the form.
> otherwise the request wont be processed by Tapestry
>
> g,
> kris
>
>
>
>
>
> Sid Ferreira <si...@gmail.com>
> 15.01.2009 20:58
> Bitte antworten an
> "Tapestry users" <us...@tapestry.apache.org>
>
>
> An
> Tapestry users <us...@tapestry.apache.org>
> Kopie
>
> Thema
> Forms
>
>
>
>
>
>
> Guys, Im trying to make a small search engine, but It isn't
> working.follows
> the code:
>
> TML:
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>  <head>
>    <title>Tibox Test App</title>
>  </head>
>  <body>
>    <div id="wrap">
>      <div id="top"></div>
>      <div id="content">
>        <div class="header">
>          <h1>Allert</h1>
>          <h2>Fast Support</h2>
>        </div>
>        <div class="middle">
>  <style type="text/css">
>    .lista {
>      width: 100%;
>    }
>  </style>
>  <form t:type="form" t:id="names" class="lista">
>    <t:errors/>
>    <table>
>      <tr>
>        <td><input t:type="TextField" t:id="dsQuery" /></td>
>        <td width="15%"><input type="submit" value="Atualizar"/></td>
>      </tr>
>    </table>
>  </form>
>        </div>
>        <div class="clear" id="clear"></div>
>      </div>
>      <div id="bottom"></div>
>    </div>
>    <div id="footer">
>    </div>
>  </body>
> </html>
>
> Java:
> public class Start
> {
>    @Component(id = "names")
>    private Form _form;
>
>    private Long cdCliente = new Long(7);
>
>    @Property
>    private String dsQuery;
>    @Component(id = "dsQuery")
>    private TextField dsQueryField;
>
>    void onValidateForm() {
>      if (dsQuery == null || dsQuery.trim().equals("")) {
>        _form.recordError(dsQueryField, "First Name is required.");
>      }
>    }
>
>    Object onSuccess() {
>      //    new Exception("E..." + dsQuery).printStackTrace();
>      return this;
>    }
> }
>
> It had no onSuccess, but didn't worked either.
> Im using the same Start.java as response to the form.
>
> --
> Sidney G B Ferreira
> Desenvolvedor Web - Tibox Innovations
>
>


-- 
Sidney G B Ferreira
Desenvolvedor Web - Tibox Innovations

Re: Forms

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi sid,

you need to use a Tapestry Submit component to submit the form.
otherwise the request wont be processed by Tapestry

g,
kris





Sid Ferreira <si...@gmail.com> 
15.01.2009 20:58
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
Tapestry users <us...@tapestry.apache.org>
Kopie

Thema
Forms






Guys, Im trying to make a small search engine, but It isn't 
working.follows
the code:

TML:
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
  <head>
    <title>Tibox Test App</title>
  </head>
  <body>
    <div id="wrap">
      <div id="top"></div>
      <div id="content">
        <div class="header">
          <h1>Allert</h1>
          <h2>Fast Support</h2>
        </div>
        <div class="middle">
  <style type="text/css">
    .lista {
      width: 100%;
    }
  </style>
  <form t:type="form" t:id="names" class="lista">
    <t:errors/>
    <table>
      <tr>
        <td><input t:type="TextField" t:id="dsQuery" /></td>
        <td width="15%"><input type="submit" value="Atualizar"/></td>
      </tr>
    </table>
  </form>
        </div>
        <div class="clear" id="clear"></div>
      </div>
      <div id="bottom"></div>
    </div>
    <div id="footer">
    </div>
  </body>
</html>

Java:
public class Start
{
    @Component(id = "names")
    private Form _form;

    private Long cdCliente = new Long(7);

    @Property
    private String dsQuery;
    @Component(id = "dsQuery")
    private TextField dsQueryField;

    void onValidateForm() {
      if (dsQuery == null || dsQuery.trim().equals("")) {
        _form.recordError(dsQueryField, "First Name is required.");
      }
    }

    Object onSuccess() {
      //    new Exception("E..." + dsQuery).printStackTrace();
      return this;
    }
}

It had no onSuccess, but didn't worked either.
Im using the same Start.java as response to the form.

-- 
Sidney G B Ferreira
Desenvolvedor Web - Tibox Innovations