asp.net FCKeditor custom non null validation

  • 2020-05-07 19:27:24
  • OfStack

It needs to be submitted twice to be approved. The solution is to disable client-side script validation for the RequiredFieldValidator control. Verify only on the server side.
 
<asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server" ControlToValidate="fck" Display="Dynamic" EnableClientScript="False" ErrorMessage=" It hasn't been filled in yet "></asp:RequiredFieldValidator> 

Today, while looking for information, I came across a new solution. The above bug can be resolved using the CustomValidator control using the methods provided by FCK. Use js on the client side for non-null validation of FCK.
code
 
//Fck Validation is not empty  
var oEditer; 
function FckValidate(source, arguments) 
{ 
var value = oEditer.GetXHTML(true); 
if($.trim(value) == '') 
{ 
arguments.IsValid = false; 
} 
else 
{ 
arguments.IsValid = true; 
} 
} 
function FCKeditor_OnComplete(editorInstance) 
{ 
oEditer = editorInstance; 
} 

 
<asp:CustomValidator ID="CustomValidator1" runat="server" Display="Dynamic" ErrorMessage=" Not to fill out " ClientValidationFunction="validTitle" OnServerValidate="ValidFck" ControlToValidate="fck"></asp:CustomValidator> 

Related articles: