Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No validation message on update with dynamic-scaffold-controller #10837

Closed
4 tasks done
fbartnitzek opened this issue Oct 23, 2017 · 4 comments
Closed
4 tasks done

No validation message on update with dynamic-scaffold-controller #10837

fbartnitzek opened this issue Oct 23, 2017 · 4 comments

Comments

@fbartnitzek
Copy link

fbartnitzek commented Oct 23, 2017

Dynamic scaffolding controller and static scaffolding controller behaves differently for updates

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Create new app with domain class EntityA and EntityB (just different name)
package org.grails.test

class EntityA {
    String name
    Integer number

    static constraints = {
	name 		maxSize: 255
	number		min: 1900, validator: {val -> val < 2019 && val >= 1900 }
    }
}
  1. update BootStrap
def init = { servletContext ->
	new EntityA(name: 'A', number: 2000).save()
	new EntityB(name: 'B', number: 2000).save()
}
  1. Create scaffold-controller for EntityA and generated controller and views for EntityB
create-scaffold-controller org.grails.test.EntityA
generate-controller org.grails.test.EntityB
generate-views org.grails.test.EntityB
  1. start-app and try to update existing entities in UI with invalid number 3000

Expected Behaviour

for both domains the controller should stay at the edit-page and show the validation message:

Property [number] of class [class org.grails.test.EntityB] with value [3,000] does not pass custom validation

2017-10-23_120214-edit_entityb

Actual Behaviour

  • for the scaffold-controller of EntityA:

    • the invalid entered number is ignored and remains at value 2000
    • the view redirects to entityA/show with the successful info message EntityA 1 updated
      2017-10-23_115458-show_entitya
  • the other validations (generated-controller/create, scaffold-controller/create, generated-controller/edit) work as expected above

Environment Information

  • Operating System: Windows 7
  • Grails Version: 3.2.8 and 3.3.1
  • JDK Version: 1.8.0_144

Example Application

@fbartnitzek fbartnitzek changed the title No validation message on update with scaffold-controller No validation message on update with dynamic-scaffold-controller Oct 23, 2017
@jeffscottbrown
Copy link
Member

This should probably be reported at https://github.com/grails-plugins/grails-scaffolding/issues.

@fbartnitzek
Copy link
Author

That must be the wrong plugin, its latest release is grails-scaffolding v2.1.2 from 2014.

But gradle dependencies reveals another scaffolding plugin:
+--- org.grails.plugins:scaffolding: -> 3.3.2
That might be the following: https://github.com/grails3-plugins/scaffolding

There I found another issue with the same problem:
grails/scaffolding#24
It's 1.5 years old, without any comment or fix...

IMHO its quite a huge bug if the standard validation of a domain class does not work properly and should not be ignored for more than a year (plugin or not).

@jeffscottbrown
Copy link
Member

That must be the wrong plugin, its latest release is grails-scaffolding v2.1.2 from 2014.

You are correct. I copied the wrong url. Use https://github.com/grails3-plugins/scaffolding/issues

@jeffscottbrown
Copy link
Member

Closing as this is already being tracked at grails/scaffolding#24.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants