Forums | Mahara Community

Support /
Line break in error message


Mark  Melia's profile picture
Posts: 8

18 November 2010, 3:17

Hi all,

I have created a new form in the files section - similar to that or the edit form. If the user forgets to populate a field I have successfully got it coming up with an error. If there are two error I would like each error to be on a line of its own, but <br> in my javascript seems to be made safe when written to the page as &lt;br&gt;. Does anyone know how to do this.

an excerpt of code is below [filebrowser.js]:

 if (!field1 || field.value == ''){
            message += '<br>'+get_string('field1isrequired');
        }
        if (message) {
            e.stop();
            replaceChildNodes(self.id + '_form_messages', makeMessage(message, 'error'));
            return false;
        }

Thanks,

Mark

1 result