I am stuck with this small problem, where I have 3 different textboxes on my home page, to show an alert message on all other pages. It is displaying my message nicely, but it displays the wrong color. It is like it takes the message correctly and then just takes the first statement from the if-statement. If you need more info, please just write!
@inherits umbraco.MacroEngines.DynamicNodeContext
@{ var alert = ""; var message = ""; var red = "warning"; var yellow = "error"; var green = "success"; var root = Model.AncestorOrSelf(1);
Does the warning textbox contains any value? if it does the match the first condition and won't validate the other conditions, so the alert variable contains the value red.
Any reason why you have three textboxes and not just a single one and have a switch block returning different values based on the value of the textbox? or use a dropdown with the values "Warning", "Error" and "Success"?
Alert code does not work, but why?
Hello guys!
I am stuck with this small problem, where I have 3 different textboxes on my home page, to show an alert message on all other pages. It is displaying my message nicely, but it displays the wrong color. It is like it takes the message correctly and then just takes the first statement from the if-statement. If you need more info, please just write!
Please help me!
Thank you. :-)
/Daniel
Hi Daniel
Does the warning textbox contains any value? if it does the match the first condition and won't validate the other conditions, so the alert variable contains the value red.
/Bjarne
Any reason why you have three textboxes and not just a single one and have a switch block returning different values based on the value of the textbox? or use a dropdown with the values "Warning", "Error" and "Success"?
You are right. I will try the dropdown option in stead and return with the result. Thank you :-)
is working on a reply...