Extension talk:Page Forms

Stuck when using Special:CreateForm
I followed the QuickStart guide and successfully created properties and templates. Now I want to create a form via Special:CreateForm. After I choose my template and click "Add" I'm transfered to another page saying "Before template:" and a drop down menu with the 2 choices "At end" and "Template_name". I have three buttons "Add", "Save page" and "Preview" but none of them takes action if clicked.

Can you please help?

Thanks in advance!

BTW: http://scratchpad.referata.com/wiki/Special:CreateForm shows the same faulty behavior. --Stefahn (talk) 11:53, 4 September 2012 (UTC)


 * Thanks for pointing that out. That's too bad... it was just a single missing '.', due to a change made last week. I just fixed it in Git, and updated the code in Referata. I guess I'll have to release a new SF version too... Yaron Koren (talk) 15:52, 4 September 2012 (UTC)


 * Thanks for your quick reply, Yaron! Now it works fine. Also, I finally got a Git GUI working for windows :) Stefahn (talk) 23:33, 4 September 2012 (UTC)


 * Thanks indeed. Some problem and same solution, only that Git is working on my Mac ;-). One question though: the list of templates appears in some random order when I want to add a template to the form. Shouldn't that be alphabetically? --AdSvS (talk) 13:14, 6 September 2012 (UTC)


 * They're showing up for me in alphabetical order - can you point to some place where they don't show up that way? Yaron Koren (talk) 14:45, 9 September 2012 (UTC)
 * After having installed the SF version with the 'CreateForm' problem and an updated version after that, the list was in seemingly random order. After creating another template it was ok again. I'm not going to be able to reproduce this one and also couldn't make a screenshot with the list shown, so let's forget about it! --AdSvS (talk) 14:38, 17 September 2012 (UTC)


 * I have the same problem where was the missing "." in the code. I can not reach git for some reason and I could only download the tar.gz version and it is not corrected there. Could you tell me the exact location of the missing "." or update tar.gz file. Thanks in advance. Nephantes (talk) 17:59, 21 September 2012 (UTC)

Good point; I just updated the download link (something I should have done a while ago). Yaron Koren (talk) 20:52, 21 September 2012 (UTC)

Namespace declaration ignored if postbutton method is used?
In relation to archived discussion:.

I've found that the "namespace=" declaration is ignored when using the postbutton method? Ashimema (talk) 13:53, 6 September 2012 (UTC)

Info tooltip does not work in multiple instance templates
I use the following text next to a field which is in a multiple-instance template. When you view the form, the tool tip (?) icon shows next the field, but the tool tip bubble doesn't open when you click on it. I tried to open multiple instances of the template and the tool tip does not load the bubble. I have tried this with a field that does not have multiple instances in the same form and the tool tip loads the tool tip bubble.

Here is my template call within the Form Syntax

The preceding message was posted by User:81.104.213.79 on 9 September 2012
 * I can confirm this behaviour. Cavila MW 1.17, MySQL 5.5.23, Php 5.3.10, SMW 1.7.1 14:29, 9 September 2012 (UTC)

Does anyone know a solution to this? --81.104.213.79 11:02, 14 September 2012 (UTC)

Semantic Forms
Hi,

I am using semantic forms. I need to bring some of the fields to the first page with validation and also i want to send these values through url to next page.

Kindly help me to solve this problem. Reply me as soon as possible.


 * This is the right spot. :) "Spamming" a question to all sorts of locations does not help the cause. Signing your question is probably a good idea too. Cheers --&#91;&#91;kgh&#93;&#93; (talk) 14:41, 12 September 2012 (UTC)


 * This may possibly help. And yes, please stop spamming. :) Yaron Koren (talk) 02:29, 13 September 2012 (UTC)

A lot of "Allows value's" in Combobox
Hello, I am trying to do the following. The  is filled with data from a table on the MySQL instance. With the help of the External Data extension it fills all Allowed values with customer names. After saving the page there is a nice list of all the customers (+/- 800). When you press Browse properties on the property pages all customers are listed behind Allows value. All seems fine. This is a property of type Has type::Page.

