Extension talk:Page Forms

Edit With Form link results in Error 500 page
(My apologies for posting in the wrong place) I am attempting to migrate a wiki from one architecture to another (Windows to Linux). I copied over my mediawiki folder, and I exported and imported over the database with no problems. All of my pages come up with no problems. I can create new content using forms and templates. Everything seems to work except the "edit with form". Page categories have the "Have default form" property, and the tab shows up, but any time I click it on any page I'm trying to edit, I get a "HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request." I can edit the page directly, and manipulate the template data, but trying to edit with the form fails for every page. The "edit with form" functionality works as expected in the Windows server environment.

I have run a Semantic Mediawiki database "Data repair and upgrade".

I feel like I'm missing something obvious with it, but I really can't find it. I also suspect it is more Semantic Mediawiki related than Semantic Forms, but because thus far it only seems to affect the "edit with form" functionality, I'm starting here.


 * MediaWiki - 1.15.3
 * PHP - 5.3.2-1ubuntu4.7 (apache2handler)
 * MySQL - 5.1.41-3ubuntu12.10
 * Semantic Mediawiki - 1.5.0
 * Semantic Forms - 2.1.2

Versions of the scripts, because I copied them directly, are the same on both servers. The windows server is running PHP - 5.2.14(isapi) and MySQL 5.1.47-community.

Please let me know if you need anything more. Thank you! --Glitch25 20:23, 7 April 2011 (UTC)


 * I assume the problem is some Apache configuration. Does the problem happen only with "action=formedit" in the URL, or also for URLs that start with "Special:FormEdit" (i.e., when adding new pages)? Also, does it happen if you change the action in the URL to something random, like "action=blah"? Yaron Koren 21:10, 7 April 2011 (UTC)


 * The "Special:FormEdit" URL's work just fine. As I say, I can add new pages with forms just fine.  I just can't edit them with the form once they are created.  If I change the action to something random, I get the "No such acton" page. And yes, I moved from IIS/6.0 to Apache 2.2.14. --Glitch25 21:34, 7 April 2011 (UTC)


 * Do you have a custom skin? If so, try it with one of the regular skins. Also, did you make any relevant changes to the Apache configuration? Yaron Koren 21:54, 7 April 2011 (UTC)


 * No custom skins. Everything is default.  The apache configuration is default as is installed by the Ubuntu package.  I can certainly try installing it manually, but I wanted to rule out any other easier possibilities  --Glitch25 22:05, 7 April 2011 (UTC)


 * Okay, I no longer think this is an Apache issue. Now I think the issue is somehow coming from Semantic Forms. If you're willing - could you try creating a very simple "class", using Special:CreateClass, with just one or two fields, create a page with that new form, and see if that problem still happens? I think the issue might be an infinite loop of categories, or something like that. Yaron Koren 22:43, 7 April 2011 (UTC)


 * Ok. I used the Special:CreateClass, included two fields, used the form to create a new page, and from that page, the "edit with form" link results in the same Error 500.  --Glitch25 16:28, 8 April 2011 (UTC)

I don't know, then - I'm out of ideas. I'd suggest writing to the SMW mailing list about it - it could be that someone else has experienced this same problem. Yaron Koren 20:03, 8 April 2011 (UTC)


 * I'll see what i can do. I just tried a clean install on a new virtual server with no existing data.  I built the class page, created a new page, and still have the failure.  Not entirely sure what that tells me, but it gives me a few things to try.  Thank you for your help! --Glitch25 21:34, 8 April 2011 (UTC)


 * And just as a follow-up, I flattened the database, flattened the install directory, installed Mediawiki 1.16.2 and configured it, installed SM 1.5.6, and SF 2.1.2, and tried the Class page again and I'm getting the same issue. Something fundamental is broken.  I'm guessing it has to be Apache. --Glitch25 22:31, 8 April 2011 (UTC)

FIXED IT! (Well, resolved the issue for now, but have raised a few questions). I hit up the server logs to see what more I could get from them, and the two errors that occur with the Error 500 are
 * PHP Warning: Parameter 1 to Parser::startExternalParse expected to be a reference, value given in/var/www/mediawiki/includes/StubObject.php on line 58, referer: xxxxxxxxxxxxx/mediawiki/index.php/Test
 * PHP Fatal error: Call to a member function getMaxIncludeSize on a non-object in /var/www/mediawiki/includes/parser/Parser.php on line 2714, referer: xxxxxxxxxxx/mediawiki/index.php/Test

