Yep. Thanks.

Eelco


On 2/19/07, Johan Compagner <[EMAIL PROTECTED]> wrote:
shouldn't this:

public void updateModel() {

        dateField.updateModel();
        hoursField.updateModel();
        minutesField.updateModel();
        amOrPmChoice.updateModel();

        if (date != null) {

            try {
                TimeZone zone = getClientTimeZone();
                if (zone != null) {
                    date.setZone(DateTimeZone.forTimeZone(zone));
                }

                if (hours != null) {
                    date.set(DateTimeFieldType.hourOfHalfday(), hours
                            .intValue());
                    date.setMinuteOfHour((minutes != null) ?
minutes.intValue()
                            : 0);
                }
                if (amOrPm == AM_PM.PM) {
                    date.set(DateTimeFieldType.halfdayOfDay(), 1);
                } else {
                    date.set(DateTimeFieldType.halfdayOfDay(), 0);
                }
            } catch (RuntimeException e) {
                DateTimeField.this.error(e.getMessage());
                invalid();
            }

            // the date will be in the server's timezone
            Date d = date.toDate();
            setModelObject(d);
        } else {
            setModelObject(null);
        }
    }

be this:

public void updateModel() {

        dateField.updateModel();
        hoursField.updateModel();
        minutesField.updateModel();
        amOrPmChoice.updateModel();

        if (date != null) {

            try {
                TimeZone zone = getClientTimeZone();
                if (zone != null) {
                    date.setZone(DateTimeZone.forTimeZone(zone));
                }

                if (hours != null) {
                    date.set(DateTimeFieldType.hourOfHalfday(), hours
                            .intValue());
                    date.setMinuteOfHour((minutes != null) ?
minutes.intValue()
                            : 0);
                }
                if (amOrPm == AM_PM.PM) {
                    date.set(DateTimeFieldType.halfdayOfDay(), 1);
                } else {
                    date.set(DateTimeFieldType.halfdayOfDay(), 0);
                }
                // the date will be in the server's timezone
                Date d = date.toDate();
               setModelObject(d);
            } catch (RuntimeException e) {
                DateTimeField.this.error(e.getMessage());
                invalid();
            }

        } else {
            setModelObject(null);
        }
    }


So only set the model object to the date if there is no exception?

Reply via email to