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?
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?
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' ));
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' ));