Digging on those errors, I see that other extensions have problems related to this as a result of using PHP 5.3. Rolling my php back to 5.2 on my scratch virtual server seems to resolve the problem. Semantic Forms works once again. Unfortunately on the original server in question, this process seems to break Mediawiki with a blank page. NO errors even with error logging turned on. Nevertheless, I think I'm close. --Glitch25 20:33, 11 April 2011 (UTC)


 * That's great detective work! I bet those are the two issues, especially the second one. I'm pretty sure where in the SF code it's coming from, so I'll look into it. Yaron Koren 22:17, 11 April 2011 (UTC)

Problem with form used on page containing multiple templates
I've been trying to debug a problem involving a form that is used to edit data contained in several different templates (some of which are set up as multiple-instance templates that use SIOs). If I simply click on edit with form, and then on save, and then click on edit to get a raw view of the wiki text, I see that the fields from the first template on the page have also been copied into the other templates further down the page. An example page where the problem can be duplicated is here.

I've upgraded to SF 2.1.2, and still have the same problem. There's a couple things I could be doing wrong which may be causing this. First, I'm running mediawiki 1.18alpha from the mediawiki svn trunk. Secondly, some of the templates use the same field names. If needed, I can try to duplicate the behaviour using a different version of MW, etc. Let me know if there's anything I can do to further help figure this out.

ChrisDavis 21:19, 7 April 2011 (UTC)


 * Ooh, that looks bad indeed! I've heard of that problem happening in at least one other case, but haven't been able to reproduce it. If you're willing to, it would be great if you could try to replicate the problem on http://scratchpad.referata.com, by copying over the form, templates and page - that would make the problem much easier to debug. Yaron Koren 21:35, 7 April 2011 (UTC)


 * I've been able to reproduce it on referata here. The form & templates are slightly stripped down from what's on my wiki.  ChrisDavis 22:40, 7 April 2011 (UTC)


 * Cool, thanks - that was quite helpful. I think I fixed the problem in SVN, so if you're willing to upgrade to the latest SVN version of SF (which has a bunch of other changes, though it seems to be stable), hopefully your problem will be fixed. Yaron Koren 03:31, 8 April 2011 (UTC)


 * Awesome, thanks for the quick fix, and It's (almost) working. This fixes the original issue, although it now prevents the map from loading after I edit with form and then click on save page (javascript error - "Uncaught ReferenceError: addMapsOnloadHook is not defined").  To fix this, I tried upgrading some of my extensions to what's in use on referata (Maps & Semantic Maps to 0.7.6.1, Validator to 0.4.6), although no luck yet.  Also, I'm running SMW 1.5.5. For what it's worth, my original version of SF was checked out from svn (a few months ago?), and when I updated it today, only SemanticForms.php, specials/SF_FormEdit.php, and includes/SF_FormPrinter.php where changed. ChrisDavis 08:29, 8 April 2011 (UTC)


 * That's great that it works now. That second issue is weird - as is the small number of files that were updated. That sound like a Maps or Semantic Maps issue, though - I would ask in one of the venues for those extensions. Yaron Koren 15:10, 8 April 2011 (UTC)

Warning message when trying “edit with form”
I have upgraded from Semantic Forms (Version 2.0.9) to Semantic Forms (Version 2.1.2) and I am getting the following warning message when editing or saving the form using “edit with form”: Warning: call_user_func_array [function.call-user-func-array]: First argument is expected to be a valid callback, 'OutputPage::includeJQuery' was given in /home/user/public_html/adm/includes/StubObject.php on line 58 The form still works as expected and the data can be edited and saved with no problem. If I create the form (or save it) using #formlink the error message is not displayed I have installed: Thanks in advance, great extension!
 * MediaWiki 1.15.1
 * Semantic MediaWiki (Version 1.5.6)


 * I'm not sure this error is coming from SF - do you have Semantic Forms Inputs or Semantic Maps installed? If so, what version? Yaron Koren 15:50, 8 April 2011 (UTC)


 * I had Semantic Maps 0.7.1 installed. I disabled it, try "edit with form" and I got the same warning. Then, I disabled every extension except Semantic MediaWiki and Semantic Forms, but the warning message was still being displayed. Xavi 09:50, 11 April 2011 (UTC)


 * I have upgraded to MediaWiki 1.16.4 and the warning message is no longer displayed. Xavi 11:39, 17 April 2011 (UTC)


 * Hi - okay, that's good to hear. By the way, if you're still reading this, what version of PHP are you using? I think that's relevant as well. Yaron Koren 15:59, 17 April 2011 (UTC)


 * I've read the posts talking about problems with PHP 5.3, but I was using PHP 5.2.13. Anyways, it works now. Thanks! Xavi 16:56, 17 April 2011 (UTC)

