chamilo-lms icon indicating copy to clipboard operation
chamilo-lms copied to clipboard

Announcements: possible to send empty title and body

Open jderriks opened this issue 9 years ago • 8 comments

Current behavior / Resultado actual / Résultat actuel

Empty-title announcements can be sent. That is undesired because you cannot click the message anymore.

Expected behavior / Resultado esperado / Résultat attendu

In older versions Chamilo used to check on empty title and refude to send. That is still the expected bahaviour.

Steps to reproduce / Pasos para reproducir / Étapes pour reproduire

click create announcement icon and hit "send announcement" without entering anyting

Chamilo Version / Versión de Chamilo / Version de Chamilo

1.11.4 (git pull 24-4-2017)

afbeelding

jderriks avatar Apr 24 '17 21:04 jderriks

I've made a fix for that bug. #1890 image

(cc @moy)

sjcqs avatar Apr 27 '17 18:04 sjcqs

Very good! Maybe add the rule on the body also: $form->addRule('content', get_lang('ThisFieldIsRequired'), 'required');

Just to prevent people forgetting entering a message.

jderriks avatar Apr 28 '17 10:04 jderriks

@jderriks Maybe instead of making the body field required it would be preferable to print a warning message ? Like when you are sending a empty mail in most of mails boxes (Gmail, etc).

sjcqs avatar Apr 28 '17 14:04 sjcqs

Sure, go ahead. It's more code.

jderriks avatar Apr 29 '17 12:04 jderriks

I tried using some javascript on the validating butting but I didn't find a way to access the html editor text of content. They must be a way since 'required' verify if a field is filled. Does anyone know where it is defined ?

sjcqs avatar May 01 '17 14:05 sjcqs

Content is set by: $form->addHtmlEditor( 'content',

jderriks avatar May 02 '17 17:05 jderriks

I just added a fix for the announcement description.

jmontoyaa avatar May 03 '17 06:05 jmontoyaa

Works.

jderriks avatar May 12 '17 18:05 jderriks