AmpersandJS / ampersand-select-view

Select field for ampersand-form-views
MIT License
11 stars 26 forks source link

Validation error message not showing on parent form submit #47

Closed ErikWittern closed 9 years ago

ErikWittern commented 9 years ago

I am using an ampersand-select-view within an ampersand-form-view like this:

new FormView({
  ...
  fields: [
    ...
    new SelectView({
      el: self.queryByHook('category'),
      name: 'category',
      options: categoryOptions,
      label: 'Main Category *',
      required: true,
      requiredMessage: "Please select a category."
    })
  ]
});

The select-view renders correctly. It is also considered in the form view's validation - selecting no option does prevent the submit. However, the error message is not displayed upon submit. The error is shown, though, if I select an entry and then deselect it again.

I use other ampersand-input-views in the same FormView, which work fine.

cdaringe commented 9 years ago

hello, can you provide more input? are you by chance also using unselectedText? is there a falsy first value other than 0 for your top option? i tested this and saw the desired behavior. a requirebin would be helpful!

ErikWittern commented 9 years ago

Hi Christopher, thanks for the reply! I tried to reproduce the error here: http://requirebin.com/?gist=ad163481d1910b99ed48. Interestingly, the message-container seems to get displayed after validation, but the message-text is not shown. Maybe I am just doing something stupid in consuming the view / setting up the form view?

cdaringe commented 9 years ago

@ErikWittern, awesome. thanks man! so there are two issues.

i ran a little demo with these updates and it seems to be working fine. i will push the PR soon

ErikWittern commented 9 years ago

Fantastic, thank you very much, Christopher!

ErikWittern commented 9 years ago

The update to v4.0.0 fixed my issue.