Templates within Templates?
Hi there; First off, excellent work on this extension.

Now for my query... I've created a form to input details of customers into a business wiki and so far it seems to be working reasonably well. Most fields are fairly straight forward and fit within one fairly simple template. However, my final field is meant to be an array (using #arraymap) of "contacts", which in the sense of my wiki are input via a template and include the contacts name, email and position within a company. Is there any way to effectively embed a template as a repeatable field within another template using this extension. Ashimema 22:39, 11 April 2011 (UTC)


 * Thanks. Unfortunately, no - but if I understand what you're doing correctly, I would recommend, instead of using #arraymap, using a multiple-instance template, and the Semantic Internal Objects extension within that template to store the data. Yaron Koren 23:01, 11 April 2011 (UTC)

Wow, that was a quick response! I think you understood me right (which reading back and realising how cryptic I was, is pretty impressive). I've already discovered the SIO extension you mention and in fact am already using it in this way. So currently my form is implemented as one template for half the details (which don't need/want to be repeatable) and one multiple-instance template which implements the SIO extension. I was just hoping to consolidate them for aesthetics in the final page. My "Contact" template takes Name, Email and Position as variables, saves them as semantic properties and outputs the name as a mailto using the email address (i.e hiding the email in favour of linking the name). The "Customer" template takes various "one time" details AND the list of "Contacts" and outputs them as a neatly formatted table. I'm sure there's a way around it using multiple templates to build my table so maybe i'll invest the time in doing that.. but it was worth an ask first. Thanks for your reply and keep up the great work! Ashimema 23:18, 11 April 2011 (UTC)


 * Yeah, I agree that it would be nice to be able to embed multiple-instance templates within the "main" template. Given the current setup, you might need to have yet another template, after the multiple-instance one, to define the bottom of the template. Yaron Koren 23:52, 11 April 2011 (UTC)

Warning and Fatal error when trying “edit with form”
MediaWiki	1.16.1 PHP	5.3.0 (apache2handler) MySQL	5.1.36-community-log Semantic Forms (Version 2.1.2) Semantic MediaWiki (Version 1.5.6)

I already tried disabling all of my other extensions in order to see if they cause these errors. Errors happen after updating to the newer SF Warning: Parameter 1 to Parser::startExternalParse expected to be a reference, value given in C:\wamp\www\WikiError\includes\StubObject.php on line 58

Fatal error: Call to a member function getMaxIncludeSize on a non-object in C:\wamp\www\WikiError\includes\parser\Parser.php on line 2714


 * Thanks - yes, someone else just discovered this error earlier today; see the "error 500" message, above. Yaron Koren 23:53, 11 April 2011 (UTC)


 * This is unfortunately difficult for me to debug, since I think it only shows up for PHP 5.3, and I have PHP 5.2. But I just checked in something to SVN that might solve the problem - see here. If possible, could you apply this change to your code, and see if it makes a difference? Yaron Koren 16:25, 12 April 2011 (UTC)


 * Same errors both. No change for me.--Glitch25 16:49, 12 April 2011 (UTC)


 * Okay - thanks for testing. I'm currently trying to upgrade my version of PHP. For now, I think you can get around the problem by just commenting out the startExternalParse call... Yaron Koren 17:26, 12 April 2011 (UTC)

That resolved the startExternalParse error but not the getMaxIncludeSize error. Still crashes with a 500. Thank you for your help with this. I really appreciate it, and really enjoy this extension! --Glitch25 17:41, 12 April 2011 (UTC)


 * I don't know if you saw, but F.trott checked in another fix to SF on SVN, that seems to now fix the problem. Could you try this one out and see if it works for you? Yaron Koren 00:36, 15 April 2011 (UTC)

