Extension talk:Page Forms/Archive June 2010

Another Image question

Yaron, Once again, thank you for all of your help over the last few years. Unfortunately, I have another question. I am having people upload multiple files in a form, some images and some not. I want all the files to be in a bullet format and link to the file page. I have accomplished that by using {{#arraymap:{{{files|}}}|,|x|*[[:File:x|x]]|\n}} The problem is that the images show up full sized and I just want links to the image. In theory, the ":" Before file I thought should do it, but it does nothing. Any advice to have links but not show the images on the page? Thanks in advance.

It was an error on my end. I switched it from "File" to "Media" and it works great. Still not sure why the colon didn't work, but I think I might have been editing an older template not being called up in my test image.

Clickable Uploaded File Links & Clickable User Page links

Sorry if my SMW forms terminology is off...Is it possible to make the results of an uploaded field clickable as an internal link to a file, such as the results of a field with URL type can do for an external link? Possible by changing the type to page and somehow prepending 'Media:' maybe at the floatbox upload form? In a similar line of questioning, how about a field with page type to be loaded with a username (currently done by using default=<current user>). I would like them to point to User:username instead of username.

Yes, absolutely - that's how it's intended to be done. Your template should contain something like "[[Has file::File:{{{Uploaded file}}}]]", with something similar (but with "User") for your other example. Yaron Koren 00:23, 1 June 2010 (UTC)Reply[reply]
BRILLIANT, and thank you!
had to add a "|", but worked perfect as..
[[Has file::File:{{{Uploaded file|}}}]]
I have the User:username working (even with multiple entries) using
Is there a way to display username but still point to User:username?
Great. Yes - just change the last part of that #arraymap call from [[Username::User:x]] to [[Username::User:x|x]]. Yaron Koren 16:49, 1 June 2010 (UTC)Reply[reply]
THANK YOU! and one last question: The uploaded file example above loads several images. I would like to automatically show them (if present) by added markup to template. I was successful in getting it to appear using an inline query:
{{#ask: [[User:{{CURRENTUSER}}]] | ?Uploaded file= }}
The plain text output looks like: System Images File:Front Rack.jpg, File:Back Rack.jpg, File:Theater.jpg
I was hoping to get improve image presentation/formatting by getting it into a gallery. Am I on the right track attempting string manipulations (replacing comma with CR's, etc)? or is there a better in line query call you can think of?
Is your "Uploaded file" property of type "Page"? If so, those values should be getting displayed as images - if they're not, you may have found a bug in SMW. Yaron Koren 14:55, 2 June 2010 (UTC)Reply[reply]
Yes, they did display mostly correctly via the above inline query (no bug) but they appear side by side with commas separating the images (as expected). I wanted to be able to clean them up with borders, size control, etc in a controlled gallery, or thumb'ed image. I realize this is getting out of SMW Forms, but I will update the thread if I can get it working.
I found that using the DPL Extension provides me the functionality I needed. This will created full featured thumbnailing. DPL Format control
|format=,:[[Image:%TITLE%|thumb|150px|Image: %PAGE%|%TITLE%]]\n,,

Modifying forms

Hello !

I've seen you said that is really difficult, and, as I program a bit of php myself, I believe it. But you say we can edit it by hand, and... that's all. I'd be very thankful if you could tell us where to find the data I have to modify to add or remove fields in my forms.

Samuel Marchand 12:53, 2 June 2010

Sorry, I don't understand the question. This question might be better sent to the SMW users mailing list, being so (I think) open-ended. Yaron Koren 14:52, 2 June 2010 (UTC)Reply[reply]
No problem, but I'll try to rephrase my question before posting it to the mailing list : in the paragraph "Getting Started" of this extension page, you say :
"this is programatically much harder to implement than creating new pages, because it requires parsing. For the foreseeable future, modifying existing properties, templates and forms will have to be done by hand."
So, if I'd like to modify an existing form, what should I search and modify ?
(I was reading my last question and thinking this wasn't understantable...)
Finally, I find the answer : I have to open the [[Form:nameOfMyForm]] page, and click on the "edit" tab. That's easy, but when you don't know it...
Samuel Marchand
Ah... I get it. Well, as I tell everyone, feel free to modify the documentation directly, if you think there's a clearer way of expressing it. Yaron Koren 16:34, 3 June 2010 (UTC)Reply[reply]
Done. Could someone check if I've written correct English ? That's not my mother tongue...


@Yaron, I was not so fast as you archived last discussion page. So let me say thank you on the new discussion page for your tip with cite extension - it helped :-) - --Ulli 757 17:48, 3 June 2010 (UTC)Reply[reply]

Great. Yaron Koren 03:11, 4 June 2010 (UTC)Reply[reply]

Hide Edit Source Tab

I enabled $sfgRenameEditTabs=True giving me both 'edit' and 'edit source'. Can I remove the edit source tab wiki-wide leaving just edit to normal pages and edit (really edit with form) for smw form pages?

$wgGroupPermissions['*']['edit source'] = false; $wgGroupPermissions['user']['edit source'] = false; $wgGroupPermissions['sysop']['edit source'] = false; $wgGroupPermissions['bureaucrat']['edit source'] = false;

in LocalSettings.php didn't work?

The permission you should be using is not 'edit source', but 'viewedittab'. Yaron Koren 14:11, 4 June 2010 (UTC)Reply[reply]

Default Loading of a Field with the Name of Page

I would like to automatically populate a 'Model Number' field within a form with the name of the page. If I call {{FULLPAGENAME}} in free text area I can get the correct text. However using the below code, I get {{FULLPAGENAME}} as the result. As a stretch I tried <page name> as used in default for uploads, but failed again.

| {{{field|Model Number|default={{FULLPAGENAME}} }}}

Do you mean that {{FULLPAGENAME}} shows up in the wiki text (and form), or that it shows up on the page itself? Yaron Koren 14:02, 6 June 2010 (UTC)Reply[reply]
{{FULLPAGENAME}} shows up in the form edit page. When saved, the form name appears in the form view. Going back to re-edit it goes back to the {{FULLPAGENAME}}. I assume this would prevent me from doing searches as I would like. I was hoping to drop in the static text.???
Okay - I think your explanation was not quite correct, but I think I understand the basic issue. Why not just have the template directly use {{FULLPAGENAME}}, instead of getting it via a field? Yaron Koren 12:59, 16 June 2010 (UTC)Reply[reply]

Hide 'Browse properties' Link

I am trying to hide the 'Browse properties' link on my sidebar. Sidebar is rendering via NavTree -Adding a treeview to the sidebar (if using monobook skin) if that matter.

That's a Semantic MediaWiki, not Semantic Forms, issue. Yaron Koren 14:03, 6 June 2010 (UTC)Reply[reply]
Sorry, the lines can get a little blurred. Answer is hiding toolbar lists in common.CSS by #p-tb li { display: none !important; }

Floatbox Call

First off apologies for a question not exactly specific to SMW Forms. You are using the floatbox js extension the bring up a a special upload window for SMW forms. I have googled beyond belief in my attempt to implement a simple picture using floatbox in mediawiki. I do not want to enable HTML site-wide ($wgRawHtml = true;). Can you point me in the right direction, or give me an example?

Hi - indeed it's not related, but since you ask - there's already an extension that might do what you're looking for - LightboxThumbs (I believe "lightbox" has become the standard term for this kind of interface). If that doesn't do it, Widgets might be a good solution - though unfortunately, there's no lightbox widget yet, so you might have to either create one yourself, or ask someone (like Sergey) to do it. I should note that Semantic Forms itself will probably switch in the next few months to using one of the jQuery-based JS libraries, instead of Floatbox; for what it's worth. Yaron Koren 15:26, 6 June 2010 (UTC)Reply[reply]

Difficulty with autocomplete on property

Greetings. I am having difficulty using autocomplete on property on any fields. I have created the property "Config item".

  • When I set to "property=config_item", the drop-down is created with the values as expected.
  • Tells me that there is no case-sensitivity or naming issue on property specification
  • However, when I set to "autocomplete on property=config_item", the autocomplete does not function.
  • When I set to "autocomplete on category=some-valid-category" it also works as expected.
  • Tells me that there's no problem with the YUI, etc.

So I am at a loss here. I feel like I might be missing something glaringly obvious. I have created properties of type text and string, but neither causes it to function. Any ideas or suggestions?

By the way, this extension is positively superb and has allowed me to present mediawiki as a viable option for our project. Can't thank you enough for this wonderful extension.

Thorncrag 20:27, 6 June 2010 (UTC)Reply[reply]

Thanks, that's great to hear - it's always nice to hear about SF and SMW being used in place of more expensive, or custom, solutions. As to your question - what happens if you switch to "autocomplete on property=Config item"? It could be that this parameter is case- or underscore-sensitive, even though it shouldn't be. Yaron Koren 01:01, 7 June 2010 (UTC)Reply[reply]
Hi Yaron, I've tried each combination, between capitalization and with/without underscores, none seem to resolve the issue. I may try creating an all new template, form, and property to test. Thorncrag 19:36, 7 June 2010 (UTC)Reply[reply]
I create a new property, template and form and still the same problem. The field will not autocomplete based on the new specified property. Stumped. Thorncrag 00:55, 8 June 2010 (UTC)Reply[reply]
I would try duplicating this on a public wiki, like scratchpad.referata.com. Yaron Koren 03:17, 8 June 2010 (UTC)Reply[reply]
Same problem on there. Thorncrag 01:12, 17 June 2010 (UTC)Reply[reply]

Thanks for duplicating it - I assume you're referring to this. If so, I now see the issue - "autocomplete on property" autocompletes on previous values the property has been assigned, not its "allowed values". If the property has allowed values, it shouldn't have autocompletion anyway - it should just have a dropdown or radiobuttons; wouldn't you agree? Yaron Koren

Ah, I figured I was missing something. Basically what I'm trying to accomplish is setting up autocompletion on a set of values that are specified somewhere. Just like how it works with autocomplete on category (which serves one of my needed functions). Using propery=property technically would work, but is not ideal because there are instances where my users need to set custom values, or multiple values. I'm pouring over the documentation, but can't quite put together in my mind how to accomplish this. Based on what you've said it sounds like I need to use the property I created and link the values elsewhere. Thorncrag 02:11, 17 June 2010 (UTC)Reply[reply]
Just to answer my own question, hopefully it helps others getting started... I did in fact figure out what I needed to do. I created a new article which defines each of the values of the property I wanted (e.g., [[Property A::Value 1]], [[Property A::Value 2]]). I then told my form to autocomplete on Property A and this accomplished exactly what I was looking for. Yaron, thanks again for a great extension. Thorncrag 08:08, 18 June 2010 (UTC)Reply[reply]

Preloading template field values in FormEdit

Template field values supplied to the FormEdit special page (like [template_name]field_name=field value) either by typing them into the URL or via {{#forminput:}} or {{#formlink:}} query string parametre seem to be ignored. Urlencoding the query string (the template and fields names are non-latin; can this be the problem?) does not help. Can anyone give a link to a working example of calling a form with preloaded fields?

You can see a demo of #forminput here. Yaron Koren 22:12, 7 June 2010 (UTC)Reply[reply]
    • Thanks, I misplaced the square brackets.
Great examples. I would love the option of default form selected (still changeable by user via drop down) and able to filter out certain options for the default form list. My thought was to redirect attempts to create new pages to.a single page which would facilitate settings categories via form selected/used. --Scott
"default form" and "listed forms" parameters are both reasonable ideas... I should note that very few people actually use the dropdown approach, from what I've seen. Yaron Koren 03:24, 8 June 2010 (UTC)Reply[reply]

Semantic Forms Interwiki links

Hello all, On similar lines as the previous post, I wonder if Semantic Forms can work with Interwiki Links. I had a few articles with properties like - [[State::wikipedia:Idaho|Idaho]] - before I installed Semantic Forms and SMW was working fine aggregating them and pointing "Idaho" to the wikipedia page (Idaho) both in the original page and in the aggregation page. But after I installed Forms, all my links show up as "wikipedia:Idaho" (as plain text) and are no longer linked to Wikipedia page. Can someone let me know how to correctly format the syntax so that I have the property-states linked to Wikipedia? Thanks!

Veryhuman 02:36, 8 June 2010 (UTC)Reply[reply]

That seems strange - the same wiki-text in the page produced a different link on the page before and after Semantic Forms was installed? Are you sure about that? If so, that could be a serious bug. Yaron Koren 03:14, 8 June 2010 (UTC)Reply[reply]
Yes, that is how it looks like. But maybe, I didnt go about doing it correctly and it may not be just due to installation of Semantic Forms. This is what I did. I had some pre-defined properties (state::,regnum::,habitat::)which were "interwikied" to Wikipedia entries of the property values and were behaving as expected. After I installed Semantic Forms, when I was setting up forms, the categories which were "interwikied" to Wikipedia were not visible (the non-interwikied ones (endemic::,height::) were visible). So I created exactly the same properties (state,regnum,habitat) using Semantic Forms CreateProperty and assigned them type "String" (Previously, I had not defined any type for the properties). Now I find that although the pages having these properties aggregate correctly, the names arent interwikied ([[state::w:Idaho|Idaho]] doesnt point to Idaho on Wikipedia) and instead generate an abnormal name w:Idaho for the property value.
Not sure if I did it correctly. Looking forward to this getting resolved! Thanks Yaron for the quick reply. Veryhuman 03:53, 8 June 2010 (UTC)Reply[reply]
Maybe the issue is that the properties' types changed from "Page" (the default) to "String", then? Yaron Koren 04:10, 8 June 2010 (UTC)Reply[reply]
Thanks Yaron, that (setting property-type to Page) works for most cases i.e. only where the property-value is interwikied to Wikipedia. However, if the property value has a REDIRECT page, it doesnt show up then. I'm trying to figure it out, but would appreciate your suggestion on this. Also, I was wondering if there is an inherent advantage to using the property-type String instead of Page?
Thanks again! Veryhuman 14:23, 8 June 2010 (UTC)Reply[reply]
Cool. It sounds like it's not a Semantic Forms issue, then; and I don't know much about the interplay of interwiki links, redirects and properties. I'd suggest writing to the SMW users mailing list. Yaron Koren 14:34, 8 June 2010 (UTC)Reply[reply]
Good! Thanks for the help Veryhuman 14:39, 8 June 2010 (UTC)Reply[reply]

Create customized standard input buttons


I was wondering if it is possible to create customized standard input buttons other than the seven default buttons (save, preview, changes, etc..) at the end of the forms. I would like to create a button that would save the form and immediately go back to edit mode using the same form for continual input. Basically when I am creating or editing a page with a form, I want a button at the end of that form to allow me to save changes and continue to edit within that form. Anyone have any idea how I would do this? Thanks

--Neezy 12:44, 8 June 2010 (UTC)Reply[reply]

Hi - people have asked about that kind of thing; the more common request is for a button that saves the page, then redirects to another page. I don't think any of it's possible, though, because once the form is submitted, the control is out of SF's hands; and I don't think MediaWiki has the functionality to do such redirects. Yaron Koren 14:38, 8 June 2010 (UTC)Reply[reply]

Must fields also be properties?

Hi, I'm testing Semantic Forms for this use case:

  • I have to maintain 60 records of the same type (programs)
  • I want to be able to add a field to all records at the same time without editing 60 program pages
  • I want to be able to add an option to a dropdown list without editing 60 programs
  • I would like to be able to query on a few fields, e.g. name, status, but most of the fields are unique to each program and don't need to be searchable/browsable (except by the normal wiki search feature)
  • I want to display help text at the top of all programs for new users, but hide it from experienced users - perhaps with a collapsable or scrollable text area, or a "read more" ajax link that won't pop people out of an edit & make them lose data

My questions are:

  1. Do I need to define properties for all of my fields, or just the ones I want to be able to search by?
  2. I can't see a way to define dropdown lists except by using properties
  3. Is there a GUI editor to add edit fields to existing forms & templates?

Thanks, Carole, 8 June 2010

Hi - (1) no, you don't need to define properties for fields; (2) use the "values" parameter for the "field" tag; (3) no, unfortunately. Yaron Koren 15:31, 8 June 2010 (UTC)Reply[reply]

Thanks for your blindingly fast answer! SF will be a huge help for the use case.

Templates vs Forms

What's the relationship between templates & forms? Using the workflow in the extension documentation, and looking at the generated code, it appears that templates list fields, and forms are where the fields are defined, and templates are a great way to organize fields by subject for use in one or more forms.

  1. Do I need 1:M templates per form (e.g., I shouldn't build a form without a template)?
  2. When I'm modifying a field, e.g., to add "values" to the field, do I do this in the form?

Thanks, Carole, 8 June 2010

Hi - forms just help users edit calls to templates - you always need the template(s) first. For adding values to a field - you can do that in the form, using the "values" parameter, or in the property for that field, assuming there is one. Yaron Koren 16:20, 8 June 2010 (UTC)Reply[reply]

References in SF and Form edit


SF is really helping me build a great site. Thanks for the wonderful application. I had a couple of quick questions:

1) Is there a way to have References for the property values put in by the User? Right now, I have 2 columns - Property-name and Property-value. I'd like to have the proper references for the value in the third column and ideally, have the references show up in the {{Reflist}} in the proper format. I dont know how it can be accomplished, maybe its just asking for too much, or maybe its already a functionality (which would be awesome!). I'd be glad to have suggestions on that.

2) Once a create a form, I frequently feel like going back and editing it using the same interface used for creating the form. I wonder whether that can be done without messing up the customizations done in the Form CSS.

ThanksVeryhuman 23:34, 8 June 2010 (UTC)Reply[reply]

Hi - I shudder to think at what you're doing (are users entering property names by hand?), but, in any case, the general answer to that is to use multiple-instance templates, ideally in conjunction with Semantic Internal Objects to store the data. And no, there's no way to re-edit forms using forms, unfortunately. Yaron Koren 01:32, 9 June 2010 (UTC)Reply[reply]
Oh no! The property names are hard-coded in the template. The users enter the property values. To make my question more clear, for propertyX::valueY, where valueY is input by user, I would want them to also include the reference for that value and have that reference show up under References section. Veryhuman 02:35, 9 June 2010 (UTC)Reply[reply]
Oh, sorry, now I get it - carry on, then. :) What I said before about multiple-instance templates and SIO is still valid, though. Yaron Koren 04:12, 9 June 2010 (UTC)Reply[reply]
Got it! Thanks Yaron. Veryhuman 04:22, 9 June 2010 (UTC)Reply[reply]

Parser functions inside page name value

Here says: The "page name=" value gets parsed by the MediaWiki parser, so you can also add parser functions, pre-defined variables, etc. into the value

I have unsuccessfully tried the syntax using Manual:Tag_extensions#Extensions_and_Templates:

{{{info|page name={{#tag:MyTestTag |{{{<Item[Author]>}}} }} }}}
{{{info|page name={{#tag:MyTestTag | {{{field|Author}}} }} }}}
so on

Any help will be greatly appreciated --Eurodomenii 21:51, 9 June 2010 (UTC)Reply[reply]

This won't work because of the order of execution: I'm pretty sure "<Item[Author]>" is parsed last, i.e. after "MyTestTag"; and what you're trying would only work if it were the other way around. Yaron Koren 22:20, 9 June 2010 (UTC)Reply[reply]

It seems to appear a more general question: How do I setup dynamically a form name based on a complex transformation of a field user input?

In the previous example, let's say:

Maybe you can suggest another approach. Thanks a lot! --EuroDomenii 23:44, 9 June 2010 (UTC)Reply[reply]

Okay, I was wrong - I looked at the code, and the variable substitution happens before the parsing, so what you're trying to do should work in theory. I think you might just have the syntax wrong. It should be something like:
{{{info|page name={{#tag:MyTestTag |<Item[Author]> }} }}}
...in other words, you had too many braces. Yaron Koren 00:24, 10 June 2010 (UTC)Reply[reply]

I am impressed: You reply so fast! Unfortunately, it doesn't work. Excluding the custom field, I think the parser function itself has a problem.

{{{info|page name={{#sub:Icecream|3}} }}}
{{{info|page name= {{#time: Y-m-d }} }}}

--EuroDomenii 02:14, 10 June 2010 (UTC)Reply[reply]

You have to be careful with the ParserFunctions extension - through some not-very-clever design, different versions of MediaWiki require different versions of ParserFunctions; my guess is that you just have the wrong one. Yaron Koren 14:25, 10 June 2010 (UTC)Reply[reply]

Our workaround is to use a custom parser function without pipe character or slash

{{{info|page name={{#MyCustomParserFunction:<Item[Author]>}} }}}

There is an parsing error if you try to use a includable special page or a parser function with multiple parameters, that contains / or |

{{special:MySpecialPage/<Item[Author]>}}  or 
so on

It was very helpful your suggestion regarding too many braces.

This page name formula feature is absolutely fantastic. I never thought of such a high level of customization for MW. Congrats! --EuroDomenii 00:39, 11 June 2010 (UTC)Reply[reply]

Use properties to define a field data type? Can properties be shared between fields?

I'm using Semantic Forms more for the form functionality than the SMW query functionality. I want to define some fields of type URL, and there's no field type for that. Can I define a Property called "URL" that I can use for multiple fields in one template & form (or possibly multiple templates/forms) to access that field type? Or will I need to create a separate property for every URL field? I'm not sure if the benefits are worth it, and I'm not sure yet what defining a URL vs a string will buy me, but this is a general question I may apply to other field types.

This is a rather open-ended question, but yes, I'd recommend making a separate property for each field, and making the properties that correspond to URL fields be of type "URL". Yaron Koren 19:38, 14 June 2010 (UTC)Reply[reply]

Categories on Forms

I want to enable users to select multiple "Topics" when entering a form. The topics should be in a multi-select list, and each Topic corresponds to a wiki Category. There doesn't seem to be any Semantic Forms functionality to help with this; do you have a recommended extension? [MetadataEdit] looks good; MetaMan isn't working for me.

Also, I'm currently using templates to pull in the categories onto my existing wiki pages. Can I keep the convenience of embedding them in forms, or must I lose that level of abstraction to take advantage of an easy category tagging extension?

There is functionality for that, actually: you should use the "categories" input type. Yaron Koren 19:39, 14 June 2010 (UTC)Reply[reply]
I got this to work for a single word category. What's the syntax for a multiple-word category, e.g.,
{{{field|OBPGCategories|input type=categories|top category=OBPG Topic Categories |height=200}}}
I get the error "Category OBPG Topic Categories not found" (whether or not I use underscores)
Thanks, Carole, 15 June 2010
Does that category exist? If so, the issue might be the space after the name - I hope that's not it, though. Yaron Koren 12:52, 16 June 2010 (UTC)Reply[reply]
The ending space is not the issue, neither are the multiple words - I recreated the category as "OBPGCategories" and it still fails. The category exists, it has 3 subcategories, and 1 page in the root category. Category "Acronyms" works; it has 600 pages and 1 subcategory.
Here's the code (ignore the labels, I'm just testing with existing fields):

! New Organization (English): | {{{field|NewOrganizationEN|input type=categories|top category=OBPGCategories|height=200}}} |- ! New Organization (French): | {{{field|NewOrganizationFR|input type=categories|top category=Acronyms|height=200}}}

Here's the output:
New Organization (English): Category OBPGCategories not found
New Organization (French):
[-] Acronyms
no subcategories

Any help would be sincerely appreciated! Stlauc 15:08, 16 June 2010 (UTC)Reply[reply]
I don't know - somehow there's a difference between those two categories. Without seeing the wiki directly, I don't know how much more help I could provide. Yaron Koren 15:47, 16 June 2010 (UTC)Reply[reply]

I solved it by putting an   in the Category because it was a root category without any page text, and whenever I saved it before it didn't create a page. OHHH!!!! That was so obscure! Using SF's CreateCategory page avoids this MW issue by populating it with "This is category X" text.

So that one's fixed, but I've still got a problem - the categories appear as text on the form, but they don't categorize the page. How do I get [[Category:MyCat]] on the page with a nice GUI select box for a category tree? Stlauc 15:11, 17 June 2010 (UTC)Reply[reply]

Oh... that makes sense. For the second question - you need to have something like {{#arraymap:{{{NewOrganizationEN|}}}|,|x|[[Category:x]]|}} in the template. Yaron Koren 15:46, 17 June 2010 (UTC)Reply[reply]

Thanks Yaron, it works great. I added another conversion to display the category names on the form as the real categories dropped to the bottom of the form. Here's what's working for me: <{{#arraymap:{{{NewOrganizationEN|}}}|,|x|[[Category:x]]|}}{{#arraymap:{{{NewOrganizationEN|}}}|,|x|x<br>|}}

I've got two questions:

  1. Would defining a semantic property for categories buy me anything more than using a field of type=categories offers?
  2. Can I suppress the top category from displaying in type=categories?

Thanks so much, you're brilliantly helpful! Stlauc 20:08, 17 June 2010 (UTC)Reply[reply]

Hi, cool. 1. Probably not; 2. I don't think so. Yaron Koren 14:00, 18 June 2010 (UTC)Reply[reply]

Regular templates are not transcluded in "View" mode

I want to use some normal mediawiki templates in a semantic form which just contain text, so I added this wikitext to the semantic form:

{{Template:OBPG Program Banner}}

The banner appears in "Edit with Tab" mode, but not when I view the form.

What's "Edit with Tab" mode? Yaron Koren 22:52, 14 June 2010 (UTC)Reply[reply]
Sorry, that should be "Edit with form". The ideal scenario is to display the Program Banner always (in view & edit modes), and on "Edit with form" mode, I'd like to transclude some instructions in an area that is read-only and on-demand (e.g., it can be expanded/collapsed). It's not suitable to make this link off-page because editors will lose unsaved work if they click the link. Thanks, Carole, 15 June 10:14 EST
What do you mean by viewing the form, then? Looking at the form-definition page, at "Form:..."? Yaron Koren 16:32, 15 June 2010 (UTC)Reply[reply]
It's what you see when you click the "Page" tab, e.g., http://mywiki.ca/wiki/index.php/Job_Connect_%28OBPG%29 (my wiki isn't accessible on the Internet, this is just shown as a sample URL). Carole, 15 June 2010
I see. There's no reason why the template would show up there - you added it only to the form itself. I think you're confused about the difference between the form and page layout - although they often look similar, they're defined in separate places. Yaron Koren 12:51, 16 June 2010 (UTC)Reply[reply]
Yes, I obviously am confused. Can you please help clear up the confusion?
  1. I made about about 5 templates, some with fields, and some normal mediawiki templates with just text.
  2. I made one form which includes them all (but if I understand, apparently the form should only include the templates with the fields).
  3. I create pages with my form using this syntax: {{#forminput:form=Program Information}}.
  4. Where should I transclude the templates of static contents that I want to appear in normal "view" mode (at least), and preferably on both "view" and "edit with form" modes? I previously used a preload & "create" inputbox to get this data on new pages.
*Answer: Put templates that you wish to appear on "View with form" on the form defined in #2 (above); put templates you want to appear on the normal "view" page on the template defined in #1 (above) according to where you want it to appear.

Got it, thanks. Stlauc 15:28, 16 June 2010 (UTC)Reply[reply]

You should stick it in the form definition (which you've done already), and in one of those five templates. Yaron Koren 15:46, 16 June 2010 (UTC)Reply[reply]

Thanks. Stlauc 16:45, 16 June 2010 (UTC)Reply[reply]

Version upgrade?

I know its tough to do what looks like great work you've done for love, but was just wondering if you had plans to upgrade for MW 1.16? I've installed 1.16 and SMW seems to work fine but this extension gives a generic exception when loading the Main Page. I tried to track down the source, but my php is not quite good enough yet to help more, sorry. If its just around the corner I could wait otherwise I could try simple forms in the meantime. I'd be happy to help with testing. Hoogs 05:32, 16 June 2010 (UTC)Reply[reply]

Hi, SF should already work fine with MW 1.16 (and even 1.17 alpha, which has been around for a while). What's the error message you're getting? Yaron Koren 12:48, 16 June 2010 (UTC)Reply[reply]
Uh ok then. I suppose it could be my settings as I have jumped from 1.11 to 1.16 (svn). This is the error I get when any page in the wiki is loaded:
MediaWiki internal error.
Exception caught inside exception handler
after I unpack SMW and SF into extensions/ and use this in my LocalSettings.php:
# Extensions
require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );
require_once( "$IP/extensions/StringFunctions/StringFunctions.php" );
require_once( "$IP/extensions/Cite/Cite.php" );
require_once( "$IP/extensions/Cite/Cite.php" );

require_once( "$IP/extensions/InputBox/InputBox.php" );
require_once( "$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php" );

include_once( "$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php" );

## Not yet working in 1.16
include_once( "$IP/extensions/SemanticForms/includes/SF_Settings.php" );
When loading the Main Page for example, it gets to Article.php:1004 ("$status = $poolCounter->executeProtected( array( $this, 'doViewParse' ), $dirtyCallback );") and craps out in the doViewParse fn as its executing one of the parsed objects. 23:08, 16 June 2010 (UTC)Reply[reply]
What do you see if you add "$wgShowExceptionDetails = true;" to LocalSettings.php? Yaron Koren 01:27, 17 June 2010 (UTC)Reply[reply]
Ah nice, thanks, the error is "Table 'wikidb.wbm_smw_ids' doesn't exist (localhost)". Looks like I missed something in the upgrade or installation of SMW. SMW doesn't cause any errors on its own, but then I haven't added any SMW wiki text yet 02:37, 17 June 2010 (UTC)Reply[reply]

Template Calls within Form Page

I have a form used multiple times. I see here that you just add the regular template call and make sure the {,|,} are all escaped. It doesn't seem to be working for me. I am no sure how wide to apply the HTML escaping. |- escaped? {{{for template|Device|label=Device Specifics}}} {| class="formtable" ---- escaped? {{{standard input|save}}} -----escaped?

Can you point me to the template example where this is done? It gets a little confusing with the multiple <includeonly>'s.

I can't think of an example template, unfortunately, but yes, you have to escape every {, | and }. Yaron Koren 13:59, 18 June 2010 (UTC)Reply[reply]

Increasing box size

Hi, I'm sorry for asking such an elementary question, but how do I change the size of the box in a Semantic Form? I have a property of type string which accepts a long list of values. I do not want to change the sizes of all boxes of string property, only that specific property. What parameters do I provide in the form code to make that happen?

Thanks and sorry again for asking such a basic question Veryhuman 17:46, 17 June 2010 (UTC)Reply[reply]

The default size of 'String' type is 35, to change it in the form...
! FieldLabel:
| {{{field|propertyname|size=100}}}
if you want several lines, change type to 'Text' and default is 5 lines x 30 chars. ---Scott
Thanks for the reply! However, I worry that changing type to text makes it unsortable in semantic query tables. Wonder if I can have more lines in the box while keeping property type as string. Veryhuman 19:14, 17 June 2010 (UTC)Reply[reply]
Yes - add "|input type=textarea" to the field tag. Yaron Koren 19:42, 17 June 2010 (UTC)Reply[reply]

How to make the free text box big enough

hi I was wondering does anyone know how to make the free text box 100% width on the page, and make it go for every form? Please help?--Technobliterator 21:05, 17 June 2010 (UTC)Reply[reply]

There might be an easier way to do it, but you can do it by setting the "class=" parameter in the free text tag, then adding an entry for that new class in the MediaWiki:Common.css page and setting "width: 100%". Yaron Koren 13:58, 18 June 2010 (UTC)Reply[reply]
Thanks so much!--Technobliterator 16:32, 18 June 2010 (UTC)Reply[reply]

apparent #ask bugs caused by caching

Caching caused me a lot of grief testing #ask code for quering properties on my forms. If you have the same problem, install Extension:MagicNoCache. To test the query without the extension, click the "Refresh" tab on the page with the query, or resave it (if you aren't a sysop). Also, the Property:XXX page always displays the right data. Stlauc 16:23, 22 June 2010 (UTC)


#arraymap "messes" with form input

It seems #arraymap in a template influences how Semantic Forms offers form input. Now I have a case where this raises in issue.

The wiki in question has a mildly complex property "stroke order" that while it consists of several "stroke"s it is not used as a typical list type. This is mostly due to the fact that two different separators are allowed (" " and "-") to separate "strokes", which Semantic Forms doesn't support. Now this didn't raise any issue until I mapped the initially mentioned property "stroke order" onto the "stroke"s using #arraymap ({{#arraymap:{{{StrokeOrder|}}}|<nowiki> |x|{{#arraymap:x|-|y|Stroke::y|-}}| }}</nowiki>). The later property makes use of the [[Allows value:: ... ]]] functionality. The outcome: instead of the text input from the regex input type (from the particular extension) I would see a simple drop down allowing me to only input one "stroke".

Am I doin' it wrong, or is Semantic Forms being too quick to apply a special input type? Help appreciated --Christoph Burgmer 18:30, 19 June 2010 (UTC)Reply[reply]

I'd say you're definitely taking #arraymap to its breaking point by trying to use it to split an array using two different delimiters. It could be that you could do what you're trying to do using ArrayExtension; if so, that's worth a shot. Yaron Koren 23:21, 20 June 2010 (UTC)Reply[reply]


Hi, I'd like to know what code should I add to the common.css to make the free text box 100% wide? Or to do anything? Can you please give me an example? Thanks --Technobliterator 20:14, 20 June 2010 (UTC)Reply[reply]

I made an example of this on Discourse DB, since I figured it would be good to have a demo of it somewhere. You can see the changes I made here and here; and the result here. Yaron Koren 23:34, 23 June 2010 (UTC)Reply[reply]

Multiple instance templates button

Hi, I was wondering if instead of "Add Another" as text in a multiple instance template, I could have "Add another book" or "Add another form"...essentially how do I change the button label?

Thanks! Veryhuman 23:46, 20 June 2010 (UTC)Reply[reply]

You can change the value of "Add another" across the entire site, but there's no way for it to have different values in different forms. Yaron Koren 01:57, 21 June 2010 (UTC)Reply[reply]
Oh! ok...thanks anyways for the reply! Veryhuman 02:15, 21 June 2010 (UTC)Reply[reply]

Possible bug when using file link extension with Semantic Forms

Hi, I am using a file link extension that allows me to link to files within our network. The syntax is such:


When I choose the "Edit With Form" tab, all text is missing after the "</".
Is there an escape character I can use to allow this extension to work with semantic?
Thank you much
Jardennis 14:43, 24 June 2010 (UTC)Reply[reply]

That sounds like a bug in SF... but you might be able to work around it by replacing '<' and '>' with '&lt;' and '&gt;'. Yaron Koren 15:06, 24 June 2010 (UTC)Reply[reply]

I apologize, but I mispoke earlier. The file link extension works fine when using the syntax I used above.
When I use a pipe character to give a friendly name for the link, all text after the pipe character is missing.

<file>\\drive\folder\file|Friendly Name</file>

Everything after the pipe character is missing. Please note that I am populating a text field that associated with a template.
I tried using "# &124;" but the displayed text turns out to be \\drive\folder\file& #124; Jardennis 15:15, 24 June 2010 (UTC)Reply[reply]

Hi - yes, that's a problem, but I believe it can be fixed by calling the extension as a parser function instead of a tag function, using the #tag function - see here for how to do it. Yaron Koren 22:00, 28 June 2010 (UTC)Reply[reply]

Inline autocompletion

Greetings. I believe I have run across a limitation of inline autocompletion. I have a category with 3500 entries, and only about 1,000 are put into inline HTML on the page. This is roughly 64k characters on one line, so I think the limitation may have to do with how many characters you can force into one line of HTML rather than the number of categories. Either way, the autocomplete on our site fails silently, so it may be hard to know that fields are not coming through. To fix this, just use "remote autocompletion" in the field, as AJAX can handle the high-number-value entries. Since wikis inevitably grow over time, it means that inline autocompletion would usually not be safe to use. Does someone else have different information?

--Rmckeel 15:20, 24 June 2010 (UTC)Reply[reply]

Just found this, so this intentional. Perhaps leaving this in the discussion thread will help someone else.

The set of a field's possible values for autocompletion is, by default, contained right within the form's HTML page, in a Javascript declaration. For performance reasons, there is a limit to how many values can be placed in the page; this number is defined in the SF's "SF_Settings.php" file, as the variable $sfgMaxAutocompleteValues, and by default it is set to 1000. If you have more than this number of possible values for a field, you may want to use remote autocompletion instead, where autocompletion happens through an Ajax call to the server, based on what the user has typed. This type of autocompletion is slower, but always returns a comprehensive set of results. You can enable this by adding the "remote autocompletion" parameter to the field's definition. --Rmckeel 16:00, 24 June 2010 (UTC)Reply[reply]

Redirecting redlinks and property type image

Hi there,

I have three independent questions. I'd be very glad if I could get help on these "obstacles". My questions are as follows:

1)How do I redirect redlinks obtained from a list of values to a particular page? What I mean is, users enter a bunch of values separated by comma in the Semantic Form. These values are actually different synonyms of the page title. After splitting the list into independent values, since I have assigned the values "type:page", they all show up as redlinks in the final page. However, I want to redirect all the synonyms to the same page. How do I do that? (I hope my question is clear)

2) Is there a property type "Image" or "File"? What I want to do is something like this.

Take all the pages in the Category Mountains and pull out only the images from those pages and display 10 of them in a gallery.

{{#ask: [[Category:Mountains]]
| ?Modification date
| ?image
| sort=Modification date
| order=descending
| format=imagegallery
| imagelimit=10

Is this functionality possible?

3) How do I make a list of all properties?

Thanks a lot!

Veryhuman 21:32, 24 June 2010 (UTC)Reply[reply]

Hi, 1) I don't think that's possible via SF - I don't think you can create a redirect via a template; 2) That's an SMW question; 3) See Special:Properties and Special:UnusedProperties. Yaron Koren 21:55, 25 June 2010 (UTC)Reply[reply]

Thanks Yaron. I just sent out an email to the SMW group for their suggestions on this. Sorry for the question duplication.

With regards to 3) what I meant was, get a list of all properties through an in-line query. I figured that out

{{#ask: [[Property:+]]}} 

. Also, for (1), after reading some previous archived SF posts, I was wondering whether you could pass in multiple values to #arraymaptemplate? So, if I do something like


where redirecttemplate

[[{{{pagetitle}}} {{{synonym|}}}]] 

it wont work? (this code is not working currently, btw) Thanks a lot, Yaron! Veryhuman 22:33, 25 June 2010 (UTC)Reply[reply]

3) was also an SMW question, but it looks like you found a solution for it on the mailing list. Yaron Koren 22:01, 28 June 2010 (UTC)Reply[reply]
Yes, I did! For people who come here for the same question, a list of all properties can be obtained by typing
{{#ask: [[Property::+]] | format=list }}

Thanks! Veryhuman 01:56, 8 July 2010 (UTC)Reply[reply]

Preload data but not semantic properties

Maybe I'm wrong, but I remember to have read somewhere that there is an option / a parameter to make preload data to be imported but not semantic properties associated. By specifying something in the template instead? However, I've not been able to find it again. Any idea? --Toniher 12:49, 25 June 2010 (UTC)Reply[reply]

Why don't you want properties associated? Yaron Koren 21:52, 25 June 2010 (UTC)Reply[reply]

User experience with "one-step process" - button links do not seem to work properly

On my system, "link type=post button" does not seem to work for the "one-step process". "Link type=post" works beautifully, however.

--Fungiblename 15:32, 25 June 2010 (UTC)Reply[reply]

Floatbox pop-up IE error

Is anyone else getting their floatboxes filled with error/text such as :

'); */ /** IE 6 Z-index bug workaround for anonnotice ************************** * * Description: This implements a work around for the Z-index bug found in Internet Explorer. * It correctly places the anon notice on the page, even under IE6. * See this Google search for more information about the bug: * http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%

I'm using IE7. The pop-up is for a file upload, and the correct form fields appear after scrolling to the bottom. Is there some way to mask this text or address this error? --Sxtynnmach1 18:00, 28 June 2010 (UTC)Reply[reply]

Really silly request

I've been tasked with making the form-edit fields WYSIWYG. Or in the alternative, at least having a toolbox on the forms for easier formatting. I'm just looking for a launch point here. I would think this would be as easy as plopping the code into the SF_FormEdit files? Has anyone ever tackled this before? I haven't seen any discussion on it. Thanks, Thorncrag 18:33, 28 June 2010 (UTC)Reply[reply]

You can already have the "free text" field be editable using the FCKeditor, just by installing the FCKeditor extension. If what you're talking about is other form fields (presumably textareas only), that's never been done before, though it would be nice functionality. If you have the time to implement it, feel free to send me an email - I have some thoughts on how best to do it. Yaron Koren 22:04, 28 June 2010 (UTC)Reply[reply]
That's pretty much exactly what I need to do... :-( (super frown). Thorncrag 23:23, 28 June 2010 (UTC)Reply[reply]
I just noticed and realized that the FCKEditor is not even working on the free form text area as expected. I wonder if anyone else is also having this issue as well, on MW 1.15.3/1.16b3, SF 1.9. Thorncrag 23:32, 29 June 2010 (UTC)Reply[reply]

Preloading using formlink disables mandatory fields

Being essential to my project I noticed how users were 'evading' the mandatory fields in forms they are using. Reckoned it might be the default value issue but that wasn't the case. It seems that when I call a form using formlink and giving it values to pass along the mandatory-ness of the fields in the form is being disabled. When I removed the preload stuff from the formlink it worked fine, just as using the form from it's own page. Since I simply can't do without preloading stuff into the form (to make using it much, much, much more easier and less prone to user-error) my question is urgent: Is it possible to preload and have mandatory fields at the same time?

Some code: {{#formlink:SPRINTUP Aanbod|Aanbod toevoegen|button|SPRINTUP/Aanbod[instituut]={{PAGENAMEE}}&SPRINTUP/Aanbod[onderwijsinstelling]={{#show:{{PAGENAMEE}}|?onderwijsinstelling}}}}

The #formlink part 'SPRINTUP/Aanbod[instituut]' is being used in the form to create the page at the proper place (as a subpage of the value being passed along). This is the most essential part of the formlink usage, I could do without preloading other info, but this (in my opinion) defines the use of #formlink.

In the form you can see it being used to define the target page, 'SPRINTUP/Aanbod[paginatitel]' is the name of the field that users fill out themselves in the form: {{{info|add title=Aanbod toevoegen|edit title=Aanbod bewerken|page name=<SPRINTUP/Aanbod[instituut]>/<SPRINTUP/Aanbod[paginatitel]>}}}

Thanks in advance, Boudewijn Geijtenbeek 09:20, 30 June 2010 (UTC)

PS My apologies for the possibility of the dutch names in the code being gibberish to some ;)

Is there any way you can replicate this problem on http://scratchpad.referata.com? That would help me a lot in debugging it. Yaron Koren 15:53, 30 June 2010 (UTC)Reply[reply]
I seem to have slightly replicated it in the sense it doesn't work at all anymore: http://scratchpad.referata.com/wiki/User:Boudewijn_Geijtenbeek It went bad when I changed to order in which stuff is being passed along by #formlink. This is also what I have managed to debug on my project and found out that passing a value to a property (visualised as a radiobutton with several allowed values) in the form seems to be the problem from ignoring the mandatory check. Hopefully this doesn't sound to hazy and it is somethin you can work with. Boudewijn Geijtenbeek 15:48, 1 July 2010 (UTC)Reply[reply]

Another silly request

I am trying to change the default behavior of the upload window to insert the filename but with [[Media:__NAME__]], but I can't quite figure out how. I see in SF_UploadWindow2.php the function addUploadJS but I can't seem to manipulate it to do what I want. I had thought it would be relatively straightforward, but it's proving to be a little more difficult! Thorncrag 21:44, 30 June 2010 (UTC)Reply[reply]

I was able to accomplish this with a quick-and-dirty code change to specials\SF_UploadWindow2.php, which I added to line 390:
		$pre = '[[Media:';
		$pos = ']]';
		$basename = $pre.$basename.$pos;

Hope this helps someone. Cheers, Thorncrag 18:50, 5 July 2010 (UTC)Reply[reply]

Return to "Page Forms/Archive June 2010" page.