With the form and template below I then create a new page and expect to see all customers listed in the Combobox that are on the  page but it only shows +/- 240 randomly from A to Y. Always the same customers are shown but never all of them.



When I do the same thing with a smaller result set (+/- 40) it works fine. I can't find any SMW setting's limiting the amount of Allows value's for a property. I am not sure what is going on here. If it would show the first 200 it would make sense but as it is now it is a little confusing. It would be very nice if I could get this to work with a bigger result set, is there a trick to get it to work or is this just to much? Thanks --Jongfeli (talk) 14:13, 12 September 2012 (UTC)


 * 800 is a lot of values! Of course, ideally it should work, but given that you're using a combobox, an alternate solution is to use "autocomplete from url" - it's less of a hack. Unfortunately, it's also harder to set up (something I hope to change), but if you can create an API script that displays the table contents in JSON form, that's what I would definitely recommend. Yaron Koren (talk) 02:20, 13 September 2012 (UTC)


 * Ok Yaron, thanks for your quick responds. I did some more testing and I think I found the problem (I created the problem myself). On the template that is used by the from there was no reference to . In the template I also use the External Data extension to fill in some data. This means Semantic Forms works fine with External Data and a lot of "Allows value's"! My "mistake", I must say it takes a while before you get the grips on a Semantic Wiki and Semantic Forms but I am learning.


 * I will do some tests to see what happens:
 * I need to assign  to   but when it is not there use the data from the External Data extension.
 * Look at the location of, when it works it is at the beginning of the template and not inside a.


 * For your reference, it works with the following extension versions (we are using the alpha versions because we want to try out the new graph functionality):
 * OS Windows Server 2003
 * MediaWiki 	1.19.2
 * PHP 	5.3.8 (apache2handler)
 * MySQL 	5.5.19
 * Semantic Forms (Version 2.4.2)
 * Semantic MediaWiki (Version 1.8 alpha)
 * Semantic Result Formats (Version 1.8 alpha)
 * Validator (Version 0.5 alpha)


 * When downloading the .tgz from Extension:Semantic Forms I still have the problem described in Stuck when using Special:CreateForm. When you take a snapshot from git it works fine. --Jongfeli (talk) 10:27, 13 September 2012 (UTC)


 * It works in a normal "table" and a . The syntax is the same except for the pipe. Problem solved.
 * Normal Table
 * --Jongfeli (talk) 11:58, 13 September 2012 (UTC)
 * --Jongfeli (talk) 11:58, 13 September 2012 (UTC)
 * --Jongfeli (talk) 11:58, 13 September 2012 (UTC)

WYSIWYG with SF 2.3.2
Hello,

I have a problem with the WYSIWYG editor (the one based on CKEditor) when using semantic forms 2.3.2. I have applied the relevant patch for it but it still won't show up. I have both SMW and SMW+ installed. Could this be a cause? Many thanks, Adrian.


 * Hi - sorry, I know very little about SMW+, or the WYSIWYG extension. Maybe other people reading this can help, though. Yaron Koren (talk) 12:28, 13 September 2012 (UTC)

Query parameters not passed
Hi, I'm having some problems with query parameters in a function. First I passed the parameters (6 of them) as a query string. Problem: the first one is not passed. Something peculiar about the first parameter in the URL string: the '=' between first parameter and value is replaced by '%3D'. For other parameters there is a plain '=' in the string.

