Validate new Thread to ensure there is text

We have seen a good number of threads that just contain images in our community. How can we validate new threads to ensure they also contain text?

Parents
  • all the validation will takes place for the editor body over here in  Forums - Create/Edit Post UI.js file , you can add some regex to validate if there was any text rather than images 

    	context.attachBodyChangeScript(saveButton.evolutionValidation('addCustomValidation', 'body', function()
    			{
    				var body = context.getBodyContent();
    				var beginningMatches = body.match(/\[quote((?:\s*)user=(?:\"|"|").*?(?:\"|"|"))?\]/g);
    				var endingMatches = body.match(/\[\/quote(?:\s*)\]/g);
    				if ((beginningMatches == null) != (endingMatches == null))
    					return false;
    
    				return body.length > 0 && ((beginningMatches == null && endingMatches == null) || beginningMatches.length == endingMatches.length);
    			},
    			context.bodyRequiredText, '#' + context.wrapperId + ' .field-item.post-body .field-item-validation'
    		));

Reply
  • all the validation will takes place for the editor body over here in  Forums - Create/Edit Post UI.js file , you can add some regex to validate if there was any text rather than images 

    	context.attachBodyChangeScript(saveButton.evolutionValidation('addCustomValidation', 'body', function()
    			{
    				var body = context.getBodyContent();
    				var beginningMatches = body.match(/\[quote((?:\s*)user=(?:\"|"|").*?(?:\"|"|"))?\]/g);
    				var endingMatches = body.match(/\[\/quote(?:\s*)\]/g);
    				if ((beginningMatches == null) != (endingMatches == null))
    					return false;
    
    				return body.length > 0 && ((beginningMatches == null && endingMatches == null) || beginningMatches.length == endingMatches.length);
    			},
    			context.bodyRequiredText, '#' + context.wrapperId + ' .field-item.post-body .field-item-validation'
    		));

Children
No Data