Extension talk:Simple Forms

Latest comment: 7 years ago by Tlroche in topic What is the "alternative solution"?
Archived: 2007 2008

2016

edit

What is the "alternative solution"?

edit

As of 5 Nov 2016, the page header (warning) states that

An alternative solution is now being adopted on our wikis

Is that "alternative solution" the same as that described at Extension:Page Forms? If so, IMHO that should be stated (and linked). Tlroche (talk) 22:15, 5 November 2016 (UTC)Reply

2013

edit

Very UGLY code + refactored version

edit

VitaliyFilippov (talk) 10:18, 21 January 2013 (UTC)Reply

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)Reply


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 — 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 {{#form: .... }}. In this version of SimpleForms, you must use {{#form:}} ... {{#formend:}}. It also breaks the submit/preview buttons on the edit-page. Looks much better, but still needs a little work.
--Daniel Renfro talk/email 20:47, 18 March 2013 (UTC)Reply
The page does state that the extension is no longer under active development, it's totally obsolete and shouldn't be used at all. --Nad (talk) 14:11, 29 April 2013 (UTC)Reply

2009

edit
edit

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:

{{#input: type=ajax|format=link|update=myDiv|title=site1|one}} | {{#input:type=ajax|format=link|update=myDiv|title=site2|two}} | {{#input:type=ajax|format=link|update=myDiv|title=site3|three}}

--193.29.115.50 14:45, 28 October 2008 (UTC)Reply

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)Reply

Can't get it to run. Please help!

edit

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)Reply

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

edit

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 <DIV> 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 http://www.w3schools.com/PHP/php_ajax_database.asp for more on AJAX and MySQL.. and/or digit in google "AJAX MySQL PHP example"..
Bilardi 15:27, 29 September 2009 (UTC)Reply
I think it's worth pointing out the above link has a significant security vulnerability.
Please do not use or link to W3Schools; W3Schools is not affiliated with the W3C, it is a Norwegian company dedicated mostly to selling "certificates" of dubious veracity.--CoJaBo (talk) 16:00, 26 May 2013 (UTC)Reply

PHP Warnings in Apache errors.log

edit

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)Reply
Hi, we are running SimpleForms 0.4.11, with the following configuration:
Software Version
Apache 2.2.13
Mediawiki 1.15
MySQL 5.1.39
PHP 5.3.0
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)Reply
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:

include( "$IP/extensions/SimpleForms/SimpleForms.php" ); 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

edit

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)Reply

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)Reply

Doesn't work on MW 1.18.0

edit

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)Reply

A more complete solution is to create a SimpleForms.i18n.php file containing:
<?php
$messages = array();
$messages['en'] = array(
			'sf_editsummary' => '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)Reply

Content = {{Template|var=xxx}} doesnt work

edit

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 <div> 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 {{TemplateName|var=x}}} the template is not drawn 2 - Once I click to load the content in <div> 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:
{{#form:}}
{{#input:type=hidden|name=templates|value=update}}
{{#input:type=hidden|name=content|value={{Tree|brandname=xxx}}}}
{{#input:type=checkbox|name=type|checked=checked}} Type
{{#input:type=checkbox|name=origin|checked=checked}} Origin
{{#input: type = ajax | value = Update Tree! | update = listcat-result}}
{{#formend:}}
|
<div id="listcat-result">Waiting update</div>
|

insertNewAricle was deprecated and deleted in MW 1.19.1-1 (debian stable package)

edit

After an update to the latest MW the extension did not create new articles anymore. An apache log stated:

PHP Fatal error: Inaccessible function via __call(): insertNewArticle in /usr/share/mediawiki/includes/Article.php on line 1785

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

A possible fix:

edit

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:

$article = new WikiPage($title); instead of $article = new Article($title);

Then you call doEdit e.g.:

$article->doEdit($content,$summary ? $summary : wfMsg('sf_editsummary','created'));

instead of

$article->insertNewArticle($content,$summary ? $summary : wfMsg('sf_editsummary','created'),false,false);

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

See documentation for detailed call arguments

For 1.20, you should also change:

$update = $this->updateTemplates($article->getContent(),$content);

into:

$update = $this->updateTemplates($article->getText(),$content);

This extension is obsolete and no longer under development. --Nad (talk) 16:20, 3 May 2013 (UTC)Reply

ArticleAfterFetchContent problem with MW 1.21

edit

This extension makes use of the ArticleAfterFetchContent hook, which is deprecated from MW version 1.21, and apparently it doesn't work correctly even though it is still present in the MW code and no error messages are triggered when it is invoked.

I replaced the ArticleAfterFetchContent hook with the ParserBeforeStrip hook, i.e.,:

$wgHooks['ArticleAfterFetchContent'][] = 'wfSimpleFormsUntitledContent';

to

$wgHooks['ParserBeforeStrip'][] = 'wfSimpleFormsUntitledContent';

This solved the problem, at least within my specific context. --82.57.173.232 09:37, 31 August 2013 (UTC)Reply

Return to "Simple Forms" page.