When I passed the parameters as separate parameters, only the first one (that wasn't passed to the form before) was passed and the others were not. From the documentation It appears that all parameters can be provided separately.

It is a Dutch wiki with SF 2.5 and all versions up-to-date. Are there some limitations or conditions to the use of parameters that I'm not aware of? --AdSvS (talk) 15:23, 17 September 2012 (UTC)


 * I'm definitely not aware of this problem. Could you reproduce it on a public wiki? Yaron Koren (talk) 18:08, 17 September 2012 (UTC)


 * If you have a look on http://gbv.wikibase.nl/index.php/Testpagina you will see what I mean. The three links are essentially the same. The first has one parameter with the whole string (which works fine by the way, so I'm happy that my problem is solved!), the second the same string with 'query string=' added and the third with separate parameters. The results are different and only the first one gives a good result. I haven't been able to reproduce it on other wiki's, so something strange is going on. --AdSvS (talk) 07:46, 18 September 2012 (UTC)


 * Okay, thanks. My guess is that this is because you're using the old way of calling #formlink - without named parameters. Could you try switching to using named parameters for everything? Yaron Koren (talk) 12:39, 18 September 2012 (UTC)


 * Indeed you're right. I have used named parameters in both situations, with one query string and with all separate parameters, and both work well now. --AdSvS (talk) 13:12, 18 September 2012 (UTC)

Query forms, problem with empty fields
Hello. I've created a query form with lots of fields (all of which are properties) where the user can fill in values for one or more fields and the rest will be ignored. However, the query doesn't seem to work unless the user fills in all fields. E.g. I have a form containing the fields Country and Basin, which are also properties in the wiki (strings, with a set of allowed values). In the template I write the following query:

If I select values for both fields the query works fine, but if I only select country, the value for Basin in the query will be "" which is obviously not in the list of allowed values. How can I make the query ignore any fields which the user don't select in the field? (I saw someone suggesting to use Basin:: instead, but that seems to break the query parsing, as pipe has another meaning. I also tried escaping the pipe (with "&amp;#124;") or using Template:! but without success.) MathiasLidal (talk) 11:56, 20 September 2012 (UTC)


 * Just use the parser function "if":

missing, easy to loose track of all the curly braces...:)


 * MathiasLidal (talk) 11:56, 20 September 2012 (UTC)


 * For what it's worth, I believe just adding the pipes to the template parameters in the original query would have also worked. Yaron Koren (talk) 12:51, 20 September 2012 (UTC)

More on Embed in field / holds template
Two things: Cavila MW 1.17, MySQL 5.5.23, Php 5.3.10, SMW 1.7.1 09:31, 21 September 2012 (UTC)
 * There may be a bug: once you've hit "save and continue", it appears that new instances of the embedded multi-instance form cannot be edited. The fields become 'locked', as it were.
 * I've experienced some issues when you have about 30+ instances on a page (even if the page itself is under 8,000 bytes). Attempts to save the page can fail at times. Would it be fair to say that regular (non-embedded) multi-instance forms are a little more solid in this respect?
 * Guess what? The second issue above can serve as a solution for the first one! When those fields become frozen, you can attempt to save the page using "Save". What happens instead is that the form is reloaded with the last saved revision and the fields that were previously unusable can now be filled in. How's that for turning bugs into advantages? Cavila MW 1.17, MySQL 5.5.23, Php 5.3.10, SMW 1.7.1 10:28, 21 September 2012 (UTC)

Semantic Forms Hooks
Hi Yaron, Is there any possibility of a hook similar to the MW hook AlternateEdit - an ability to intercept the loading of the edit form. Currently, I'm subclassing SFFormEditAction, overwriting the 'formedit' property of $wgActions to point at my subclass, and overloading the show method, but doing so seems like asking for trouble down the road.

Is there any documentation on the hooks that SF provides?


 * I don't know of such a hook, but you should definitely feel free to add such a hook to your SF code - if/when you get it working, please send me a patch for that hook; I'm always glad to add hooks into the code. Unfortunately, I don't think there's any such documentation, although it would be great if there were. Yaron Koren (talk) 16:02, 23 September 2012 (UTC)

Using one form to create multiple pages?
I was wondering if it's possible to use semantic forms to create *two* separate pages using the same inputs.

I am using a form in order to create a bibliographic entry for academic articles and my form therefore asks for PaperTitle, tab-delimited AuthorNames, Year, and an article summary. My form then creates a page whose title is equal to the PaperTitle and I then use a template for that article. I also use #arraymap on authors so as to define multiple values for the property author.

Upon submitting the form, I would like to create a second page that links to the first page and is titled "AuthorLastName1, AuthorLastName2, AuthorLastName3 (Year)". This would allow users of the wiki to find the main page by looking it through article title and also by Author-Year.

