ApiAction Bind Exception

LabKey Support Forum (Inactive)
ApiAction Bind Exception bront  2014-11-09 07:59
Status: Closed
 
hi,

I am working on a custom module, and I'm having an issue.

When I post a form with a blank field, I get a bind exception error. If the field is populated, however, there is no error, but since the field in question is non-required, I need to be able to post a blank field.

The error is thrown at line 155 in ApiAction…

" //if we had binding or validation errors,
 //return them without calling execute."

The exception reads:

org.labkey.api.action.NullSafeBindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'form' on field 'confirmationNumber': rejected value [];

How can I get around this and set up the code to accept a posted blank field?

Many thanks,

bront
 
 
adam responded:  2014-11-09 10:05
In your form, what type is "confirmationNumber"? I.e., what does getConfirmationNumber() return and setConfirmationNumber() take? If you're posting blank values then I believe these will need to be nullable... Integer or Long, as opposed to int or long.

Adam
 
bront responded:  2014-11-10 07:57
Adam,

That's it. Couldn't see it yesterday…

Many thanks,

b
 
bront responded:  2014-11-10 07:57