Hi
I created an CSS, attached it to a template which is attached to a project. Now I try:
var msg_ctrl = controls.MSG_PW;
msg_ctrl.setCssClass('error');
if (fields.PASSW_CURRENT.value != 'test') msg_ctrl.addErrorMessage("Wrong!", true);
But the css style is not shown. I cleared the inline style, but still no luck. What am I missing. When I code the style inside the inline style dialog it is working correcttly.
.error {
color: #D8000C;
background-color: #FFBABA;
}
Am I missing something?
css attach to control
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 118
- Joined: Tue Oct 23, 2012 7:01 am
- Location: The Netherlands
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
You should be able to use the errorMsgClass property on a Message Control like this, but I couldn't get it to work:
However, it works if you set the properties individually like this and don't bother with a class:
Regards
Jon
Code: Select all
msg_ctrl.errorMsgClass = "error";
Code: Select all
msg_ctrl.errorMessageStyle.textColor = "#D8D8D8";
msg_ctrl.errorMessageStyle.backgroundColor = "#FFBABA";
Jon
0 x
-
- Ebase User
- Posts: 118
- Joined: Tue Oct 23, 2012 7:01 am
- Location: The Netherlands
Hi Jon,
is this a bug then? What I want to do is a centralized function to handle all messages where type is the classname:
function showMessage(msg,type,stop)
{
var msg_ctrl = controls.MSG;
msg_ctrl.setCssClass(type);
msg_ctrl.addErrorMessage(msg, stop);
}
It would be great if it should work as intended; that way all messagetypes (info, validation, succes, error, warning) could be handled. Of course as a workaround I could use an if or switch statment in the function and set the properties individually, but it isn't as 'nice'
The strange thing is that when I point the advanced properties of the styling assistant to all classes only ONE class (error) is shown no matter what value the type parameter of the above function is.
is this a bug then? What I want to do is a centralized function to handle all messages where type is the classname:
function showMessage(msg,type,stop)
{
var msg_ctrl = controls.MSG;
msg_ctrl.setCssClass(type);
msg_ctrl.addErrorMessage(msg, stop);
}
It would be great if it should work as intended; that way all messagetypes (info, validation, succes, error, warning) could be handled. Of course as a workaround I could use an if or switch statment in the function and set the properties individually, but it isn't as 'nice'
The strange thing is that when I point the advanced properties of the styling assistant to all classes only ONE class (error) is shown no matter what value the type parameter of the above function is.
0 x
Kind regards,
Harry
Harry
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Harry,
My reply yesterday was wrong - everything is working as intended.
You can't use the cssClass or setCssClass() method for a message control. This is because the message control doesn't output this class. See the documentation on message control for the details: Index > Controls > Message Control.
Instead you have to use the errorMsgClass or setErrorMsgClass() and warningMsgClass or setWarningClass(). These work fine. You can achieve what you want, but you will need to check the message type and set the appropriate property.
Regards
Jon
My reply yesterday was wrong - everything is working as intended.
You can't use the cssClass or setCssClass() method for a message control. This is because the message control doesn't output this class. See the documentation on message control for the details: Index > Controls > Message Control.
Instead you have to use the errorMsgClass or setErrorMsgClass() and warningMsgClass or setWarningClass(). These work fine. You can achieve what you want, but you will need to check the message type and set the appropriate property.
Regards
Jon
0 x
-
- Ebase User
- Posts: 118
- Joined: Tue Oct 23, 2012 7:01 am
- Location: The Netherlands
Who is online
Users browsing this forum: No registered users and 10 guests