You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jin Lee <ji...@gmail.com> on 2005/02/09 21:31:42 UTC

Confused about how to keep form data on page

Hey all,

I have a form with 3 fields, all of which are required. The first two
are of type ValidField, and the third is of type DatePicker.

I'm not sure if there is a way to validate the date coming from
DatePicker using the .page file like the way ValidField works, so
instead I have this code in my submit listener:

    public void createASSR(IRequestCycle cycle) {
    	IValidationDelegate delegate =
(IValidationDelegate)getBeans().getBean("errorMsgs");
    	
    	//check the date received
    	if (getBServiceRequest().getDateReceived() == null) {
    		delegate.record("You must enter a value for Date Received", null);
    	}
    	if (delegate.getHasErrors()) {
    		return;
    	}
.
(other stuff)
.
    	}

Doing this works, except for one problem. If I input a date but
nothing in the other two required fields, the date becomes empty again
when the page reloads. The other validfields do not have this
behavior, instead the previous request values are reloaded.

How do I implement this correctly? Thanks,

Jin

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Confused about how to keep form data on page

Posted by Kent Tong <ke...@cpttm.org.mo>.
Jin Lee <jinslee <at> gmail.com> writes:

> Doing this works, except for one problem. If I input a date but
> nothing in the other two required fields, the date becomes empty again
> when the page reloads. The other validfields do not have this
> behavior, instead the previous request values are reloaded.

AFAIK there is no way to do it because the DatePicker 
component accepts a Date object to render. If what the 
user inputs is an arbitrary string (not a Date), there 
is no way to let the DatePicker show that string again.



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org