Home › Forums › Business Model › Classes › Validation of collection
Tagged: attribute validation
- This topic has 7 replies, 2 voices, and was last updated 3 years, 8 months ago by shahzad.qureshi.
-
AuthorPosts
-
-
March 14, 2021 at 9:07 pm #16334wyuParticipant
Hi Team,
I have some issue with validation of a collection which is the result of a multi picker. Validation condition is “not empty” for the picker field. The issue is when I remove all the items from the picker, validation kicks in and there is error showing on the top of the form but the field itself is not highlighted. See the attachment for detail.
Is there anything I missed or there is a limitation on how a collection attribute should be validated.
Thanks
0- This topic was modified 3 years, 8 months ago by wyu.
- This topic was modified 3 years, 8 months ago by wyu.
Attachments:
You must be logged in to view attached files. -
March 15, 2021 at 12:40 pm #16347shahzad.qureshiKeymaster
Hi Wen,
Before we can look into it, could you confirm how the validation is being done? I am assuming that its in the metadata side. Is it on the attribute itself or thru an event (which event)?
0 -
March 15, 2021 at 3:47 pm #16378shahzad.qureshiKeymaster
I may have misunderstood what you are trying to accomplish. Do you mean the red asterisk doesn’t appear? if not, could you show me a screenshot from a different screen that will show what you are trying to accomplish?
0-
March 15, 2021 at 10:33 pm #16390wyuParticipant
Hi Shahzad, I actually found the issue is not only related to collection attribute validation and the actual cause might be the fact I have some hidden attributes from the form which is validated on the model side which fails the validation and since the fields related to those hidden attributes. The overall error showing on top of the form might be coming from a hidden field.
After I figured out the possible causes, I changed the validation code for other hidden fields and it seems to be able to indicate the correct field for the validation failure.
0
-
-
March 15, 2021 at 4:06 pm #16384shahzad.qureshiKeymaster
You might be looking for (add-required-attr-exception) function.
; Adds a required attribute exception to the validation exception.
; @arg ve ValidationException The validation exception.
; @arg inst Object The Metaclass instance that has a validation exception.
; @arg attr Symbol The attribute that is required.
; @example
; (let ((ve ‘()))
;Â Â Â Â Â (when (null? (person’birthTime))
;Â Â Â Â Â Â Â Â (when (null? ve) (set! ve (create-validation-exception person)))
;Â Â Â Â Â Â Â Â (add-required-attr-exception ve person ‘birthTime)
;Â Â Â Â Â )
;Â Â Â (unless (null? ve) (throw ve))
; )
(define (add-required-attr-exception ve inst attr)0-
March 15, 2021 at 10:35 pm #16397wyuParticipant
I am not sure how this is different from just put some code to the validation part of the attribute.
0-
March 16, 2021 at 9:28 am #16406shahzad.qureshiKeymaster
Its not different. I was simply showing you a definition of a function that can be used. You can search for this function in the code and see how it is used.
0
-
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.