Questions tagged [command-objects]

Command Objects are a feature of the Grails web framework, refering to special classes that declare constraints used to validate its instances.

Resources

Official docs

Related tags:

90 questions
0
votes
1 answer

Grails command object not validating

I'm sure this is a total noob question and I'm missing a blatant error, but here goes anyway. I have a command object: public class LeadCommand { Integer OwnerId String FirstName String LastName String Email String Phone1 …
matmer
  • 621
  • 2
  • 5
  • 14
0
votes
1 answer

groovy, grails: high level questions on extraneous properties and command objects / data binding

Just a few high-level, hopefully very quick questions: 1) If I have a class A with a single field x, is constructing it def A = new A(x:someVal, y:someVal) totally fine? 2) Related, is the following a good way to copy relevant parts of a command…
Ray
  • 5,885
  • 16
  • 61
  • 97
0
votes
0 answers

Grails Swagger - How to annotate command object as path parameter, not body

I'm trying to correctly annotate a method in one of my Grails controllers for swagger. It's a "GET" endpoint, to search for data using a number of different parameters. These parameters are defined in a command object which is the input to the…
Zorobay
  • 557
  • 1
  • 6
  • 23
0
votes
1 answer

Grails controller, Command Object explotion

In Grails controller actions, for validations, We use command objects. The problem is the number of CommandObject classes have exploded. def publish = { PublishCommand command -> if (command.hasErrors()) { return…
Karthick AK
  • 208
  • 2
  • 5
0
votes
1 answer

Grails - Command object, customized conditional validator

I would like to build a customized validator in my Command object, to make sure the field email address of a form will not be empty if the notifyMe checkbox is selected. Here is my latest attempt to implement it: email(blank: true, nullable: true,…
0
votes
1 answer

Grails 3: Disable database binding for incoming data

In Grails If I have a Command object such as class MyCommand { MyObject object; } If the incoming request data has an ID value for object then when the Grails data binding occurs my command object is actually populated with a instance of the…
Raymond Holguin
  • 1,050
  • 2
  • 12
  • 35
0
votes
1 answer

in vb.net error Command text was not set for the command object

I have a program in vb.net where I need data inserted into the database. When I run this code I get an error: Command text was not set for the command object Here is the code I have: Private Sub InsertRelease(strRelease As String, rowInserted As…
N West
  • 1
  • 4
0
votes
1 answer

Grails command object not binding to 'def' type

Having issues trying to bind a param to a command object field defined as 'def'. I have the following command object: package command import grails.validation.Validateable @Validateable class TestBindCommand { String fieldType def…
0
votes
0 answers

Commands Out of Sync, Can't Work Out Correct Order Of Code

I am getting the following error message from my code: "Uncaught mysqli_sql_exception: Commands out of sync; you can't run this command now ". I know what this means from similar questions on this site how ever what I am trying to do is quite simple…
0
votes
1 answer

Execute a stored procedure multiple times in the same connection

Is this even possible with the command object? I need to change this piece or code to run a proc (sp_insertRecord) multiple times for the set of Parameters (created from the Records List object) in the same connection based. Right now it creates…
0
votes
2 answers

Grails use Command Object and object in the same gsp

I have a controller, edit method paint the user info in the form file. But when I try to update with errors the command object return userCommand object so I lost all info from user object. Is there any way to use both in the same form? or what I'm…
Adrian Rodriguez
  • 452
  • 4
  • 19
0
votes
3 answers

how to bind list of ids to command object in grails?

Let's say when you submit a form it sends a list of ids.
At the controller side def process(EmailCommand cmd){ …
kofhearts
  • 3,607
  • 8
  • 46
  • 79
0
votes
2 answers

Validate nested domain class instance in command object

I try to validate a nested domain class instance on a command object. Having the following command object package demo import grails.databinding.BindingFormat class SaveEventCommand { @BindingFormat('yyyy-MM-dd') Date date …
Mario
  • 4,784
  • 3
  • 34
  • 50
0
votes
2 answers

Grails Controller Action Abstract Command Object Parameter

Is there any support for using abstract command objects in controller action parameters? Then depending on the given parameters in a JSON request it would select the correct command object? For example something like: class SomeController { def…
dvisco
  • 461
  • 5
  • 12
0
votes
2 answers

Grails. Testing command objects with spring beans inside

I have a command object with constraints using spring beans in custom validator: class UserPasswordCommand { String currentPassword //other fields.... static constraints = { currentPassword validator: { currPass, upc -> …
Anton Hlinisty
  • 1,441
  • 1
  • 20
  • 35