You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Sumanth <ro...@gmail.com> on 2015/01/06 16:17:57 UTC

Issues with Forms Inside Zone and Outside Zone Behaviour Tapestry 5.4

Hello All,

Consider this situation that, we have two forms with text boxes , one
inside ajax, other outside ajax

<t:zone t:id="Zone1" id="Zone1">
    <form t:type="form" t:id="selectForm" class="form-horizontal"
role="form" zone="^">
      <t:TextField t:id="firstnameTxt" t:value="firstname"  />
      <t:submit value="submit" ></t:submit>
     </form>
  </t:zone>

<form t:type="form" t:id="OutsideZone" class="form-horizontal" role="form">
    <t:TextField t:id="firstnameTxtOutsideZone"
t:value="firstnameOutsideZone"  />
    <t:submit value="submit" ></t:submit>
  </form>

// java side


  void onValidateFromzone1() {
    selectDateForm.recordError(firstnameTxt, "Hi Txt");
  }

void onValidateFromOutsideZone() {
    selectDateFormOutsideZone.recordError(firstnameTxtOutsideZone, "Hi hi
Txt");
  }

[image: Inline image 1]
And validation errors happen on these fields on server side and we attach a
validation error message.

In the form outside the zone, the validation error is bound to the
component and just appears right below the textfield. just like how "the
field is required" appears when a text field is marked as required and no
value is given.

But when the same form is inside ajax this does not happen, and the only
way we can see the error is by attaching <t:errors /> component inside the
form.

Any reason why the behaviour is like this. I would like to have the same
functionality on both.

Thanks,

Re: Issues with Forms Inside Zone and Outside Zone Behaviour Tapestry 5.4

Posted by Sumanth <ro...@gmail.com>.
Hi,

the issue is not related to t:validate. I have uploaded the image which is
accessible with the below link. If in case it is not, here is the case,

suppose you have t:validate on a field and you click submit without any
value, then you get "this value is required" correct?. Now the same way the
error for other components say for example "Hi is not a valid name" will be
shown when validation error happens from server side only when there is
full page refresh but for ajax requests the only way to show this custom
error message is to use t:errors component, It just cannot be bound to the
component, but it does not show for ajax requests.  I hope the image below
is accessible

http://postimg.org/image/4s71xgmi7/
http://s3.postimg.org/5uh8g05bn/screenshot_localhost_8080_2015_01_06_16_10_45.png


On Tue, Jan 6, 2015 at 5:12 PM, George Christman <gc...@cardaddy.com>
wrote:

> Where are you specifying the clientside validation? Have you tried adding
> t:validate="required" or some other validation type to your textfield?
>
> On Tue, Jan 6, 2015 at 10:17 AM, Sumanth <ro...@gmail.com> wrote:
>
> > Hello All,
> >
> > Consider this situation that, we have two forms with text boxes , one
> > inside ajax, other outside ajax
> >
> > <t:zone t:id="Zone1" id="Zone1">
> >     <form t:type="form" t:id="selectForm" class="form-horizontal"
> > role="form" zone="^">
> >       <t:TextField t:id="firstnameTxt" t:value="firstname"  />
> >       <t:submit value="submit" ></t:submit>
> >      </form>
> >   </t:zone>
> >
> > <form t:type="form" t:id="OutsideZone" class="form-horizontal"
> role="form">
> >     <t:TextField t:id="firstnameTxtOutsideZone"
> > t:value="firstnameOutsideZone"  />
> >     <t:submit value="submit" ></t:submit>
> >   </form>
> >
> > // java side
> >
> >
> >   void onValidateFromzone1() {
> >     selectDateForm.recordError(firstnameTxt, "Hi Txt");
> >   }
> >
> > void onValidateFromOutsideZone() {
> >     selectDateFormOutsideZone.recordError(firstnameTxtOutsideZone, "Hi hi
> > Txt");
> >   }
> >
> > [image: Inline image 1]
> > And validation errors happen on these fields on server side and we attach
> > a validation error message.
> >
> > In the form outside the zone, the validation error is bound to the
> > component and just appears right below the textfield. just like how "the
> > field is required" appears when a text field is marked as required and no
> > value is given.
> >
> > But when the same form is inside ajax this does not happen, and the only
> > way we can see the error is by attaching <t:errors /> component inside
> the
> > form.
> >
> > Any reason why the behaviour is like this. I would like to have the same
> > functionality on both.
> >
> > Thanks,
> >
>
>
>
> --
> George Christman
> CEO
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>

Re: Issues with Forms Inside Zone and Outside Zone Behaviour Tapestry 5.4

Posted by George Christman <gc...@cardaddy.com>.
Where are you specifying the clientside validation? Have you tried adding
t:validate="required" or some other validation type to your textfield?

On Tue, Jan 6, 2015 at 10:17 AM, Sumanth <ro...@gmail.com> wrote:

> Hello All,
>
> Consider this situation that, we have two forms with text boxes , one
> inside ajax, other outside ajax
>
> <t:zone t:id="Zone1" id="Zone1">
>     <form t:type="form" t:id="selectForm" class="form-horizontal"
> role="form" zone="^">
>       <t:TextField t:id="firstnameTxt" t:value="firstname"  />
>       <t:submit value="submit" ></t:submit>
>      </form>
>   </t:zone>
>
> <form t:type="form" t:id="OutsideZone" class="form-horizontal" role="form">
>     <t:TextField t:id="firstnameTxtOutsideZone"
> t:value="firstnameOutsideZone"  />
>     <t:submit value="submit" ></t:submit>
>   </form>
>
> // java side
>
>
>   void onValidateFromzone1() {
>     selectDateForm.recordError(firstnameTxt, "Hi Txt");
>   }
>
> void onValidateFromOutsideZone() {
>     selectDateFormOutsideZone.recordError(firstnameTxtOutsideZone, "Hi hi
> Txt");
>   }
>
> [image: Inline image 1]
> And validation errors happen on these fields on server side and we attach
> a validation error message.
>
> In the form outside the zone, the validation error is bound to the
> component and just appears right below the textfield. just like how "the
> field is required" appears when a text field is marked as required and no
> value is given.
>
> But when the same form is inside ajax this does not happen, and the only
> way we can see the error is by attaching <t:errors /> component inside the
> form.
>
> Any reason why the behaviour is like this. I would like to have the same
> functionality on both.
>
> Thanks,
>



-- 
George Christman
CEO
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Issues with Forms Inside Zone and Outside Zone Behaviour Tapestry 5.4

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
I believe this was a known issue which has just been fixed:  
https://issues.apache.org/jira/browse/TAP5-2391

On Tue, 06 Jan 2015 13:17:57 -0200, Sumanth <ro...@gmail.com>  
wrote:

> Hello All,
>
> Consider this situation that, we have two forms with text boxes , one  
> inside ajax, other outside ajax
>
> <t:zone t:id="Zone1" id="Zone1">
>    <form t:type="form" t:id="selectForm" class="form-horizontal"  
> role="form" zone="^">
>      <t:TextField t:id="firstnameTxt" t:value="firstname"  />
>      <t:submit value="submit" ></t:submit>
>     </form>
>  </t:zone>
>
> <form t:type="form" t:id="OutsideZone" class="form-horizontal"  
> role="form">
>    <t:TextField t:id="firstnameTxtOutsideZone"  
> t:value="firstnameOutsideZone"  />
>    <t:submit value="submit" ></t:submit> </form>
>
> // java side
>
>  void onValidateFromzone1() {
>    selectDateForm.recordError(firstnameTxt, "Hi Txt");
>  }
>
> void onValidateFromOutsideZone() {
>    selectDateFormOutsideZone.recordError(firstnameTxtOutsideZone, "Hi hi  
> Txt");
>  }
>   
> And validation errors happen on these fields on server side and we  
> attach a validation error message.
> In the form outside the zone, the validation error is bound to the  
> component and just appears right below the textfield. >just like how  
> "the field is required" appears when a text field is marked as required  
> and no value is given.
> But when the same form is inside ajax this does not happen, and the only  
> way we can see the error is by attaching ><t:errors /> component inside  
> the form.
> Any reason why the behaviour is like this. I would like to have the same  
> functionality on both.
>
> Thanks,



-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br