Question

How to passing a viewmodel value to other view model for making a validator

i want to pass a value of one of view model to another as a parameter for validator like this code below
"PDS_UsrPrice_5kkod23": {
                        "modelConfig": {
                            "path": "PDS.UsrPrice"
                        },
                        "validators": {
                            "MySuperValidator": {
                                "type": "usr.DGValidator",
                                "params": {
                                    "minValue": 0,
                                    "message": "#ResourceString(PriceCannotBeLess)#"
                                }
                            },
                         "MySecondValidator": {
                                "type": "usr.CommentValidator",
                                "params": {
                                    "minValue": 5000,
                                 "comment": "$PDS_UsrComment_tapvx6u",
                                    "message": "#ResourceString(CommentNeeded)#"
                                }
                            },
                        }
                    },
"PDS_UsrComment_tapvx6u": {
                        "modelConfig": {
                            "path": "PDS.UsrComment"
                        }
                    },
it is possible? 

Like 2

Like

3 comments

also can we add the system setting in javascript code? if can how to do that?

Hello Ghifari,

Can you please expand a little bit more on the business logic you are trying to achieve? I do not think that i fully understand the intend here. Also, i do not think that passing a value from a validator (?) is possible to another validator, but it depends on what you want to do. Please explain a bit more and i will try to help you.

Hello Yevhenii Grytsiuk, Thanks for the response i already solve the problem, i decided using a handler than validator so i can access the value in the page using request like this request.$context.PDS_UsrPrice_5kkod23 and also i already found how to use systemsetting in code using this method "Terrasoft.SysSettings.cachedSettings".
overall my problem is solved and thank you very much for your response

 

 

Show all comments