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/13 18:38:54 UTC
AjaxFormLoop && Loop in form zone losing form validation data 5.4
I originally reported an issue related to invalid data being lost during
form submission and a validation error within the ajaxformloop component
which can be found here
http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/AjaxFormLoop-losing-field-data-with-validation-error-while-nested-in-form-zone-td5727182.html
However; I just discovered this issue also effects the loop component too.
I'm assuming there may be a similar issue with the grid component, but have
not tested it yet. If I were to take a guess and I'm no expert in how 5.4
handles validation, but my guess is it has something to do with how
tapestry holds on and returns those values.
clientValidation="none"
On Wed, Jun 11, 2014 at 8:36 AM, George Christman <gc...@cardaddy.com>
wrote:
> 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 <
> gchristman@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
>
>
--
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York