Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DateItem validation issue

    SmartGWT 3.0p 2/16 nightly
    Gwt 2.4
    Firefox 6.0

    Good Morning,

    I've been having an issue for sometime now and decided to dig a little deeper...

    I have a form with two DateItem fields, start/end which both have DateItem.setRequired(true) set.

    I have a SelectItem that when the selection is changed, I need to create new Validators for those DateItems with the corresponding Dates from the Selected Item.

    So within the ChangedHandler of the SelectItem, I create new DateRangeValidators for both start and end DateItems and do the following....

    Code:
    form.getItem("Start").setValidators(DateRangeValidator)
    form.getItem("End").setValidators(DateRangeValidator)
    When I added these two items and I attempt to validate the form through
    form.validate()

    The form does not see the two DateItems, Start/End, as needing to be "Required", as if using the setValidators() function disabled the implicit "Requires" validation.

    How can I circumvent this issue or is this something that needs to be fixed?

    #2
    By calling setValidators() after the items have been created by the form, you are explicitly wiping out the validators generated by the databinding system. Instead, pass FormItem objects containing the validators to setItems(), as explained in the QuickStart Guide Data Binding chapter.

    Comment

    Working...
    X