Dashboard widget settings not being saved
2.0-BETA1 built on Tue Jan 5 10:29:05 EST 2010
1) Firewall logs widget - changing "Number of lines to display" to a selection on the list box throws out an error
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/www/niftycssCode.css:16) in /usr/local/www/widgets/widgets/log.widget.php on line 44
However the setting is saved.
2) Traffic Graph widget - changing "Refresh Interval" to a selection on the list box does not save the desired update interval.
Appologies if I was meant to list these as 2 seperate bugs.
#1 Updated by Fred Taylor-Young about 10 years ago
I've played around with the PHP code for the widget and watched what it does in Firebug, and have noticed that despite its action attribute set to make the form submit to itself, the form is actually submitted to index.php.
<form action="/widgets/widgets/log.widget.php" method="post" name="iforma">
The widget still tries to run its header() code though, which is causing the error message you see:
All this behavior is caused by this line, which appears just after the <body> tag, and only ends just before the closing </body> tag:
<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <form action="index.php" method="post"> [...] </form> </body>
By coincidence, while playing around with the picture widget yesterday I noticed that it has a closing </form> tag before its own opening <form>, presumably to fix this problem.I've seen three ways of fixing this issue (although it's entirely possible that there may be other things that I've overlooked):
- End the first <form> tag much earlier in the page - I don't know if it needs to encompass most of the page or not, so this may not be an option
- Like the picture widget, add a </form> tag
- Remove the header() line - however, this will likely break the widget if the overall <form> tag is later fixed/ended before the widgets