Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hello,
I have a datetimepicker for selecting the "start date" and another datetimepicker for "end date" on my mashup.
Now I would like to make a validation that "start date" cannot be greater than "end date" and if user selects "start date" which is greater than "end date" I should be able to show a popup message reflecting the error.
To show the popup, I understood that I can use "statusmessage" widget. But I am not able to understand the philosophy to use that widget. "statusmessage" widget uses a bindable service "show message", which I think can only be bound to events. So how do I fulfil this requirement.
I am not able to find enough details/tutorials on using "statusmessage" widget. Please suggest.
Thanks and Regards
Aditya Mittal
Solved! Go to Solution.
You can create a service for validation which can be executed on a button click .The service will take input as your start date and end date and write logic which will return a flag (integer/number ) .So if the condition is true flag will be 1 and if it is false flag will be 2 .Now take output of this service to validator widget ,add a parameter in validator by clicking on validator widget -> configure parameter .Add a paramter of same data type as it is returning from the service .Map the service output (flag) to this validator parameter and in expression property of validator you can write something like if(flag==2){output=true;}else{output=false;} .Now map the true event to status message show message service and write your message in status message "message" property .So After the service execution validation flag value will be returned to validator widget and it will give a true event out of the expression which can be used to show relevant validation message through status message widget .
You can create a service for validation which can be executed on a button click .The service will take input as your start date and end date and write logic which will return a flag (integer/number ) .So if the condition is true flag will be 1 and if it is false flag will be 2 .Now take output of this service to validator widget ,add a parameter in validator by clicking on validator widget -> configure parameter .Add a paramter of same data type as it is returning from the service .Map the service output (flag) to this validator parameter and in expression property of validator you can write something like if(flag==2){output=true;}else{output=false;} .Now map the true event to status message show message service and write your message in status message "message" property .So After the service execution validation flag value will be returned to validator widget and it will give a true event out of the expression which can be used to show relevant validation message through status message widget .
Hello,
Thanks for your reply. I got hint from your solution, although I didn't followed all of it, but yes your idea works!!!
Thanks a ton again. I'll mark it as solution.
Regards
Aditya
Man can you help me with some similar thing..
I have a Property display with some fields to fill. One in specific calls FieldName.
I put a Validator to validate with a parameter called FieldName that the user just fill it with sometext like "Action Code" no "actioncode" or something diffrent.
If is valid add to my table, if isnt, appear a msge that I have already in the relationship.
I attatch the relationship, and my expresion is like this.
if(FieldName == "Action Code") {output: true;} { output: false;}
I saw that you give an answer of validators.
Can you help me please
Hello,
Could you try to modify your expression which you are using in your validator widget to -
if(FieldName === "Action Code") { result = true; } else { result = false; }
and also set the "AutoEvaluate" checkbox to true in the validator properties. See if it works.
Thanks
Aditya Mittal