1
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

2
skalpa
Re: XoopsFormElement with no name causes warnings.
  • 2003/11/27 1:34

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


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


I would even say quite correct, as not everybody gives (or is able to) give the fix with the bug

Thanks a lot. The 2.1 release will have a new form framework, but I'll add your fix to the 2.0.x branch.

Skalpa.>

3
mvandam
Re: XoopsFormElement with no name causes warnings.
  • 2003/11/27 1:41

  • mvandam

  • Quite a regular

  • Posts: 253

  • Since: 2003/2/7 2


Our traditional bug posting place is on sourceforge:

http://sourceforge.net/tracker/?atid=430840&group_id=41586&func=browse

So just a question for the other devs... Has this changed? It seems a lot of the devs are actively reading the bug reports forum now, so maybe SF is no longer being used?

4
skalpa
Re: XoopsFormElement with no name causes warnings.
  • 2003/11/27 2:06

  • skalpa

  • Quite a regular

  • Posts: 300

  • Since: 2003/4/16


Quote:
So just a question for the other devs... Has this changed? It seems a lot of the devs are actively reading the bug reports forum now, so maybe SF is no longer being used?


Well, it hasn't really changed, but as people tend to report things here I'm checking the forums more often than SF.
Also, the modules team members don't have access to the SF project yet, so the sf tools haven't been overly used lately.

Skalpa.>

Login

Who's Online

210 user(s) are online (84 user(s) are browsing Support Forums)


Members: 0


Guests: 210


more...

Donat-O-Meter

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

Latest GitHub Commits