Show custom error message on validate property in dialog | Community
Skip to main content
Level 4
July 6, 2016

Show custom error message on validate property in dialog

  • July 6, 2016
  • 2 replies
  • 4219 views

Hi Team,

I am trying to show the custom message on dialog field if not valid using validate property.

validate   string (type)   function(){ var Value = this.getValue(); if(Value.length > 0){ this.markInvalid('Please enter correct value'); return false; } }

Still I am getting the default error message ."Verify the values of the marked field"

PFA

Thanks a lot in advance

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Tuhin_Ghosh
Level 8
July 6, 2016

Try the below one for custom error message.

CQ.Ext.Msg.show({
   title:'Save Changes?',
   msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',

icon: CQ.Ext.MessageBox.ERROR,
   buttons: CQ.Ext.Msg.ERROR,
 });

Thanks

Tuhin

Level 4
July 7, 2016

Hi ,

I tried this approach as well its not working, still I see the default message.

I think the problem in this dialog is included as cq:include in another dialog which might not allowing it ?

Thank you

Tuhin_Ghosh
Level 8
July 7, 2016

this below piece code works for me, last one had a typo, if you have copied and pasted that exactly then it might be of some problem.

 

if(Value.length > 0){ 
CQ.Ext.Msg.show({
                    title: 'markInvalid',
                    msg: 'The scheduled end date must be set after the scheduled start date.',
                    icon: CQ.Ext.MessageBox.ERROR,
                    buttons: CQ.Ext.Msg.OK
                });

return false; 
}

Lokesh_Shivalingaiah
Level 10
July 7, 2016

which xtype do you want to validate in the dialog ?

Level 4
July 7, 2016

datetime xtype