2

I am using moodle 2.8

I have added some css code in course/edit.php to hide some form fields on for trainer/student role.

But when I submit form from trainer account showing alert message like

"This page should automatically redirect. If nothing is happening please use the continue link below."

and show "Continue" link.

I guessed, reason may be adding css in php script. but just I want to hide that message so my form should be submitted directly like admin area.

user1530848
  • 57
  • 2
  • 8
Pravin
  • 37
  • 1
  • 12

1 Answers1

1

In almost every case, this error is because there is some extra output on the page that should not be there.

Usually it is caused by extra spaces before the opening '< ?php' tag in a file or incorrectly including a closing '?>' tag at the end of the file, followed by whitespace.

In this case, it may well be related to adding output to the wrong part of the page, by adding CSS to edit.php. If you want extra CSS on the page you should add it to the theme, or you may be able to add it via the theme settings. Note that every page has unique classes added to the 'body' tag, so you can use that to write CSS that only applies to a single page in Moodle.

davosmith
  • 6,037
  • 2
  • 14
  • 23
  • Thanks.Now I am using PHP heredoc variable to store CSS and simply echo that variable for non admin still showing same message. Basically I want to make changes in CSS for non admin only so could I perform such task using CSS? – Pravin Oct 05 '16 at 03:46
  • Not very easily. It sounds like the problem is that you are outputting the CSS in the wrong place on the page. You could try $PAGE->requires->css as a better way of adding it to that page. – davosmith Oct 05 '16 at 06:22
  • But where I need to place my css code in that script if I add $PAGE->requires->css in that script – Pravin Oct 05 '16 at 06:57