Freedom UI validators

Hi everyone,


Have you already succeed in using Freedom UI custom validators, the academy article was not very successful to me.


Best regards,

Like 0



Hi Jerome,

They are working for me. One thing I did initially was add it to the control in the viewConfigDiff. You're actually supposed to add the validator to the attribute in the viewModelConfig - not to the control in the diff. Once I moved it there it worked. Your column is likely in the viewModelConfig already (if it's been added to the page). Look for it there and just add the validator to that existing attribute in the model.


Thanks Ryan,


I managed to step into my validator, but there's no way to retrieve some values (since request is not defined).


Best regards,

Jerome BERGES,

Hmm. Not sure about that. I've only used validators where I need the control's value only (which is provided in the params passed in). I had assumed you could pass in other values in the validator params, but that doesn't seem to be the case (or at least I can't figure out how that works). Hopefully we'll see more documentation soon.


Joaquin Eztala,


Currently, the R&D team is working on such task, they plan to create a solution in the next releases. You can try to workaround in this way:
On the field's change add a custom handler, set a flag in it, look at this global flag (atribute's value) in the validator.

Most likely to validate "if end date it's not before the begin date" you can use in handler await request.$context.DateTimeAttribute_nnnn

Where DateTimeAttribute_nnnn:

	"attributes": {				
	"DateTimeAttribute_nnnn": {
		"modelConfig": {
"validators": {
			"StartDateIsNotNotLessThanProjectStartDate": {
				"type": "dw.StartDateIsNotNotLessThanProjectStartDate",
				"params": {
					"message": "#ResourceString(StartDateIsNotNotLessThanProjectStartDateMessage)#",
           "StartDateIsNotNotMoreThanProjectDueDate" ...






A quick question if I may, how do you create a global flag in a client module and how do you look at it in a validator function.  Thanks,


edit: I used session storage in the end.

Gareth Osler,

By the phrase "global flag" I meant the attribute value.
This method hasn't been tested, and I can't give you a guarantee of stable work. 

We're still waiting for the out-of-the-box realization and will post the article with updates on the Academy.

Show all comments