Weird code

Weird code

by Frank Erazo -
Number of replies: 7

Moodle version 2.8.

I'm not sure where to begin with this one...this is a custom module.  It's basically a user's history.  Since we use our Moodle instance for staff development, we have to track their progress and ensure they do not repeat courses. 

The report is functioning normally, but when we try to print the document, all this weird code appears on one page.  Initially, I thought I had accidentally left debugging on, but I verified it's off, and I turned off the option to have messages displayed. 

I have attached a PDF of the code that appears.  Please let me know where I need to go to correct this.  Thank you.

Average of ratings: -
In reply to Frank Erazo

Re: Weird code

by James McLean -

Can you please post a screenshot of the code that appears in the PDF, rather than the PDF itself? Adding PDFs and expecting people to click and open them is bad practice - due to the many many many security vulnerabilities in Adobe PDF products.


Average of ratings: Useful (1)
In reply to James McLean

Re: Weird code

by Frank Erazo -

James:

My apologies.  I was having some trouble uploading one that was under the 500K limit.  Here's a screen capture of the problem. 

In my initial post, I mentioned that it is a custom report, but I failed to mention I am the developer.

Attachment Screen Shot 2016-01-15 at 8.30.11 AM.png
In reply to Frank Erazo

Re: Weird code

by Chris Wharton -

It looks as if the PDF is trying to output the actual HTML & Javascript verbatim, rather than interpreting it and outputting the correct data.

Your plugin developer needs to fix this.

In reply to Chris Wharton

Re: Weird code

by Frank Erazo -

Chris:

Yep.  That would be me - ha ha.  Any thoughts on where to begin?

In reply to Frank Erazo

Re: Weird code

by Frank Erazo -

Thinking this may be browser related, I tried it on Chrome.  The code appears even in the print preview.

This report was functioning on a previous Moodle instance, but it was version 2.4.  Only after I installed the report on the 2.8 version did this start happening. 


Attachment Screen Shot 2016-01-15 at 8.57.31 AM.png
In reply to Frank Erazo

Re: Weird code

by Frank Erazo -

UPDATE!

I believe I have finally narrowed where the problem is coming from.  In my report, I have a form.  The same type of form is being used on another Moodle instance but without these issues.  The difference between the two is this one is using a text box.  My text box has rules, and when I comment out the rules, all that script goes away. 

Please see attached.  I'm guessing the rules may have changed from 2.4 to 2.8.  

All the rules need to be commented out.  If I leave even one, the script comes back. 

Attachment Screen Shot 2016-01-15 at 9.19.51 AM.png
In reply to Frank Erazo

Re: Weird code

by Frank Erazo -

SOLUTION!

Some parameters simply had to be removed for the rules.  Once they were removed and updated, everything worked.

See the attached screenshot for the solution. 


Attachment Screen Shot 2016-01-15 at 11.19.02 AM.png