Skip to main content
1-Visitor
April 19, 2018
Solved

using statusmessage widget to show user notification

  • April 19, 2018
  • 4 replies
  • 3532 views

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

Best answer by mnarang

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 .

4 replies

mnarang5-Regular MemberAnswer
5-Regular Member
April 19, 2018

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 .

amittal-31-VisitorAuthor
1-Visitor
April 19, 2018

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