Is anything like this possible with SMW? If not, are there any potential workarounds anyone can think of?

Thanks in advance, Dana
 * Just the other day I was searching the archive to see if a similar question had been asked and addressed, but I couldn't find anything. The scenario that I was thinking of myself is a form with which to create a series of pages for journal articles (which may or may not belong to the same journal volume). It would be so much easier and less time-consuming if these pages can be created in one form, but unfortunately, I don't think this is possible. (Sometimes what I've chosen to do instead is to create CSV files and import them to the site.)
 * Dana, if you need to create a lot of pages that share the same data (not in a single form though), you can define default values in the form. See the documentation. If other users complain that they don't need those defaults, you could create an alternative 'preliminary' form just for the creation of those pages with some of the default values defined in it. Cavila MW 1.17, MySQL 5.5.23, Php 5.3.10, SMW 1.7.1 08:32, 23 September 2012 (UTC)


 * Dana - you could probably do that something like that using #formlink or #autoedit (though users would have to take an extra step or two of clicking on links), but, if I may ask, why do you want to do this? Can't users find the page anyway, by searching on that text, even if the text isn't in the page title?


 * Cavila - your issue is actually different, in that you have different data in each of the pages you want to create. A CSV import is definitely one option; there was also an extension that I think allowed that, Semantic Multi Edit Extension, but it's unfortunately not being maintained. Yaron Koren (talk) 16:10, 23 September 2012 (UTC)

WikiEditor functionality not working in SF 2.5
Hey, we're running MW 1.18.1, SMW 1.7.1, SF 2.5, and wikieditor 0.3.0.

The wikieditor functionality doesn't seem to be working. It's just displaying a borderless text box around the free text.

Relevant code block: 

Any idea what's causing this? It was somewhat working on one of our test sites running SF 2.4.2 (Although I just found out it had the same display issue on Safari on that site).

--Rosencrantz (talk) 20:07, 26 September 2012 (UTC)


 * Is this on a public wiki? If not, could you look at the Javascript console, using either Chrome or Firefox + Firebug, and see if there's a Javascript error happening? Yaron Koren (talk) 03:13, 27 September 2012 (UTC)


 * It's not a public wiki, but there was a Javascript error.


 * Uncaught TypeError: Cannot read property 'wikieditor' of null Test_page:446
 * (anonymous function) Test_page:446
 * using load.php:148
 * (anonymous function) Test_page:446
 * deferred.resolveWith load.php:14
 * jQuery.extend.ready load.php:6
 * DOMContentLoaded load.php:12
 * --Rosencrantz (talk) 13:48, 27 September 2012 (UTC)


 * Okay, that's helpful - although, as I should have said before, could you add "?debug=true" (or "&debug=true") to the URL, and look at the error message again? Yaron Koren (talk) 13:56, 27 September 2012 (UTC)


 * That didn't change anything in the output. However, in fiddling around with it I did discover that this is only happening with the Special Page. If I use the Page has default form property and use the Edit with form button it works properly. --Rosencrantz (talk) 15:48, 27 September 2012 (UTC)


 * Okay, that's good to know. Are you sure it gives the same error message? It really shouldn't. Yaron Koren (talk) 16:40, 27 September 2012 (UTC)


 * I agree, it shouldn't, but it does. Well, &debug=true just changes the name of the page I'm trying to edit so I had to use ?debug. One interesting thing is that it throws a different error in Firefox with firebug.
 * TypeError: window.ext is null
 * jQuery(function{mw.loader.using("ext.semanticforms.wikieditor",function{jQuery('#sf_free_text').SemanticForms_registerInputInit(window.ext.wikieditor.init, null );},function(e,module){alert(module+": "+e);});});
 * Another oddity I found is that users who are logged in see the bar. Once you log in, the edit bar disappears. --Rosencrantz (talk) 19:52, 27 September 2012 (UTC)

I talked about this issue with Stephan Gambke, who wrote the main code for dealing with WikiEditor. Neither of us understands what's causing the error, although we agreed that a bug report about it would be very helpful. If possible, could you submit a report about this on Bugzilla? Yaron Koren (talk) 03:14, 28 September 2012 (UTC)

Ask queries with multiple instance embedded templates
I am having trouble getting the results that I want from an ask query while using multiple instance embedded templates. I am rather new to semantic mediawiki and media wiki in general, so I am unsure if it a problem that I am having or if the extensions can handle what I am trying to do.

I have 4 templates. One main templates and 3 templates that I use as multiple instance embedded templates and I am using SIO for the multiple instance templates. I can provide examples of each of these templates and the form that contains them if they are needed, but I think most of my issue lies in how I am setting up the query. I can get the query to return any of the properties from the page except the multiple instance templates. Adding their name to the property list returns nothing. I can, however, get a list of the values of a property from inside the multiple instance templates by querying the name of that property. What I really want is the properties of each instance as a group, similar to an object. From reading about SIO, it seemed like SIO would be able to do this, but as I read more and more it seems like SIO is intended to go from the internal objects to the parent, not the parent to the objects, the way I would like it to.

Pretty much I am just lost. I know I didn't give much information, but I can give more if it is needed. Basically, I just wanted to know if I'm on the right track or if what I am trying to do is even possible. Any help is appreciated and I am more than willing to give more information if it is needed.


 * This doesn't sound like an SF issue. What's the query you're trying to run? Yaron Koren (talk) 03:15, 28 September 2012 (UTC)


 * Sorry it's taken so long to get back with the example. My main template is similar to this:

&lt;/pre&gt;


 * And here is an example of the multiple instance embedded template I am using:

&lt;/pre&gt;


 * And the query I am trying to run would be something like this:


 * So this will give me a list of values for each MITProperty, like MITProperty1=value1,value2,value3. What I am trying to get is a separation of these values, like MITPropoerty1[1] = value1, MITProperty1[2] = value2, MITProperty1[3] = value3.
 * This may not be possible, and it could just be the way that I am trying to store the data and/or run the query. It is likely not a problem in semantic forms, but rather my lack of experience.


 * This definitely isn't an SF issue - it's a data structuring issue, or maybe a syntax one. Most of your syntax here looks incorrect, but I'll assume that it's correct in the original. The key thing to remember, when using SIO (or subobjects), is that the properties you're storing don't apply to the page itself, but rather to an object within the page - so you can't get the properties of the object and the page at the same time. Yaron Koren (talk) 16:53, 3 October 2012 (UTC)

Referring to field values in form definitions
I am stuck defining a form for a simple sports league management system.

I got a hierarchy of pages with associated semantic properties: League containing sub pages Teams, Venues and Tournaments. When defining a tournament it should be possible to select which teams participate in that specific tournament, but since there could be multiple leagues, the selection needs to be narrowed down to teams associated with a particular league for which the tournament belong.

What I really need is a field definition along these lines:

But that obviously does not work since the is not available in the form page.

Any idea how I could get around this?

Example page: Form:


 * You could use the "values dependent on" parameter. Unfortunately, it currently only works with the input types "combobox" and "text with autocomplete" (the latter would be the relevant one for you, since you could have multiple values) - though I do hope to get this functionality working for dropdowns, checkboxes etc. as well. But if you're fine with having users type team names and have autocompletion on them, instead of using checkboxes, that's what I would recommend. Yaron Koren (talk) 13:49, 30 September 2012 (UTC)


 * Ideally I would like this to be usable for people with very little computer literacy and absolutely zero knowledge of wiki markup, so really checkboxes would be preferred. However, I'll give the autocompletion a shot.  Thanx for the hint! Lbthomsen (talk) 04:20, 2 October 2012 (UTC)


 * A very generic way of solving this problem would be an ability to pass simple "variables" to a form. Say it was possible to link to a form like this:


 * And then being able to use those variables in the form definition page - parsed before anything else - for example like this:.


 * However, I do realize that this would break the "edit with form" functionality. Another approach would be an ability to set values based on templates.  In other words to expand templates and parser functions inside form fields.


 * Both approaches would make it possible to make context dependent checkboxes for example but I do realize that while the first approach is probably the easiest to implement, it would only cater for very specific uses while the second approach would be more generic. Lbthomsen (talk) 00:25, 8 October 2012 (UTC)


 * I just had one other idea that might be easy to implement and quite usefull for this. Let's imagine a form with a hidden field that is set in the call:


 * Now if only it was possible to refer to value this field had upon form rendering that would solve the problem:


 * In other words - just a way of rendering pre-set field values in the field definitions (wouldn't have to be full-blown expansion of templates/parser functions so it probably shouldn't use parser function syntax as in the example I just gave). This approach wouldn't break the Edit with form functionality as the hidden field would just remain there. Lbthomsen (talk) 00:34, 8 October 2012 (UTC)


 * That might be possible with the UrlGetParameters extension. Yaron Koren (talk) 02:42, 8 October 2012 (UTC)


 * I actually tried various combinations of template inclusions and parserfunctions, and as far as I can see they do not work in the fields. I didn't try the UrlGetParameters, but experimentally I tried a "values=  " (and a few other parser functions too) and that didn't seem to work (will result in one checkbox with a value of the string {{#xxx included). But yes, if that syntax was possible it would be possible to create context dependent checkboxes. Lbthomsen (talk) 16:35, 8 October 2012 (UTC)

Label only in embedded field when multiple
Hi, it seems that a label only appears when using 'multiple' in an embedded field. For example: doesn't make the label show, and does. Is that supposed to be? I would like to have the label in both cases. --AdSvS (talk) 09:39, 4 October 2012 (UTC)


 * Ah, I didn't even know you could use "embed in field" without it being a multiple-instance template. That's essentially an unsupported feature... why would you do that, as opposed to just making the parameter(s) of that inner template parameter(s) of the main template instead, and cutting out the middleman? Yaron Koren (talk) 14:03, 4 October 2012 (UTC)


 * It works fine, except for the label ;-). I want the set of data (meeting data that can be downloaded as iCal) appear on the form in a square with label and on the page itself embedded within the main template. If I put everything in one template I can't have the square with label on the form and if I use 2 ordinary templates the data can only be presented sequentially. So I'm really a fan of this middleman actually... --AdSvS (talk) 14:40, 4 October 2012 (UTC)


 * Hi - no, I don't mean having the two templates sequentially, I mean getting rid of the 2nd template altogether, and just passing all the fields in to the 1st template. Yaron Koren (talk) 15:00, 4 October 2012 (UTC)


 * Hi, by the way, will you be attending the SMW conference? If I put everything in 1 template I can't have the square with the label on the form, can I? --AdSvS (talk) 15:04, 4 October 2012 (UTC)


 * Probably not, and no - unless you modify MediaWiki to support the &lt;fieldset&gt; tag. (Which I actually think is not that hard to do, but I don't remember now). Yaron Koren (talk) 18:41, 4 October 2012 (UTC)

Disable sorting for multiple-instance templates?
I'm quite new to Semantic Mediawiki, so this might be obvious: I have a multiple-instance template consisting of two fields. When I #ask for this template I get all instances in natural order of each instances first field. But I just want to get what I entered. When I look for the pages source or try to edit my page I see all instances in correct order. I can drag my instances when editing but that doesn't affect my output. Thanks for any help. Bob


 * Are you saying that, when you rearrange the instances in the form, it doesn't affect what's in that page, or it doesn't affect what shows up in an #ask query on another page? Or both? Yaron Koren (talk) 17:27, 9 October 2012 (UTC)

Multiple instances with one header row
Hello, I have a page that contains multiple instances of a particular set of data. I've tried to arrange this data so that each instance is one row of a table of data. I'd like to have a header row that identifies the field names of each row. This is certainly possible with the template, but using that method, the header row is displayed above each instance--with a number of instances, this gets messy quickly. I can add a header row separately, but if I edit the data via form and then save, the header row (like any data on the page that occurs above the semantic data) falls below the semantic data. Any ideas on how I can achieve one row of header data, with the multiple instance data below?


 * I would recommend using "embed in field" and "holds template", if you haven't heard of those - they make headers and footers much easier. Yaron Koren (talk) 22:29, 11 October 2012 (UTC)