ng-admin icon indicating copy to clipboard operation
ng-admin copied to clipboard

Required validation do not work with choice field

Open sameer-kumar-jain opened this issue 8 years ago • 4 comments

Hi there,

So I have a simple creation view with 2 field and one of them are a choice field. I would like to apply a required validation to both field. But surprisingly it doesnt work on the choice field. I get following error in console

ReferenceError: notification is not defined at admin?v=NvSTDGEHvKUkyCQOAsmmb6D03XHQNEo34sQmniCFOYs1:1 at tt (admin?v=NvSTDGEHvKUkyCQOAsmmb6D03XHQNEo34sQmniCFOYs1:1) at admin?v=NvSTDGEHvKUkyCQOAsmmb6D03XHQNEo34sQmniCFOYs1:1 at w.$eval (admin?v=NvSTDGEHvKUkyCQOAsmmb6D03XHQNEo34sQmniCFOYs1:1) at w.$digest (admin?v=NvSTDGEHvKUkyCQOAsmmb6D03XHQNEo34sQmniCFOYs1:1) at w.$apply (admin?v=NvSTDGEHvKUkyCQOAsmmb6D03XHQNEo34sQmniCFOYs1:1) at HTMLFormElement. (admin?v=NvSTDGEHvKUkyCQOAsmmb6D03XHQNEo34sQmniCFOYs1:1) at kv (admin?v=NvSTDGEHvKUkyCQOAsmmb6D03XHQNEo34sQmniCFOYs1:1) at HTMLFormElement.i (admin?v=NvSTDGEHvKUkyCQOAsmmb6D03XHQNEo34sQmniCFOYs1:1)

Here are my fields setup fields([ nga.field('Name') .validation({ required: true}) .label('Color Name'), nga.field('IsActive','choice') .label('Status') .validation({ required: true}) .choices([ { value: true, label: 'Active' }, { value: false, label: 'Inactive' } ]), ]);

I could live if I have a way to setup default choice so I dont need to worry about validation.

Thanks Keep It Positive

sameer-kumar-jain avatar Apr 07 '16 08:04 sameer-kumar-jain

I have the same problem,

Could help with a solution to this?

Thank you

wilfredonoyola avatar May 16 '16 17:05 wilfredonoyola

+1

I think that misses a "this" keyword before "notification", in FormController (1.0.0.alpha4, line 31). It misses only in build files, maybe the build is not in sync with the source...

thanks!

fabio-vitali avatar Jun 16 '16 09:06 fabio-vitali

(this bug force me to install/build ng-admin on my build tasks... it would be beautiful to have a new 0.9.x release with the /build files in sync with the sources...)

thanks!

fabio-vitali avatar Jul 27 '16 08:07 fabio-vitali

Thie error is fixed in 1.0.0-Alpha7. I.e the "ReferenceError: notification is not defined" error does not occur anymore. However one would expect to get a popup "Please fill out this field" on the required choice field, and not an "Invalid Form" global notification

Phocea avatar Sep 26 '16 13:09 Phocea