41
amayer
XoopsFormElement with no name causes warnings.
  • 2003/11/26 23:15

  • amayer

  • Friend of XOOPS

  • Posts: 82

  • Since: 2003/10/18


If you create a XoopsFormElement with no name such as:

$f1_field = new XoopsFormText("""foo",15,15,$foo);


Then you get the following warning:

WarningUndefined property_name in /var/www/html/class/xoopsform/formelement.php on line 122

This is a warning from the method getName as below:

function getName($encode=true) {
                if (
false != $encode) {
                        return 
str_replace("&""&"str_replace("'","'",htmlspecialchars($this->_name)));
                }
                return 
$this->_name;
        }


When I am using form elements inside a tray then I often don't need a name displayed alongside the actual form field. So I suggest that the following code is amended so that it says:

function getName($encode=true) {
                if (!isset(
$this->_name)) {
                        return 
"";
                }
                if (
false != $encode) {
                        return 
str_replace("&""&"str_replace("'","'",htmlspecialchars($this->_name)));
                }
                return 
$this->_name;
        }


Does that sound reasonable?

Also, this is my first bug report. Is this the correct way to report things?

Cheers,

Andy Mayer




TopTop
« 1 2 3 4 (5)



Login

Who's Online

158 user(s) are online (116 user(s) are browsing Support Forums)


Members: 0


Guests: 158


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits