figured it out, was an error on my behalf. I needed to wrap new
UserProfile with a null check.

public void onPrepareFromRegisterForm() {
        if (userProfile == null) {
            userProfile = new UserProfile();
            userProfile.setCreateDate(new Date());
        }
    }

On Mon, Oct 13, 2014 at 3:57 PM, George Christman
<gchrist...@cardaddy.com> wrote:
> So I think I'm close to figuring out the cause of this issue, it looks
> as if the form/field id's are changing with the zone up date which I
> believe is the cause of this issue. Any experts have any thoughts?
>
> On Mon, Oct 13, 2014 at 3:01 PM, George Christman
> <gchrist...@cardaddy.com> wrote:
>> Odd behavior, I found if I removed the form from the zone it fixed the
>> issue; however this does not make any sense to me though.
>>
>> <t:zone t:id="loginRegisterZone" id="loginRegisterZone"></t:zone>
>>
>> <t:form t:id="registerForm" zone="loginRegisterZone">
>> <input t:type="textfield" t:id="firstName" placeholder="First Name"
>> value="userProfile.firstName" class="input-sm"/>
>> //additional fields
>> <t:Submit class="btn btn-success" value="Register"/>
>> </t:form>
>>
>> On Mon, Oct 13, 2014 at 1:43 PM, George Christman
>> <gchrist...@cardaddy.com> wrote:
>>> I'm using 5.4 and for some reason I can not get my ajax form to hold
>>> onto the field values after a validation error has occurred. When a
>>> validation error occures all my fields are blanked out. Does anybody
>>> have any idea what might be causing this?
>>>
>>> I have the following code snippet.
>>>
>>> <t:zone t:id="loginRegisterZone" id="loginRegisterZone">
>>> <t:form t:id="registerForm" zone="loginRegisterZone">
>>> <input t:type="textfield" t:id="firstName" placeholder="First Name"
>>> value="userProfile.firstName" class="input-sm"/>
>>> //additional fields
>>> <t:Submit class="btn btn-success" value="Register"/>
>>> </t:form>
>>> </t:zone>
>>>
>>>
>>> @Component(id = "registerForm")
>>>     private Form registerForm;
>>>
>>> @Property
>>>     private UserProfile userProfile;
>>>
>>> public void onPrepareFromRegisterForm() {
>>>         userProfile = new UserProfile();
>>>         userProfile.setCreateDate(new Date());
>>>     }
>>>
>>>     boolean onValidateFromRegisterForm() {
>>>         if (password != null) {
>>>             userProfile.setPassword(password);
>>>         }
>>>
>>>         if (getEmailExist(userProfile.getEmail())) {
>>>             registerForm.recordError("");
>>>             alertManager.alert(Duration.TRANSIENT, Severity.ERROR,
>>> "Sorry, that email is not available, please try again.");
>>>             return false;
>>>         }
>>>
>>>         UsernamePasswordToken token = new
>>> UsernamePasswordToken(userProfile.getEmail(), password);
>>>         token.setRememberMe(true);
>>>
>>>         currentUser.login(token);
>>>
>>>         try {
>>>             currentUser.login(token);
>>>         } catch (AuthenticationException e) {
>>>             throw new LockedAccountException(e);
>>>         }
>>>
>>>         return true;
>>>     }
>>
>>
>>
>> --
>> 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

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

Reply via email to