Expand my Community achievements bar.

SOLVED

Empty error message prompt

Avatar

Former Community Member

I am trying to use the validate function to validate the length of the input in richtext field. However, upon validate failure, there is an empty message prompt layer appearing above my custom message prompt. Can anyone advise what am i missing here?

[img]image.JPG[/img]

[img]image2.JPG[/img]

code:

function()
{    
    if(this.el.dom.value.length > this.maxLength)
    {     
        
        CQ.Ext.Msg.show({"title":"", "msg":"Maximum characters is 500."}).setIcon(CQ.Ext.Msg.WARNING);
        return false;        
    }
    return true;
}

1 Accepted Solution

Avatar

Correct answer by
Level 10
2 Replies

Avatar

Correct answer by
Level 10

Take a look at this community article:

http://learncq.blogspot.ca/2012/06/how-to-create-ok-cancel-alert-prompt-in.html

Hope this helps. 

Avatar

Former Community Member

Hi, thanks for your reply but it didn't work. I replaced my existing code with just CQ.Ext.Msg.alert('Error', 'Maximum characters is 500.'); because alert prompt is all i need. However, there is this blank alert prompt overlaying my custom alert prompt upon returning false. Even if i removed my code for the alert prompt, the empty alert prompt will still appear. Are there any properties i should be setting to get my error message appear on that empty prompt instead of creating a custom alert prompt? I've tried to set invalidText but it didn't solve the problem.

Thanks in advance.

[img]2015-04-14_9-45-22.jpg[/img]

xtype:richtext

validate:function()
{
    var text = this.el.dom.value; 
    
    if(this.el.dom.value.length > this.maxLength)
    {     
        
        CQ.Ext.Msg.alert('Error', 'Maximum characters is 500.');
        return false;        
    }
    return true;
}