Extension talk:Semantic Forms

From MediaWiki.org
Jump to: navigation, search
An archive box Archives 

Contents

Upload file Window doesn't popup[edit | edit source]

When i click on "Upload File" nothing happens - i have the extention fancybox installed and set $wgBreakFrames= false; When i change this variable to true and then back to false - The upload Window popsup, but only for the next form you are filling out. And then for the second form you want to fill out -> nothing happens, when you click on upload File. This is a cut of my formcode:

Beitragstitel: {{#forminput:form=Problem|autocomplete on category=Übersicht|size=60|limit=50}} fckLR
<div id="wikiPreview" style="display: none;  padding-bottom: 25px;  margin-bottom: 25px;  border-bottom: 1px solid #AAAAAA"></div>
{{{for template|Tabelle}}}
{| class="formtable"
|-! Problemanhang:
| {{{field|Problemanhang|uploadable}}}
|-! Lösung:
| {{{field|Lösung}}}
|-! Lösungsanhang:
| {{{field|Lösungsanhang|uploadable}}}
|}
{{{end template}}}
{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|cancel}}}

This is a cut of my templatecode:

{| class="wikitable"
! Datum
| [[Datum::{{{Datum|}}}]]
|-
{{#if:{{{Problemanhang|}}}|! Problemanhang
{{!}} [[Image:{{{Problemanhang|}}}|200px]] {{#set:Daten=File:{{{Problemanhang|}}}}}}}
|-
{{#if:{{{Lösung|}}}|! Lösung
{{!}} [[Lösung::{{{Lösung|}}}]]}} 
|-
{{#if:{{{Lösungsanhang|}}}|! Lösungsanhang
{{!}} [[Image:{{{Lösungsanhang|}}}|200px]] {{#set:Daten=File:{{{Lösungsanhang|}}}}}}}
|}
[[Category:Übersicht]]
</includeonly>

I would be really greatfull, if you could help me!

See the 5th item here. Yaron Koren (talk) 14:49, 2 July 2014 (UTC)

This is very funny - with &debug=true the upload File window pops up :P And i tested now too with IE and there it works.. I guess there is no possibility to allways set &debug=true at the end of the URL?

Oh, that's too bad - it makes the JS problem (whatever it is) hard to isolate. There's no simple way to do that, but I believe you can accomplish the same thing by adding the following to LocalSettings.php:
$wgResourceLoaderDebug = true;
It's not recommended as a long-term solution, though. Yaron Koren (talk) 15:23, 3 July 2014 (UTC)

Issue with sfautocomplete (values from url)[edit | edit source]

Hello Yaron, I'm having a problem with autocomplete (values from url). When I use values from property or category and start to type in a value on the form, all the values that can be excluded fall off the selection list. However, when I use values from url it only highlights the applicable values instead of eliminating the others. So I am left with a long list of possible values with some highlighted. Is this the way in which the values from url functionality was programmed? Thanks.

Info:
LocalSettings.php = $sfgAutocompletionURLs['Name'] = '<url>.php?search=<substr>';

Form Field = awesometestnames

This is what the php call shows = {"sfautocomplete":[{"title":"Name 1"},{"title":"Name 2"}]}

Clifford.kasper (talk) 21:23, 2 July 2014 (UTC)

That's not good... it sounds like a bug. As it turns out, all of autocompletion, including autocompleting on external values, is getting overhauled as part of this project. If you're willing to wait a month or so, the whole thing will hopefully work a lot better by then. Yaron Koren (talk) 23:31, 2 July 2014 (UTC)


Thanks Yaron Koren. We'll wait until this project gets released before we look any further into it. It looks like a very promising update. Clifford.kasper (talk) 18:12, 11 July 2014 (UTC)

mandatory parameter stopped working for combobox[edit | edit source]

Hello,

As in subject. It was working until today, today suddenly it stopped working. I haven't changed anything in the wiki at all. When you save the form with empty combobox fields, it does not tell you that the field cannot be empty. Mandatory parameter works with other input types!

Any ideas why this is happening?

Have you updated the SF code recently? "combobox" handling changed quite a bit in the last few weeks, in the Git code. Yaron Koren (talk) 18:37, 7 July 2014 (UTC)

Haven't changed anything. It just stopped working. Should I try updating it?

You could update... another option is to look in the JavaScript console, if you know how to do that - my guess is that there's a JS error somewhere, that blocks the combobox checking from taking effect. Yaron Koren (talk) 13:29, 8 July 2014 (UTC)

Form with value mapped to TWO properties[edit | edit source]

What I am trying to do is set the value that the user inputs into the combobox to both the Has Primary Category AND Has Category. Is there a way to do this or am I going to have to find a completely different way to do something like this?

This is what I am trying to use:
! Primary Category:
| {{{field|Primary Category|input type=combobox|values=Has Child|property=Has Primary Category, Has Category|mandatory|existing values only}}}

The form doesn't set the property value; the template does. You would just need to modify the template to set both of those properties to that field/parameter. Yaron Koren (talk) 17:19, 11 July 2014 (UTC)
Thanks Yaron, this just made my job 20x easier.

'View with form' -> can I force a page/category always to open with the form?[edit | edit source]

The 'edit with form' is working very well.

Unfortunately, when the form is saved, the format is not attractive to end-users.

It would be really useful if they could only, or, at least as a default, see the page open in 'Edit with form' - or, even better, an exact alternative 'View with form' that didn't allow changes. The latter would be nice, but isn't crucial.


I see that I can hide the 'edit' tab, but that doesn't really help if it opens in the standard 'read' view, not the form view.

It might work if you could set 'save page' to save the page, but then open it in 'edit with form'.

I"m sure that this can, and is, done, so I know I'm probably missing something obvious!

If you're talking about displaying the form instead of the actual page, I don't believe that can be done. Why not just improve the display of the template(s)? Yaron Koren (talk) 12:29, 15 July 2014 (UTC)

Image uploads on mobile?[edit | edit source]

Has anyone come up with a way to make the image upload work on mobiles? When the pop up launches, it causes a new page on mobile browsers. The new page allows uploading from the mobile browser, but it doesn't insert the image name into the form after the image is uploaded. It just leaves the user at a blank page, causing confusion. I wonder if there's a way to force mobile browsers to allow a pop up?

Notice: Undefined offset: 0[edit | edit source]

Im recieving the following error whenever I try to create a new form

Notice: Undefined offset: 0 in /erp/webcontent/mediawiki/extensions/SemanticForms/includes/SF_FormField.php on line 234 Notice: Undefined offset: 0 in /erp/webcontent/mediawiki/extensions/SemanticForms/includes/SF_FormField.php on line 234

I have been trying to fins the source of this error to no avail. Does it have something to do with having two Hidden fields on my form?

What page are you on when you're creating this form, and does it let you create the form or not? A notice message by itself shouldn't halt the process. Yaron Koren (talk) 19:37, 15 July 2014 (UTC)
I am on Special:CreateForm and it does let me create the form. But I dont understand what the problem is. And for my main form to create new articles it will load the form and allow input, but then freezes mid completion for 5-10 seconds. Once it unfreezes, everything is fine and the article is created like it should be. I do not know if this could be caused by the warning, but it does not throw any errors or warnings when I have the debugger on.
Alright, that's good to know. The second issue seems unrelated - it sounds like normal Javascript loading time. Yaron Koren (talk) 00:59, 16 July 2014 (UTC)

Updating all Pages which use a form[edit | edit source]

So this is probably a very unintelligent question but I have looked all over and I cannot seem to find the right answer. I have a form which I am constantly making updates to based upon new needs from my company. Currently there are over 100 pages which use this form. When I add a new {{{Field}}} tag the only way I know to update each page (template) is to Edit with form and then save the page without making any changes.

For instance, if I added the following to Form:New Task

{{{field|NeedDate|input type=date|default=now|hidden}}}
{{{field|SubmissionComplete|values=true,false|default=false|hidden}}}



Then in Template:Task I added:

{{#vardefine:time|{{#time:F j, Y|now}}


{{#switch: {{{SubmissionComplete|false=
{{#autoedit:form=New Task
| target={{PAGENAME}} 
| link type=button 
| link text=Submission Complete
| query string=New Task[NeedDate]={{#var:time}}
| reload}} | }}


Summary required by: {{#switch: {{{SubmissionComplete
|true=[[Summary Req::{{#time: Y-m-d|{{#expr: {{#time:U|{{{NeedDate|}}} }} + 432000}} }}]]
|false=The submission is not complete.}}

So I have a few things like this on my site. In this the user would click on the button Submission Complete which would set the current date to the Form Field=NeedDate. That field date would feed into the Template, add 5 days and set the due date for the Summary. It is also tied into the Semantic Tasks Extension to send an email update until I can figure out how to work this in with Echo.

The problem is that once I update the Form, it does not populate all the pages which use that form with the new {{{field}}} and there will be multiple errors. If I run SMW_refreshData.php or runJobs.php it will update the Template and property values but it will not add the field to the pages. Is there any script or way to automate this? Thanks!

Clifford.kasper (talk) 15:41, 17 July 2014 (UTC)

Have you tried using the Replace Text extension? There might be a fairly straightforward solution there using regular expressions and wildcards. Yaron Koren (talk) 19:31, 17 July 2014 (UTC)
Yaron Koren, thanks for the quick reply. I'm not wanting to replace something but to add the form Field to the pages. If I used the Replace Text and Identified a line on the form, say a Field tag above where I wanted to add the new one and replaced that Field tag with a new string to include the replacement and the addition, I might overwrite some existing data. Does this make sense? Thanks. Clifford.kasper (talk) 14:00, 18 July 2014 (UTC)
It wouldn't overwrite existing data if you used wildcards. Yaron Koren (talk) 23:20, 18 July 2014 (UTC)

Popup forms[edit | edit source]

I'm either not understanding this, or it isn't working.

I've got a form that works OK. It also works with a file up-load pop-up screen.

I've tried to get the other form to work as a pop-up, but it just goes to that form's page, then, when you fill it in, doesn't return to the original page.

Does the 'popup' have to be in a particular place, or do you have to have some other extension for it to work?

Fustbariclation (talk) 09:59, 22 July 2014 (UTC)

No, and no. Could it be that there's some other Javascript error that's preventing the popup from happening? Yaron Koren (talk) 12:59, 22 July 2014 (UTC)

'add button text=' not working for a file upload[edit | edit source]

The {{{field}} tag seems to be ignoring the 'add button text=' - this is with 'uploadable' set. It sets the 'default value' on the file upload pop-up, but it's not filling in the default value in the form. What is the obvious thing that I'm missing?

Does the order matter? I thought that part of the point in having named parameters was so that it didn't.

....
| Action tracker file:
| {{{field
|Action tracker file
|uploadable
|add button text=Upload action tracker file
|default filename=actions_<page name>.docx
|remote autocompletion
|class=tracker file
|property=tracker file
|default value=actions_<page name>.docx
}}}
...

In the template I've got:

==Action tracker file==
[[Property:Action Tracker File|Action Tracker File]]
[[File::File:{{{Action Tracker File|}}}]]

Fustbariclation (talk) 10:04, 22 July 2014 (UTC)

"add button text" is a parameter for the "for template" tag, not the "field" tag. Yaron Koren (talk) 13:07, 22 July 2014 (UTC)

Trouble with using 'Email' for a default value[edit | edit source]

Most of the default values work perfectly well.

I've been having trouble matching e-mail addresses.

! Logged_Email:
| {{{field|Logged_Email|input type=dropdown|class=Logged_Email|property=Incident Logged Email|default={{#username:}}@kchclinics.com|values from property=Email|rows=1|cols=20|size=20}}}

I know that the usernames are all in the same format as the e-mail addresses - deliberately, so I can do this sort of thing. I've tried various alternatives such as:

default=mailto:{{#username:}}@kchclinics.com
default=Mailto:{{#username:}}@kchclinics.com

It doesn't seem to pick it up though. It says that special properties can be used like other ones, but there's clearly some difference that I'm not understanding.

Fustbariclation (talk) 11:40, 22 July 2014 (UTC)

"#username" is not a special property; it's a parser function. And I'm guessing the issue is that the "default=" value isn't parsed, which means that you can't include parser functions there. If that's the case, that can probably be easily changed/fixed in the SF code. Yaron Koren (talk) 13:09, 22 July 2014 (UTC)

How can i use "values dependent on" parameter?[edit | edit source]

where i can see an example how can i use "values dependent on" parameter?

if not exist an example... my doubt is the next:

i have this:

 {{{field|Country|input type=combobox|values=USA,CANADA,MEXICO}}}

 {{{field|City|input type=combobox|values dependent on=Restaurant[Country]}}}

if i chose USA on the first "field", the second "field" should show values like: NEW YORK, HOUSTON, CHICAGO; LOS ANGELES... my question is: where must be those names of cities?... are properties?, are values of properties?, are pages?, are categories?

i hope can help me... Crystian Marquez

Yes, you have it right. Those city names have to appear in pages in the wiki that use the "Restaurant" template, where "Country" is set to "USA". Yaron Koren (talk) 20:06, 24 July 2014 (UTC)

I cannot make it works...

i have this

Template:Resturant

{|class="wikitable"
!Country:
|{{{Country|}}}
|-
!City:
|{{{City|}}}
|}

Form:Restaurant

{{{for template|Restaurant|label=Restaurant}}}
{| class="formtable"
! Country:
| {{{field|Country|input type=combobox|values=USA,Canada,Mexico}}}
|-
! City:
| {{{field|City|input type=combobox|values dependent on=Restaurant[Country]}}}
|}
{{{end template}}}

and have three diferent pages: Houston, New York, Chicago... whit this code:

{{Restaurant
|Country=USA
|City={{PAGENAME}}
}}

when i want create a new page of an other city for example "Boston" whit the "Restaurant" form, it suppose that the "City" field must show values like Houston, New York, Chicago, at the combobox... but it does not, am i doing something wrong? Crystian Marquez

It's strange that you're using the "Restaurant" template to define cities - Houston is not a restaurant. :) Still, that should work - the only thing that you're missing is that the template needs semantic properties for both "City" and "Country". Yaron Koren (talk) 16:49, 28 July 2014 (UTC)

Thanks!!!...i finally got it work, what i needed was the semantic property...

Autoedit and multi-instance templates[edit | edit source]

Hello! The autoedit function is a real hit with my users. I'm trying to apply it to an embedded multi-instance template that sets some subobjects, but having some trouble. When the button is clicked the page gets modified, but the template values are blank (and it leaves 2 of these blank instances?). The autoedit query string is specifying the name and fields of the embedded template. Should I be specifying something else/more that identifies the template+field set with 'holds template'? Or something else? Using Special:FormEdit/myform works exactly as intended. Thanks! - Lbillett (talk) 14:37, 25 July 2014 (UTC)

After some more experimenting the issue might be better described as - autoedit blows up on multiple instance templates. I expected it might respond by creating a new template instance on the target page (if the 'for template' tag was set to multiple). Might there be another way to accomplish the end effect?
I'm trying to create a simple way to collect dated acknowledgements from users on a target article. I thought I could accomplish it with an autoedit link that would add their username and date as a subobject to the target. If autoedit+multiple instance templates can't do it, is there another way I maybe haven't thought of? The multiple temps and subobjects would allow a lot of useful queries like 'what articles has user x acknowledged and when?' or 'what users have acknowledged article y'. - Lbillett (talk) 18:52, 25 July 2014 (UTC)
Ah. I'm describing a planned feature. Move along, move along. - Lbillett (talk) 00:44, 27 July 2014 (UTC)
Right. :) The handling of multiple-instance templates within #autoedit is definitely lacking at the moment. Yaron Koren (talk) 12:53, 28 July 2014 (UTC)
WORKAROUND! While not as elegant as adding multiple subobjects on a target article, #audoedit can handedly create sub-PAGES of the target article. Then, adding the target article as a page-property to the sub-page enables similar functionality. Likely takes up more space in the tables, but works! - Lbillett (talk) 17:57, 2 September 2014 (UTC)

How to add poem tag within semantic forms[edit | edit source]

I have a semantic form which is working well. However, I have not found a way on how to include the poem extension tags. This means that users have to include the

<poem></poem> 

tag into the input box before typing information in. Is there a simple solution for this. Thanks.

Wikimanz (talk)

If the tag is supposed to cover the entire field, just add it to the template. Yaron Koren (talk) 16:04, 27 July 2014 (UTC)

Cannot make |show on select work with <headertabs/>[edit | edit source]

Hi, I am trying to make something like this work in SF but cannot make the headertabs work together with |show on select:

Is it supposed to work?

{{{field|testfield|input type=checkbox|show on select=Yes=>Yes}}}

<div id="Yes">
=heading1=
text
=heading2=
text
=heading3=
text

</div>

=heading4=
text

<headertabs/>
I would be surprised if that could work... Yaron Koren (talk) 12:52, 28 July 2014 (UTC)
Maybe try using the <h1>heading1</h1> <h2>etc. tags instead of wikitext sections? Sometimes that can make a difference. - Lbillett (talk) 13:09, 28 July 2014 (UTC)
Oh, you want the tab to appear? I'm way off, then. - Lbillett (talk) 13:11, 28 July 2014 (UTC)

Special:FormStart and #forminput / page name scheme[edit | edit source]

This is a follow-up to the corresponding thread in the January to March 2014 archive, discussing options to prevent users from accidentally overiding a semantic form page name scheme. What can be done is adding code to the form itself that checks whether the page name is either "empty" (in that case PAGENAME returns "Semantic Forms permissions test") or corresponds to the defined name scheme (for the latter a regex extension e.g. "regex fun" is needed). If neither is the case, a warning box is displayed suggesting to the user to follow a link generating an empty form with page name scheme. The following code illustrates this, assuming a form "ticket" and a name scheme "Ticket_####".

{{#switch: {{#regex: {{PAGENAME}}| /Ticket\s[0-9]{4}/ | Pattern-ok }} 
| Pattern-ok = 
| Semantic Forms permissions test=  
| #default = <div style="background:#faa;border:1px solid black;padding:5px;">
'''You are about to create a page not following the advised page name scheme. 
To create a page with an automatically generated correct page name 
please click [[Form:Ticket|here]]'''.</div>}}

--Hans Oleander (talk) 10:21, 30 July 2014 (UTC)

Can I recover my forms from a sqldump of the mediawiki database[edit | edit source]

I had to restart all my wiki from an xml dump, that sadly enough did not contain the .css and the forms.

Is there any (even manual) method from which I could extract the text of the forms from the sql dump ?

Eg after I replace some cryptic codes with the accented letters it refered to, I detect in table mw_searchindex, entries such as : (1239, 'auteur', ' ceci est le formulaire u8c2ab auteur u8c2bb. pour créer une page avec ce formulaire entrez le nom de la page ci-dessous ; si une page avec ce nom existe déjà vous serez dirigé vers un formulaire pour lu8e28099éditer. #forminput form auteur for template auteur class formtable prenom field prenom - nom field nom - particule field particule - pseudonyme field pseudonyme - datenaissance field datenaissance - datemort field datemort - role field role - codeauteur field codeauteur - portrait field portrait - legendeportrait field legendeportrait - wikipedia fr field wikipedia fr - wikipedia en field wikipedia en - wikipedia de field wikipedia de - wikipedia es field wikipedia es - nombre de séries field nombre de séries - nombres de tomes field nombres de tomes - nombres de livres field nombres de livres end template texte libre standard input free text rows 10 standard input summary standard input minor edit standard input watch standard input save standard input preview standard input changes standard input cancel ')

Any idea how I could reverse engineer from these ?

That's just the form definition without "{", "}", "|", etc., so yes, you could reconstruct it manually from that - or you could just use Special:CreateForm to create the form from the template, since this looks like a pretty standard form layout. Yaron Koren (talk) 18:01, 5 August 2014 (UTC)

Forms inputs "datepicker"[edit | edit source]

for "input type=date" works the next:

{{{field|date|input type=date|default=now}}}

but, for "input type=datepicker" does not works "default=now"


how can i do that "input type=datepicker" field prints the current date?

Crystian Marquez

That sounds like an issue for the Semantic Forms Inputs extension. Yaron Koren (talk) 00:51, 7 August 2014 (UTC)
Yes, notice that the only valid value for default is yyyy/mm/dd. Instead of 'now' you can put in {{#timel:Y/m/d}}. seems to work in my environment. - Lbillett (talk) 15:28, 7 August 2014 (UTC)

perfect! that works, thanks!

Embeded uploadable multiple instance template?[edit | edit source]

Uploadable multiple instance templates are working nice. Embedding them in a 'parent' template would allow for some nice control of the output. But when I try, the form seems to break (no upload link). I haven't found a working example (yet). Should it be possible under MW 1.21.2/SF 2.5.1? It's for helping my... 'less proficient' users display images on specific articles. My form definition look as:

{{{for template|My Template}}}
{{{field|Related Images|holds template=Related Images}}}
{{{end template}}}

{{{for template|Related Images|multiple|embed in field=My Template[Related Images]}}}
{{{field|Image|uploadable}}}
{{{end template}}}

The 'Related Images' template sets the 'Image' property (of type Page), and 'My Template' simply outputs the contents of the 'Related Images' field/argument (which I hope to be a series of calls to the 'Image' template). Am I missing something important? Thanks! - Lbillett (talk) 16:07, 7 August 2014 (UTC)

This might be part of the 9th item listed here. Does the "Upload file" link show up for "existing" instances? Yaron Koren (talk) 20:45, 7 August 2014 (UTC)
Experiencing the same problem myself and I'm on SF 2.8. Strange thing is, this used to work earlier this summer. And the upload file for Photos doesn't also appear for existing instances (see http://undpgeftest.referata.com/wiki/E-Waste_in_Bangladesh) --Jnatividad (talk) 20:43, 18 September 2014 (UTC)
That form doesn't currently have "uploadable" for a multiple-instance template... Yaron Koren (talk) 21:32, 18 September 2014 (UTC)
Ooopsss... I thought the "public" version was the same as the "private" dev version :) Anyway, I tracked down the problem to declaring "input type=text" since I was using SMW 1.9.2. It seems "upload file" doesn't work with textarea --Jnatividad (talk) 01:27, 19 September 2014 (UTC)
Ah - I thought at some point "uploadable" worked with textareas, but I guess it doesn't any longer. I'll have to look into that. Yaron Koren (talk) 03:53, 19 September 2014 (UTC)

values from query[edit | edit source]

i want values for a combobox that comes from a query, for example something like this:

{{{field|process|input type=combobox|values= {{#ask: [[Category:Process]][[Category:Macro]] {{!}} format=list}} }}}

i tried this but does not work. My question is: can i get values from a query?

Crystian Marquez

The best way to do it is to create an SMW "concept" that matches that query, and use "values from concept". Yaron Koren (talk) 01:12, 12 August 2014 (UTC)

Radio buttons without labels?[edit | edit source]

Is it possible to have radio buttons without labels? Any option to suppress labels in CSS? Tyvm, Psyc0smos (talk) 20:25, 16 August 2014 (UTC)

Yes, I would think so - you just need to put the CSS in MediaWiki:Common.css. Are you asking about the specific CSS to use? Yaron Koren (talk) 12:37, 18 August 2014 (UTC)
Tyvm, Yaron. My CSS knowledge is quite rudimentary but I found a (probably suboptimal) solution that works for us: font-size:0 and some left & right padding to center the actual button. Display:none doesn't seem to be an option since the label tag also includes the input. Psyc0smos (talk) 13:53, 20 August 2014 (UTC)

Combining properties in a query[edit | edit source]

Hi all

I'd like to merge properties all into one for a query.

At the moment I have this query set up:

{{#ask: [[Category:{{{category}}}]] [[Date::>{{{query start date}}}]] [[Date::<{{{query end date}}}]]
| ?Category
| ?Date
| ?TrainID1 
| ?AmicusID1
| ?ConCorrArr1
| ?ConCorrArrDet1
| ?ConCorrDep1
| ?ConCorrDepDet1
| ?TrainID2
| ?AmicusID2
| ?ConCorrArr2
| ?ConCorrArrDet2
| ?ConCorrDep2
| ?ConCorrDepDet2
| ?TrainID3
| ?AmicusID3
| ?ConCorrArr3
| ?ConCorrArrDet3
| ?ConCorrDep3
| ?ConCorrDepDet3
| limit=100000
| format=csv
}}


What i'd like to do is combine the different properties so the report has them all in the same column - for example:

{{#ask: [[Category:{{{category}}}]] [[Date::>{{{query start date}}}]] [[Date::<{{{query end date}}}]]
| ?Category
| ?Date
| ?TrainID1 + ?TrainID2 + ?TrainID3
| ?AmicusID1 + ?AmicusID2 + ?AmicusID3
| ?ConCorrArr1 + ?ConCorrArr2 + ?ConCorrArr3
| ?ConCorrArrDet1 + ?ConCorrArrDet2 + ?ConCorrArrDet3
| ?ConCorrDep1 + ?ConCorrDep2 + ?ConCorrDep3
| ?ConCorrDepDet1 + ?ConCorrDepDet2 + ?ConCorrDepDet3
| limit=100000
| format=csv
}}

Is this possible at all?

Thanks

This isn't a Semantic Forms question; but anyway, you would need to create new properties, one for each concatenation, and set them within the template. Yaron Koren (talk) 12:38, 18 August 2014 (UTC)

Conflict with WikiEditor extension[edit | edit source]

I am using MW 1.22, SF 2.7, and WikiEditor 0.3.1

When the following line is added to LocalSettings:

$wgDefaultUserOptions['wikieditor-publish'] = 1;

extra versions of the Edit Summary field as well as the Minor Edit and Watch this page checkboxes appear at the bottom of the page (under everything, including the footer, and running the full width of the page) whenever you create or edit a page using an SF form.

Note: the line in question adds Publish and Cancel buttons in the top-right of the editor.

This only happens on SF driven pages, and only when editing using the form.

Disabling the option or commenting it out solves the problem.

--Ramalj (talk) 21:39, 19 August 2014 (UTC)

Multiple instance templates not working in MW 1.24a and SMW 2.0 ?[edit | edit source]

Hi, we have trouble with multiple instance templates in a form. When "Edit with Form", there are JS errors (different ones, depending on the version). Clicking on "add another" button does no work (i.e. nothing happens).

Live example: http://edutechwiki.unige.ch/t/SF_multi_instance_2
MW = 1.24alpha (377a12e)
SMW = 2.0

Semantic Forms 3.0-alpha (8ab21f8) 12:42, 18 August 2014

TypeError: $.browser is undefined jquery.fancybox.js:29
TypeError: $content.find(...).makeCollapsible is not a function mediawiki.page.ready.js:23
TypeError: $.client is undefined mediawiki.searchSuggest.js:30

Semantic Forms 2.7 (8ab21f8) 12:42, 18 August 2014, and $wgIncludejQueryMigrate = true:

TypeError: jQuery.widget is not a function SemanticForms.js:19

Semantic Forms 2.7 (8ab21f8) 12:42, 18 August 2014, and $wgIncludejQueryMigrate = false:

TypeError: $.browser is undefined jquery.fancybox.js:29
TypeError: jQuery.widget is not a function SemanticForms.js:19
TypeError: $(...).live is not a function SF_submit.js:185

Is this a real bug ? and is there a workaround, like reverting to some other combination of SMW/SF ?

- thanx and greetings ! Daniel K. Schneider (talk) 14:10, 20 August 2014 (UTC)

PS: File upload also seems to have a problem, but I did not yet look into it in more details.

Try SF 3.0-alpha with "$wgIncludejQueryMigrate = true". Yaron Koren (talk) 15:36, 20 August 2014 (UTC)
Thanx Yaron, but unfortunately this doesn't work either - Daniel K. Schneider (talk) 15:05, 21 August 2014 (UTC)
Full FF trace:
Use of getUserData() or setUserData() is deprecated.  Use WeakMap or element.dataset instead. cacheobj.js:829
TypeError: $.browser is undefined jquery.fancybox.js:29
TypeError: $content.find(...).makeCollapsible is not a function mediawiki.page.ready.js:23
TypeError: jQuery.ui is undefined SemanticForms.js:19
TypeError: $.client is undefined mediawiki.searchSuggest.js:30
Full Chrome trace:
4 messages are hidden by filters. Show all messages.
Uncaught TypeError: Cannot read property 'msie' of undefined jquery.fancybox.js:29
(anonymous function) jquery.fancybox.js:29
(anonymous function) jquery.fancybox.js:1152
Uncaught TypeError: undefined is not a function mediawiki.page.ready.js:23
(anonymous function) mediawiki.page.ready.js:23
fire load.php?debug=true&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=20140821T14…:3119
self.add load.php?debug=true&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=20140821T14…:3165
(anonymous function) mediawiki.page.ready.js:14
(anonymous function) mediawiki.page.ready.js:50
Uncaught TypeError: Cannot read property 'autocomplete' of undefined SemanticForms.js:19
(anonymous function) SemanticForms.js:19
(anonymous function) SemanticForms.js:220
Uncaught TypeError: Cannot read property 'test' of undefined mediawiki.searchSuggest.js:30
(anonymous function) mediawiki.searchSuggest.js:30
fire jquery.js:3119
self.fireWith jquery.js:3231
jQuery.extend.ready jquery.js:3443
completed
That seems impossible... are you sure you have "$wgIncludejQueryMigrate = true" set? Yaron Koren (talk) 15:34, 21 August 2014 (UTC)
Found the problem. I had $wgResourceLoaderDebug = true; , since I somewhere read that it's good vodoo. Uncommenting the line fixed :) - thanx for your help ! - Daniel K. Schneider (talk) 17:06, 21 August 2014 (UTC)

Form actions URL[edit | edit source]

We use &usekin=skinname quite often to apply styling and mainly get rid off "noise" like the sidebar where it is not really needed, also for providing pages to embed in other off-wiki websites.

Using RunQuery as a example, on our wiki the form action looks like action="/wiki/Special:RunQuery/Form_name".

So the question whether it is somehow possible to get url parameters like &usekin=skinname in the form action? Ideally for the standard input buttons and #formlink & co as well.

Psyc0smos (talk) 14:35, 20 August 2014 (UTC)

That's interesting - I guess Special:RunQuery should carry over the value of "useskin". I don't think there's any way to get around that from within the form definition - but one option that might work is to have some extra code, in LocalSettings.php, that overrides the value of $wgDefaultSkin if $wgTitle is set to Special:RunQuery, Special:FormEdit, etc. Yaron Koren (talk) 15:39, 20 August 2014 (UTC)

using 'multiple' to insert multiple values[edit | edit source]

so im trying to insert multiple values of a certain template called people

{{{for template|people|label=add a new person|multiple}}}
{| class="formtable"
! Name:
| {{{field|Name|input type=text}}}
|-
! Age:
| {{{field|Corporate Position}}}
|-
! Birth year:
| {{{field|Birth year|input type=year}}}
|-
! Birth province:
| {{{field|Birth province|input type=text}}}
|}
{{{end template}}}

this works , but when i extract the output data into something like a CSV file i get all these multiple values in one field.

what is the alternative work around for me to separate these values into different fields or rows but using the same properties?

i hope i was clear , thanks

--Noopty (talk) 13:18, 25 August 2014 (UTC)

Instead of regular SMW properties in that template, you should be using subbobjects or the Semantic Internal Objects extension. Yaron Koren (talk) 14:00, 25 August 2014 (UTC)
Thank you Yaron! , if it is possible can you refer me to some examples or instructions on how to use them with Semantic Forms? --Noopty (talk) 05:02, 26 August 2014 (UTC)
I don't know how best to explain it, but if you just add a #subobject call to the "people" template, the whole thing should just work. Yaron Koren (talk) 12:55, 26 August 2014 (UTC)
Hi Yaron! so i added #subobject this way
{{#subobject:Corporate People
|Name=
|Corporate position=
|Birth year=
|Birth province=
}}
but still when i use multiple then extract the results in Special:Ask into a CSV i still get both names in 1 field separated by a comma, is my syntax wrong? --Noopty (talk) 05:37, 27 August 2014 (UTC)
Hi again!! i am so sorry i totally forgot how CSV files work and this is why i am getting the comma in my export! i found a work around since we cannot export the data to an excel workbook ( i dont know if there is an extension or we will get this soon) anyhow i find the results as Table save the page in HTML, open it in Excel then copy the table into another sheet and save it as a workbook. Sorry for the inconvenience thank you Yaron :)! --Noopty (talk) 06:20, 27 August 2014 (UTC)

Testing SF 3.0 alpha[edit | edit source]

Just a note to let you know that two features appear to conflict in the latest code. When a form contains a multiple-instance template as well as a field with 'combobox', the "Add..." button for the multiple-instance template becomes frozen - i.e. clicking it has no effect, at least in MW 1.23. Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 11:34, 26 August 2014 (UTC)

This problem isn't happening for me, here. Could you add "&debug=true" to the URL, then look in the Javascript console to see if there any JS errors there? Yaron Koren (talk) 13:04, 26 August 2014 (UTC)
TypeError: select[0].options is undefined 
=> SemanticForms.js line 24, under "combobox":
var curval = select[0].options[0].value;
This happens in combination with "values from category". Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 13:40, 26 August 2014 (UTC)
Ah, okay. That line is no longer in SemanticForms.js - could you try upgrading to the very latest version of the code? Yaron Koren (talk) 19:44, 26 August 2014 (UTC)
Haha, thanks. There I was thinking I was using the latest code. Special:Version confirmed that I was using at least a version of SF 3.0 alpha, but I must have misunderstood how Git works. I now clicked on the 'tree' link at the end of the latest change and downloaded this version, which seems to work perfectly fine! Loving the new Select2 features, btw. Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 21:12, 26 August 2014 (UTC)

toggle 'advanced options' in multiple-instance templates[edit | edit source]

Penny for your thoughts? I've been looking at ways in which every multiple-instance template in a form can have additional fields ('advanced options') that are initially hidden from view but can be shown on-the-fly. Of course, there's MW's own implementation of collapsible elements, but as you know, they don't work for newly added templates. Having looked around for a bit, I finally stumbled on two possible solutions, both of which are skin-specific:

  • Skin:Foreground: offers navigation tabs ([1]) that can be embedded inside a 'multiple form';
  • Skin:BootStrapSkin: offers collapsible/expandable jQuery portlets that can be used inside a 'multiple form'. The skin still suffers from a few js-related issues (at least, if you're using SMW), but it seems worthwhile keeping this in mind.

It would be wonderful if this functionality was available to any SF user. Or do you know of any alternatives / suggestions? Perhaps you have even got plans to address this specific need? Best, Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 13:00, 27 August 2014 (UTC)

I doubt those would work either... the basic problem is that custom JavaScript elements don't work in newly-added templates, and that's because, when HTML is added dynamically to a page, any such JavaScript has to be specifically applied to that new HTML. So, for this to work, whether it was MediaWiki's collapsible elements or anything else, I would think that Semantic Forms would have to set up some sort of JS "registry", where the set of all JS functions that are supposed to be applied to new template instances is stored. I actually looked into this briefly before, but gave up; but my guess is that it's doable. Yaron Koren (talk) 15:28, 27 August 2014 (UTC)
Actually, I got both of these working using the respective skins, or at least the jQuery functionality appeared to be in order. What I haven't checked, admittedly, is whether the input data are all properly processed when the page is saved, so that will have to be done first. I just tried to borrow some css and js from the Foreground skin in order to create a 'Gadget', but some javascript elements always send me to an error page saying "Method not implemented". What about jqGrid, which allows you to hide/show columns or to use modals for editing rows? Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 20:56, 27 August 2014 (UTC)
jqGrid is mentioned in the third item here - is that the kind of thing you're talking about? Yaron Koren (talk) 22:05, 27 August 2014 (UTC)
Well, I mentioned jqGrid in part because I knew you have it on your list of stuff to add. It is a great idea in general (!), but I was openly wondering if it could also be used to target this issue; perhaps one way in which it could be done is by having extra columns that appear beyond the normal width of the grid window and so need be reached by using the horizontal scrollbar (functionality that comes with the package, I guess). I'm not yet entirely convinced, but that could ease things in theory. Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 13:30, 28 August 2014 (UTC)
I don't understand. Yaron Koren (talk) 16:55, 28 August 2014 (UTC)
Oh, never mind then and thanks a lot for your comments. Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 11:04, 29 August 2014 (UTC)

Empty parameters again (alpha version)[edit | edit source]

Ouch, a milder variant of this bug existed before, but it does seem to have become worse with SF 2.8-alpha. I just saved a page and almost 10,000 bytes worth of empty parameters were added to the page. I don't know to what extent this also affects performance but it doesn't look very good. Did anyone create a Bugzilla report yet (I couldn't find any)? Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 21:24, 29 August 2014 (UTC)

That's a lot of bytes! Anyway, I think I just fixed this issue in Git. Yaron Koren (talk) 20:39, 7 September 2014 (UTC)
Thanks! For some reason this version is giving me problems with the 'add another' buttons and the autogrow option in textarea fields. I will try the patch though as soon as Git is available again (the servers are dead atm). Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 11:12, 9 September 2014 (UTC)
If you're still seeing those other problems, you should create a new section for those - and ideally look in the browser's Javascript console and note any errors you see there. Yaron Koren (talk) 14:11, 9 September 2014 (UTC)

Loading Screen[edit | edit source]

I'm having a bit of trouble adding a loading screen for when you click the submit button on image upload in the Special:UploadWindow. That way the user knows something's happening on long uploads. Any ideas on where in SF_UploadWindow.php I can get that work the best? Thanks

"Edit" tab showing when only "Edit with form" should be[edit | edit source]

Mediawiki 1.18 - SB 1.8.04 - PHP 5.3.21 - Mysql 5.1.73

The "edit" tab was not available until I made some changes to user rights in order to not require email authentication for regular users to edit pages. (Questy Captcha had eliminated all spam so I thought there was no reason to require email authentication)

But now the "Edit" tab is showing for regular users and I can't seem to figure out the right combination of GroupPermissions to make the "Edit" tab NOT show on pages where a form is used.

LocalSettings:

$wgEnableEmail = true;

$wgEnableUserEmail = true; # UPO

$wgEmailAuthentication = false; // require email authentication for using any email function (except password reminder which works independently from this setting)

$wgEmailConfirmToEdit = false; // Require a confirmed address to edit pages

$wgGroupPermissions['*']['viewedittab'] = false;

$wgGroupPermissions['user']['viewedittab'] = false;

$wgGroupPermissions['sysop']['viewedittab'] = true;

$wgGroupPermissions['*']['edit'] = false;


ConfirmEdit settings:

$wgGroupPermissions['*' ]['skipcaptcha'] = false;

$wgGroupPermissions['user' ]['skipcaptcha'] = false;

$wgGroupPermissions['autoconfirmed']['skipcaptcha'] = false;

$wgGroupPermissions['bot' ]['skipcaptcha'] = true; // registered bots

$wgGroupPermissions['sysop' ]['skipcaptcha'] = true;

$wgGroupPermissions['emailconfirmed']['skipcaptcha'] = true;

$ceAllowConfirmedEmail = true;

If anyone can spot where I've gone astray, I would appreciate it.

Thanks in advance!

Are the "viewedittab" settings done after the inclusion of Semantic Forms? Yaron Koren (talk) 23:21, 5 September 2014 (UTC)
Nope, they we not - but they are now and that did the trick. Thanks Yaron! DaveL (talk) 04:12, 6 September 2014 (UTC)

Problem with language on wiki family[edit | edit source]

Hi, we love your extension and use it for our software documentation. Thanks for your great work!

Now I ran into a little problem with some language configurations. We run a wiki family (used method is described here, MW 1.21.1, SF 2.6.1) and now for the first time we set up a wiki in English insteat of German. Now SF seems to be confused by that, because some words are in german (like "This is a property of type Zeichenkette".) I already set $wgLanguageCode to 'en' in the shared LocalSettings.php but it doesen`t seem to work. I know there could be a lot of reasons depending on the configuration of our wiki family, but the other extensions work just fine. So I hope someone has an idea or has experienced this problem before.

Thanks! Prev (talk) 08:38, 10 September 2014 (UTC)

That really shouldn't happen... could it be that the setting of the language, etc. is being done after the inclusion of Semantic Forms? It should be done beforehand. Yaron Koren (talk) 16:06, 10 September 2014 (UTC)
Hi Yaron, thanks for the quick reply. That was my first thought too, so I moved the language setting to the shared LocalSettings.php of the wiki family. So it's definitly beforehand, but the problem remained. Prev (talk) 12:02, 12 September 2014 (UTC)
What do you mean by "the problem remained"? The text you referred to earlier has already been set - it's in the page wikitext. Does the same problem keep happening to you now if you create new properties? Yaron Koren (talk) 12:58, 12 September 2014 (UTC)
Oh, sorry for being unclear. Yes, the problem remains when I create new properties. Prev (talk) 12:40, 16 September 2014 (UTC)
Hi Yaron. We finally found the error - after all it was an error in our wiki family configuration. Thanks again for your help and your great extension! Prev (talk) 08:43, 17 September 2014 (UTC)
Oh, that's great to hear. Yaron Koren (talk) 22:40, 17 September 2014 (UTC)

Prepend default filename?[edit | edit source]

I have a multiple instance template for uploading files, and I'd like to use default filename as the beginning of the users filename. So if the user uploads a file called "logo1.jpg", the destination filename will be "subpagename-logo1.jpg". Is this possible to change?

I thought I could add it to this part of the code in sf_uploadwindow, but everything I do just keeps a destination filename from showing at all.

$this->mDesiredDestName   = $request->getText( 'wpDestFile' );
                if ( !$this->mDesiredDestName )
                        $this->mDesiredDestName = $request->getText( 'wpUploadFile' );

Would appreciate any help, since users keep overwriting each others images with dumb names like "1.jpg".

Form/Template Data Has to be on the page?[edit | edit source]

Excuse this newbie question but what I am trying to do is make a wiki for a game and the loot that is dropped by the different creatures in the game. What I want is to simply be able to run a #Ask on the creature page and a list of what loots the creature has will be listed. Works great! BUT http://wiki.afterworld.ru/index.php?title=DaleTest916 Why do I have to produce also each type of loot listed on the page also. Note the page I linked. The template Creature-Loot looks like this to get the screen I currently have on the page:

=============
<noinclude>
This is the "Creature-Loot" template.
It should be called in the following format:
<pre>
{{Creature-Loot
|Loot Creature=
|Loot Maturity=
|Loot Version=
|Loot Item=
|Loot Frequency=
|Loot Still=
}}
</pre>
Edit the page to see the template text.
</noinclude>
<includeonly>
{| class="wikitable"
! Loot Creature
| [[Loot Creature::{{{Loot Creature|}}}]] 
! Loot Maturity
| [[Loot Maturity::{{{Loot Maturity|}}}]] 
! Loot Version
| [[Loot Version::{{{Loot Version|}}}]] 
! Loot Item
| [[Loot Item::{{{Loot Item|}}}]] 
! Loot Frequency
| [[Loot Frequency::{{{Loot Frequency|}}}]] 
|}

[[Category:Creature-Loot]]
</includeonly>
====================

Now I want to eliminate the individual lines of each loot on the DaleTest16 page. So I remove or remark or get rid of the table in the <includeonly> section of the template. Great the lines are now gone but my #Ask on the page is also empty. The DaleTest16 PAge still lists each of the loots with items like

But since the Template does not have the output table in it, the page itself does not have each individual table visible. Make sense. Now comes why im confused. The data for each loot in listed on my page as {{Creature-Loot just fine. Why do I have to have it be visible for that data to also show up on a #ask statement? Thanks!

{{Creature-Loot
|Loot Creature=DaleTest916
|Loot Item=Dale Blood
|Loot Maturity=Small
|Loot Frequency=Often
|Loot Version=9.1.1.1
|Loot Still=Yes
}}
That's not a Semantic Forms question, but you can accomplish that by replacing the table with something like "{{#set:Loot Creature={{{Loot Creature|}}}|Loot Maturity={{{Loot Maturity|}}}| ... }}". Yaron Koren (talk) 21:43, 16 September 2014 (UTC)

Mapping template example[edit | edit source]

Yaron and others, could you please give me a simple example of the new mapping template functionality in a wiki instance? Jaider msg 00:08, 17 September 2014 (UTC)

Multiple template: Edit section SOLVED![edit | edit source]

Hello, I have a multiple template that's filled with a form. The template fills sections of a page, running text. I have formatted the first parameter as a section heading. Now, there are the usual "Edit" links on the page next to the section headings. But they are redirecting to the template part (the multipliable part) instead of the form. Is there a way to edit those sections with the form? It would be very nice, if you could only click on the one part and don't have to scroll through 20 parts while editing. This is the template (part):

===[[has title::{{{Title|}}}]]===
'''Problem:''' [[has problem::{{{Problem|}}}]] 
'''Solution:''' [[has solution::{{{Solution|}}}]] 
...

And this the form (part):

{{{for template|Problemsolution|multiple|label=Problemsolution}}}
'''Title:''' {{{field|Title}}} 
'''Problem:''' {{{field|Problem|input type=textarea}}}
'''Solution:''' {{{field|Solution|input type=textarea}}}

Nothing uncommon. Any ideas if editing multiples with forms in single sections is at all possible? --Zabien (talk) 00:08, 18 September 2014 (UTC)

It's not, and you should put in a "__NOEDITSECTION__" in any one of the templates that appears on that page, so that the "Edit" links don't appear. Yaron Koren (talk) 02:55, 18 September 2014 (UTC)
I see, and will do exactly that. Thanks for the quick reply! --Zabien (talk) 12:32, 18 September 2014 (UTC)

Conditional formatting according to properties[edit | edit source]

Hello, another little question, though I am not sure, if this is the right place to ask it. Is there a simple way of adding conditional formatting to a template that gets filled with a form and annotated properties? Let's say, there is a property:has Priority, and priority A should color the section red, B orange, C yellow… and so on. I've searched and tried a lot, but only found info about conditional formatting for tables.

Goal is to let the user choose an option within a form (+ template) and according to the answer display a certain formatting.

I guess, it's not going to work with the #if parser function, instead I've tried to use #switch like this:

<div style="background-color:#{{#switch:{{{Priority}}}
|#A = faa8a8
|B = facba8
|C = faf1a8
|#default = e1e4e2}};">

…

</div>

It's not reacting at all, if within <span> tags, but gives out the value of #default, when within <div> tags. (I fear I might have totally misunderstood the concept here?)

MediaWiki uses something like this in the Extension template, but it's hard to make out the relevant parts...

Would very much appreciate any hints. --Zabien (talk) 00:29, 18 September 2014 (UTC)

This is indeed not the right place - it's not a Semantic Forms question. Yaron Koren (talk) 02:57, 18 September 2014 (UTC)
Okay, thank you, I've tried again there. Should I delete this thread here or just keep it in? --Zabien (talk) 12:47, 18 September 2014 (UTC)
It's not really an SMW question either... it seems like a ParserFunctions question. But if you can get an answer, no problem. You can either delete this or not - up to you. Yaron Koren (talk) 13:58, 18 September 2014 (UTC)
Oh boy… to me, everything that has properties, is semantic… but, well, I'll see and will have to dive even deeper into parser functions, then. I'll leave this to keep your nice words. Zabien (talk) 14:58, 18 September 2014 (UTC)

Multi-instance template with geographic coordinate with input type=map[edit | edit source]

I can't seem to get it to work inside a multi-instance template, but it seems to work fine in a "regular" form.

screenshot here --Jnatividad (talk) 01:39, 19 September 2014 (UTC)

Yes, I believe that's a known problem, unfortunately - part of the larger problem of Javascript (other than SF's built-in Javascript) not working in new instances of multiple-instance templates. Yaron Koren (talk) 14:00, 19 September 2014 (UTC)
Thanks Yaron for the quick reply. Can you suggest a workaround? I was wondering if there's a way for me to prompt for number of instances when a form is first created, and then and then dynamically create the instances when the re-edit the form. As you pointed out, the map input type works just fine for existing instances. --Jnatividad (talk) 21:26, 19 September 2014 (UTC)