cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

using statusmessage widget to show user notification

amittal-3
13-Aquamarine

using statusmessage widget to show user notification

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

1 ACCEPTED SOLUTION

Accepted Solutions
mnarang
17-Peridot
(To:amittal-3)

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 .

View solution in original post

4 REPLIES 4
mnarang
17-Peridot
(To:amittal-3)

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-3
13-Aquamarine
(To:mnarang)

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

fwertt
5-Regular Member
(To:mnarang)

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

amittal-3
13-Aquamarine
(To:fwertt)

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

Top Tags