You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by George Christman <gc...@cardaddy.com> on 2014/06/10 17:52:14 UTC
AjaxFormLoop losing field data with validation error while nested in
form zone.
Hi guys, I have an ajax from with a nested AjaxFormLoop. When ever there is
a validation error within the field, I lose the field data completely. This
does not happen when the form is not nested in a zone. Any idea what might
be causing this?
Data to throw validation 12345678
Example code.
<t:zone t:id="formZone">
<t:form t:id="form" zone="formZone" clientvalidation="NONE">
<t:errors/>
<div t:type="ajaxformloop" t:id="phones" source="person.phones"
value="phone" encoder="encoder">
<t:textfield t:id="number" value="phone.number"
validate="maxlength=7"/>
<t:removerowlink>remove</t:removerowlink>
</div>
<input type="submit" value="Update"/>
</t:form>
</t:zone>
java
void onValidateFromForm() {
if(form.getHasErrors()) {
ajaxResponseRenderer.addRender("formZone", formZone);
}
}
public ValueEncoder<Phone> getEncoder() {
return new ValueEncoder<Phone>() {
@Override
public String toClient(Phone v) {
Long id = v.getId();
return id == null ? "-1" : id.toString();
}
@Override
public Phone toValue(String toValue) {
Phone phone = null;
Long id = Long.parseLong(toValue);
if (id > 0) {
phone = (Phone) session.get(Phone.class, id);
}
return phone == null ? new Phone() : phone;
}
};
}
--
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York
Re: AjaxFormLoop losing field data with validation error while nested
in form zone.
Posted by George Christman <gc...@cardaddy.com>.
Does anybody know if this is a framework bug? If so I'll create a jira
issue for it.
On Tue, Jun 10, 2014 at 11:56 AM, George Christman <gc...@cardaddy.com>
wrote:
> Sorry, forgot to mention my version, 5.4 beta-10
>
>
> On Tue, Jun 10, 2014 at 11:52 AM, George Christman <
> gchristman@cardaddy.com> wrote:
>
>> Hi guys, I have an ajax from with a nested AjaxFormLoop. When ever there
>> is a validation error within the field, I lose the field data completely.
>> This does not happen when the form is not nested in a zone. Any idea what
>> might be causing this?
>>
>> Data to throw validation 12345678
>>
>> Example code.
>> <t:zone t:id="formZone">
>> <t:form t:id="form" zone="formZone" clientvalidation="NONE">
>> <t:errors/>
>> <div t:type="ajaxformloop" t:id="phones"
>> source="person.phones" value="phone" encoder="encoder">
>> <t:textfield t:id="number" value="phone.number"
>> validate="maxlength=7"/>
>> <t:removerowlink>remove</t:removerowlink>
>> </div>
>> <input type="submit" value="Update"/>
>> </t:form>
>> </t:zone>
>>
>> java
>>
>> void onValidateFromForm() {
>>
>> if(form.getHasErrors()) {
>> ajaxResponseRenderer.addRender("formZone", formZone);
>> }
>> }
>>
>> public ValueEncoder<Phone> getEncoder() {
>> return new ValueEncoder<Phone>() {
>> @Override
>> public String toClient(Phone v) {
>> Long id = v.getId();
>> return id == null ? "-1" : id.toString();
>> }
>> @Override
>> public Phone toValue(String toValue) {
>> Phone phone = null;
>> Long id = Long.parseLong(toValue);
>>
>> if (id > 0) {
>> phone = (Phone) session.get(Phone.class, id);
>> }
>> return phone == null ? new Phone() : phone;
>> }
>> };
>> }
>> --
>> George Christman
>> www.CarDaddy.com
>> P.O. Box 735
>> Johnstown, New York
>>
>>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
>
--
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York
Re: AjaxFormLoop losing field data with validation error while nested
in form zone.
Posted by George Christman <gc...@cardaddy.com>.
Sorry, forgot to mention my version, 5.4 beta-10
On Tue, Jun 10, 2014 at 11:52 AM, George Christman <gc...@cardaddy.com>
wrote:
> Hi guys, I have an ajax from with a nested AjaxFormLoop. When ever there
> is a validation error within the field, I lose the field data completely.
> This does not happen when the form is not nested in a zone. Any idea what
> might be causing this?
>
> Data to throw validation 12345678
>
> Example code.
> <t:zone t:id="formZone">
> <t:form t:id="form" zone="formZone" clientvalidation="NONE">
> <t:errors/>
> <div t:type="ajaxformloop" t:id="phones"
> source="person.phones" value="phone" encoder="encoder">
> <t:textfield t:id="number" value="phone.number"
> validate="maxlength=7"/>
> <t:removerowlink>remove</t:removerowlink>
> </div>
> <input type="submit" value="Update"/>
> </t:form>
> </t:zone>
>
> java
>
> void onValidateFromForm() {
>
> if(form.getHasErrors()) {
> ajaxResponseRenderer.addRender("formZone", formZone);
> }
> }
>
> public ValueEncoder<Phone> getEncoder() {
> return new ValueEncoder<Phone>() {
> @Override
> public String toClient(Phone v) {
> Long id = v.getId();
> return id == null ? "-1" : id.toString();
> }
> @Override
> public Phone toValue(String toValue) {
> Phone phone = null;
> Long id = Long.parseLong(toValue);
>
> if (id > 0) {
> phone = (Phone) session.get(Phone.class, id);
> }
> return phone == null ? new Phone() : phone;
> }
> };
> }
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
>
--
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York