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

Reply via email to