Extension talk:Simple Forms

=2013=

Very UGLY code + refactored version
VitaliyFilippov (talk) 10:18, 21 January 2013 (UTC)

This extension is a bunch of VERY UGLY hacks and has various potential security problems.

But the idea of page creation via form+template is good. So I want to present my own version of this extension in https://github.com/mediawiki4intranet/SimpleForms - most hacks are removed there.

The documentation will be there soon...


 * Thanks for that. --79.232.57.153 21:18, 8 February 2013 (UTC)


 * After a brief look at the insides of SimpleForms, I think the author was simply following conventions. I wouldn't go so far as to say the code is ugly (especially not UGLY in all caps,) things have changes in the last 5+ revisions of the software. I think taking a historical perspective is much better than blatantly judging other's code &mdash; what will your code look like in 3-4 years?
 * By the way, your extension is not fully backward compatable: it does not support using a single parser function to enclose the form in . In this version of SimpleForms, you must use  . It also breaks the submit/preview buttons on the edit-page. Looks much better, but still needs a little work.
 * --Daniel Renfro talk/ [mailto:bluecurio@gmail.com email] 20:47, 18 March 2013 (UTC)

=2009=

Multiple ajax links in one line
I tried to create multiple ajax links in one line, but there are always paragraphs between every link. How can I fix it? my code: | | --193.29.115.50 14:45, 28 October 2008 (UTC)


 * Change in SimpleForms.php entries with

return array($form, 'noparse' => true, 'isHTML' => true); to return $parser->insertStripItem( $form, $parser->mStripState );

and entries with return array($input,'noparse' => true, 'isHTML' => true); to return $parser->insertStripItem( $input, $parser->mStripState ); Cirne 19:09, 11 September 2009 (UTC)

Can't get it to run. Please help!
After install, when I run the script I get:

Warning: Cannot modify header information - headers already sent by (output started at wiki/extensions/SimpleForms.php:1) in wiki/includes/WebResponse.php on line 10

I am using the current version of MediaWiki. 68.56.108.134 17:56, 6 February 2009 (UTC)


 * I changed the permissions on the file to 777. Now I get:

Parse error: syntax error, unexpected T_VARIABLE in wiki/LocalSettings.php on line 160

Query external Database
I use SimpleForms to access some external databases. Currently I am calling some PHP scripts to query MySQL, and show the results on a pop-up new window (target=new). I know nothing about AJAX. I just want to learn how I can dynamically update the wikipage with the query results. Such as putting the results in a specific  without reloading the page. How can I redirect the outputs? Should I write some Javascript to make it happened? Thx!
 * I think that you could consult w3schools.com for more on AJAX and MySQL.. and/or digit in google "AJAX MySQL PHP example"..
 * Bilardi 15:27, 29 September 2009 (UTC)

PHP Warnings in Apache errors.log
Hi, SimpleForms is great, many thanks dude. However, since installing it, now any link I click on in our wiki creates the following warning in our apache erorlog which is cluttering it up a bit:

[Wed Oct 14 10:47:43 2009] [error] [client 192.168.34.133] PHP Warning: Parameter 1 to Language::getMagic expected to be a reference, value given in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\xenosWiki\\includes\\StubObject.php on line 58, referer: http://uklabvm13/xenosWiki/index.php?title=Special:AlfrescoSearch

Removing this from localsettings (i.e. disabling SimpleForms) resovles the isue but ofcourse defeats the point of having the extension:

include( "$IP/extensions/SimpleForms/SimpleForms.php" );
 * SufyaanK 10:53, 14 October 2009 (BST)


 * well, I have got any question.. which are your release about so, mediawiki and simpleform? did simpleform ever works whitout errors? which is it last extension or release that you installed? -- Bilardi 21:53, 14 October 2009 (UTC)


 * Hi, we are running SimpleForms 0.4.11, with the following configuration:


 * This is the first time we have used SimpleForms. Our wiki only printed these warnings in our log when we installed SimpleForms, if I disable it the warnings go away.. SufyaanK 11:35, 19 October 2009 (BST)


 * I'm using mediawiki 1.14.1 and 1.15.1 releases and SimpleForms 0.4.13 release.. and it works very well.. and, before I used 0.4.11 without errors.. but I'm using linux so. Your error log tell about custom special page that, maybe, is it work with SimpleForms? Do you paste me your form code? -- Bilardi 11:49, 19 October 2009 (UTC)


 * Hi, the problem is affecting any page, not only pages where I am using a form. What I am trying to say is that when I add this line in my localsettings:

then any page I visit in the wiki (even for example just going to the main page, or the Special Pages page, or Upload image page, i.e. all the core pages) I get this warning in my apache log. However if I comment out SimpleForms then accessing tese same pages does not give me an issue and I do not get the warning. The warning seems to me that my version of PHP (5.3.0) seems to be more strict interpretr and is saying you are using a "value" rather than a reference. This page here reports the exact same problem and also indicates it is a wrning introduced in the latest version of PHP