I think I've found a bug?
Loosely related to my comments above I've been playing with creating a form field that accepts multiple "text" values as a comma separated list. (In the long run I was hoping to make each text entry a valid wikitext statement to pass through to the second template.. but that's another matter) So, In my template I have a bunch of statements including: ! Other Contact(s) ! colspan=2 | Service Details ! Product(s) So the first arraymap does not have a property attached to it, but the second arraymap has a property of type "text". What appears to be happening when I try to create a from using this template is that the first arraymap is linking itself to the property associated with the second arraymap.. and try as I might I don't seem to be able to undo that relationship. Worse is that the second array map does not seem to link to any property at all...

Any Ideas? Ashimema 12:12, 12 April 2011 (UTC)


 * If that's indeed happening, that's definitely a bug, but it sounds very strange... could you try replicating this problem on a public wiki, like http://scratchpad.referata.com? (Also, the "String" type might be a better fit for that property than "Text"). Yaron Koren 13:39, 12 April 2011 (UTC)

Sorry for the slow reply... It was a busy evening! I've created all the necessaries on your scratchpad wiki to duplicate the error. If you try to create a form using the template "Customer" now you'll find that the "Field 'Contact'" defaults to property "PTFS Service" which it shouldn't and the "Field 'Products'" which should be relative to "Property 'PTFS Service'" actually defaults to a text input with no property? I'll take you advice regarding Strings as opposed to text under consideration.. I think your right... I was in somewhat of a hurry while experimenting. Ashimema 10:29, 13 April 2011 (UTC)


 * Ah, yes - that's a bug. I never tested the possibility of a call to #arraymap that doesn't set a property - I bet that's what's causing the issue here. I'll try to fix the problem, but until then you could work around the bug by adding a property setting to the "Contact" field; or, you can manually set the behavior of those form fields to be correct, including setting the right property, via the "property" parameter. Yaron Koren 13:09, 13 April 2011 (UTC)

Cheers for taking a look into it Yaron. Just as some further information, (but maybe just polluting the information I've already given) I've already got a property (of type "page") called 'contact'. It's actually the SIO I set-up for holding contact information within pages.. Wonder if that's possibly causing any issues. But yeah, thought I'd mention it as an aside as you noted that a workaround should exist whereby making "contact" a valid property should solve the problem.. temporarily. unfortunately no cigar. Anyway, I continue to think this is an excellent extension... only wish my PHP was a little better; then rather than jsut pointing out bugs, I might be able to submit "patches".. Ashimema 13:19, 14 April 2011 (UTC)

PHP Notice:
Hi Yaron, my error log records the following notice when I create a page with a form: "Undefined variable: text in /.../extensions/SemanticForms/includes/SF_FormInputs.php on line 914" I does not seem to be a big issue since my page gets created an is queryabel. Still I would like to pass this information to you. Cheers --&#91;&#91;kgh&#93;&#93; 14:06, 13 April 2011 (UTC) NS I forgot to add that I am using SF 2.1.2 on MW 1.16.2 --&#91;&#91;kgh&#93;&#93; 21:58, 13 April 2011 (UTC)


 * Thanks - I believe this has been fixed in SVN for a while, but it's good to know that it's in the current released version. Yaron Koren 00:06, 14 April 2011 (UTC)


 * Cool and thank you. Cheers --&#91;&#91;kgh&#93;&#93; 07:34, 14 April 2011 (UTC)

More help on using forms to creatre custom search query
HI, Any chance of some examples on how exactly to use Special:RunQuery? Or a walkthrough? With examples of a working template and form etc?

Workaround for values with commas in them?
Hello, I have a dropdown list that get it's values from a huge external database that changes now and then. My problem is that the values often include commas. If I remove the commas before printing them, I will have to keep an updated table of corresponding values to those strings without commas, which would mean a lot of maintenance. I could switch the commas for, say semicolons, before printing, but then any function that reads the resulting property value will have to know how to do the conversion backwards, which will sooner or later fail. There is also no guarantee that the fields will not, att some point, contain a semicolon (or whatever character I would choose). Does anyone have a clever workaround? Is it possible to hack SF to accapt other delimiters somehow? rotsee 08:22, 17 April 2011 (UTC)