http://www.mail-archive.com/wikibugs-l@lists.wikimedia.org/msg22145.html and here Extension talk:CategoryTree

SufyaanK 10:11, 26 October 2009 (BST)


 * Hi, I solved this problem by following the instructions at: Extension talk:CategoryTree. Indeed this PHP version is more stricter than previous ones. SufyaanK 10:22, 26 October 2009 (BST)

Error on Page after installing Simple Forms on MW1.15
Just installed SimpleForms 0.4.13 on my MW1.15.1 with PHP 5.2.8 (apache2handler). Everything looks OK after the install. I have set $wgUseAjax = true. To test the installation I used the simple Ajax example given in the Extension write-up. I get Error on Page in the browser. I am using IE8. I turned on debug with F12 and the error occurs around the following line in the inputMagic function else { # Render the Ajax input as a form submit button $argv['type'] = 'button'; $element	 = 'input'; if (!isset($argv['onClick'])) $argv['onClick'] = ''; $argv['onClick'] .= "a = [];					f = document.getElementById('{$this->id}');					i = f.elements;

It would appear that the object f is not defined.

I have also tried the "Blog Post" example and the system behaves strangely too. It doesn't add the post but causes me to be redirected to the Main Page of the wiki. Very strange!

Hope someone can help, because this extension looks exactly what I am looking for.

-Brett.tyson 12:53, 29 November 2010


 * I have the same problem with SimpleForms 0.4.13 MW1.16 PHP5.3.0 Apache 2.2.11
 * Tracing it back it appears that 'f' is undefined because '$this->id' doesn't match to any existing id that I can see. I wish I knew more PHP. I wonder if SimpleForms 0.4.10.1 might work; it was intended to fix broken AJAX functionality...
 * The example does seems to work if AJAX is turned off type=ajax is replaced with type=submit.


 * --Ehatherley 21:56, 30 November 2010 (UTC)

Did some more work. Tried setting $wgUseAjax to false. Obviously the ajax bit didn't work. However noticed that the first example generates a URL with index.php?cat=category_name parameter. If I change the form to use "title" rather than "cat" I get a result. However when I use "cat" ?cat= is ignored. If I use "cat" I just get directed to the Main Page.

I am wondering if I need to do something so that index.php?cat=category_name will direct me to a list of articles in a category. Perhaps this is also why the '$this->id' is invalid.

Brett Tyson


 * corrected myself on ajax off vs. ajax replaced by submit above. sorry.
 * --Ehatherley 20:32, 1 December 2010 (UTC)

Doesn't work on MW 1.18.0
An error message appears after upgrading to MW 1.18.0. It seems related to $wgMessageCache that is deprecated from version 1.18.0. Apparently solved by commenting out the following lines of code:

# Add messages if ($wgLanguageCode == 'en') { $wgMessageCache->addMessages(array( 'sf_editsummary' => 'Article updated via HTTP request' ));       } I'm not sure whether side effects will show up, anyway at least the error message disappeared. --82.57.155.239 22:10, 25 December 2011 (UTC)


 * A more complete solution is to create a SimpleForms.i18n.php file containing:

 'Article updated via HTTP request', );


 * and then modify the SimpleForms.php file to load this file:

$wgExtensionMessagesFiles['SimpleForms'] = dirname(__FILE__) . '/SimpleForms.i18n.php';


 * Then you can delete the lines you commented out. Maiden taiwan 18:45, 3 January 2012 (UTC)

Content = doesnt work
After spending a lot of time working on the code I made Simple Forms work with mediawiki 1.17 Unfortunately I still face 2 issues I couldn´t fix:

I´m trying to make an Ajax call to update a on my page with content based on the parameters of a form 1 - When my content (in the hidden form input) is a call to a template as } the template is not drawn 2 - Once I click to load the content in a new page is created and another click on the button to call the Ajax method doesn´t update it ...

Code excerpt above:
 * border="0" cellspacing="1" cellpadding="1" style="width: 100%;"
 * - valign="top"
 * Configure tree levels:

Type Origin

Waiting update

insertNewAricle was deprecated and deleted in MW 1.19.1-1 (debian stable package)
After an update to the latest MW the extension did not create new articles anymore. An apache log stated:

The Article class has no more method which could be called by the __call function.

A possible fix:
The new MW implementation provides the WikiPage class which has a method doEdit which basically does the same as insertNewArticle. To use this just instatiate an Instance of WikiPage instead of Article:

instead of

Then you call doEdit e.g.:

instead of

This change must be adapted in each function where insertNewArticle or updateArticle is called.

See documentation for detailed call arguments