Extension talk:Page Forms/Archive April to May 2015

Make form generate <noinclude> </noinclude> tags in the resulting article

I want a form to generate an article that has <noinclude> </noinclude> tags in the article itself (around the properties table). This is because later on, when i embed/transclude that article in another, i do not want the properties table to show - only the article proper (free text). Maybe i'm missing something very basic here - i'm still quite new to smw. So far, in the form definition, i tried wrapping the <noinclude> tags in <nowiki> tags - to no avail. Maybe including <noinclude> tags isn't even necessary. Maybe there is another way, how to embed articles without displaying their properties table? Any advice greatly appreciated :) Andi 3ö (talk) 13:25, 3 April 2015 (UTC)

See "onlyinclude free text", here. Yaron Koren (talk) 23:07, 5 April 2015 (UTC)
Ooops, didn't see that. Thank you so much!! Andi 3ö (talk) 21:22, 7 April 2015 (UTC)

Templates, how to introduce categories instead of properties

Hello,

So actually i have this template: Try template

<noinclude>
{{Trytemplate
|Departments=
|Autor=
}}
Edit the page to see the text in template

</noinclude><includeonly>{| class="wikitable"
! Departments
| {{#arraymap:{{{Departments|}}}|,|x|[[Dep::x]]}}
|-
! Autor
| [[Autor::{{{Autor|}}}]] 
|}
</includeonly>

Which will add the thing i add to Departments and autor to those properties. I want, instead, to add them to categories. How can i do this?

I tried with this:

http://en.wikipedia.org/wiki/Help:Category:

And this

https://www.mediawiki.org/wiki/Extension:Semantic_Forms/Semantic_Forms_and_templates

But i do not manage that when someone fills the field, things get in the correct category. How could i do this?

Change it to something like this:
! Departments
| {{#arraymap:{{{Departments|}}}|,|x|[[Category:x]] [[:Category:x]]}}
|-
! Autor
| [[Category:{{{Autor|}}}]] [[:Category:{{{Autor|}}}]]
Yaron Koren (talk) 21:00, 7 April 2015 (UTC)


Actually that is not working for me, i tried, but seems the boxes to fill in the form will only show an string instead. Perhaps it can be a problem with versions? Using MW 1.24.1 AND SF 3.2. All the tries i have made have resulted in an string as output, or something which did not do the thing.

Could you post an example which it is known to work please?

It's important to clarify that the form and the template are two different things - you asked about the template before, not the form. For the form, I don't know what input you want those fields to be, but the "tree" input type might be helpful. Yaron Koren (talk) 13:50, 8 April 2015 (UTC)


Sorry! I meant the template. I made a mistake there! I mean that is not working in my template. Could i have an example of how to make the template do that please?

That was my first response. Yaron Koren (talk) 20:21, 8 April 2015 (UTC)

Still not working, but perhaps it is a formulated the question badly.

Ok, this is the situation, i want a form to use the template, and do what i told.

In the form we will have 2 text box to fill, "Autor" and "Departments".

| [[Category:{{{Autor|}}}]] [[:Category:{{{Autor|}}}]]


this for example, will add the page created with the form to "value entered in "Autor field" " category, and in the "Autor" field of the page, it will put "category:"entered value"", but will not do what i am asking for. Hope i got clearer now!

What is it that you're asking for? Yaron Koren (talk) 01:16, 9 April 2015 (UTC)

I want to know what do i have to put in my template so that when someone fills a text box in my form (for example, the mentioned "Autor" or "Departments"), which are taken from the template to the form.

I get the syntax of

[[Category:]]-> This means the page created with the form, will receive

[[Category:"What it is put on "Autor text box".]]
[[:Category:{{{Autor|}}}]]-> This instead, means that in the !Autor box of the created page, we will have [[Category:"What it is put on "Autor text box".]](all of it, as an String).

In both ocasions there are 2 individuals working(Indication of category and what user writted). But what i am asking for is the syntax of 3 individuals working.

I need 1º what the User has written

 "{{{Autor|}}}"

, 2º the indication that value is going to be in a category

"[[Category:]]"

, 3º which category will it be "Autor". For example

{{{Autor|}}} [[Category:Autor]]

, but this is not the syntax. Which would be?

Oh, I made a small mistake in my original example. Try this:
! Departments
| {{#arraymap:{{{Departments|}}}|,|x|[[Category:x]] [[:Category:x|x]]}}
|-
! Autor
| [[Category:{{{Autor|}}}]] [[:Category:{{{Autor|}}}|{{{Autor|}}}]]
...or, if you want to keep things simple, this:
! Departments
| {{#arraymap:{{{Departments|}}}|,|x|[[Category:x]] x}}
|-
! Autor
| [[Category:{{{Autor|}}}]] {{{Autor|}}}
Yaron Koren (talk) 01:59, 9 April 2015 (UTC)

Actually this is kind of what i was looking for:

! Autor
[[:Category:Autor|{{{Autor|}}}]]

It manages to redirect what it is in

{{{Autor|}}}

to the category i want "Autor", although it does not introduce it. This is kind of a redirect. So that i will have a box in which i will click in the introduced value and i will be redirected to "Autor", but not introduce the value itself to the category. Any solution?

Did you try what I suggested? Yaron Koren (talk) 12:11, 9 April 2015 (UTC)

Yes, copy pasted both types, but did not do the thing. The closest thing i found was that which i told, which is still not what i want :S.

So there is no way of doing what i am asking for? Have tried all the suggestions, still, nothing :s. ATM we have reached the possibility of accessing the wanted category from the template, but still creating an individual inside of a category from the template is needed.

Are you sure you fully tried the suggestions I gave? Any of those three should achieve what you're trying to do. Yaron Koren (talk) 12:55, 13 April 2015 (UTC)


100% sure. I have made a showcase showing and explaining what does each thing do:

https://www.dropbox.com/s/4gljrnej4sbp105/show.docx?dl=0

Please, have a look. I would recommend you trying them otherwhise, but you will get the same result.

Oh... now I think I get it! You want those values entered by the user to become part of another category - I thought that you wanted those values to be category names. If that's correct, then there's no way to do that from within the page - you can't specify, on page A, that page B should be part of category C. Instead, the user will have to go to each of those pages and handle the tagging there - through a form or otherwise. Yaron Koren (talk) 17:07, 13 April 2015 (UTC)

Ok, thanks a lot mate. Will leave it that way then, tough, it would be awesome to have the oportunity to do so to link categories between them.

Getting CSS codes in dropdown list items when using a mapping template

Hi

I recently update SForms to 3.2 and now get <div class=\"smwpre\">$result</div> tags around dropdown list items. The list items themselves use a mapping template as I'm using semantic title to provide an alternative name for the pages. I've had this working in the past but have just noticed I now get the CSS tags.

I wondered if anyone has encountered this before or got any idea what might cause it?

Many thanks

Duncan

__

Hello

I've spent a little more time investigating this. I find if I change line 95 in /includes/forminputs/SF_DropdownInput.php from

$innerDropdown .= Html::element( 'option', $optionAttrs, $label );

to

$innerDropdown .= Html::rawElement( 'option', $optionAttrs, $label );

then the dropdown displays its list items correctly without the CSS tags. I have to admit I don't really understand the difference between the two functions so it would be nice to know if I'm unwittingly introducing a risk. I'm also a little concerned I'm now running a non-standard version of this file so wondered if I'm missing something and should be achieving this effect in another way? By the way, a combobox field seems to work fine as an alternative for achieving the same thing, its just the dropdown looks neater for this usage, I think.

Many thanks

Duncan (18 April 2015)

Sorry about not responding before - I didn't realize that, when you said that <div> tags appear, you meant that they literally appear on-screen - which is bad, of course. Your proposed solution seems reasonable. I don't know if it's introducing a security risk - it's possible. But if you're running a private wiki, it's probably not a big deal.
As to the original issue - I'm guessing that Semantic Title is the culprit, in one way or another, but I don't know more than that. Or did this work correctly with the same versions of Semantic Title, SMW and MW, but an earlier version of SF? Yaron Koren (talk) 01:08, 19 April 2015 (UTC)
Hi Yaron
I think it was working OK with the earlier version of Semantic Forms (as I'd certainly have noticed ) but I've looked back at the last few versions and the code seems the same! I've introduced some other extension so maybe its something to do with those. I did notice that when Html class is used elsewhere in the dropdown input field it uses Html::rawElement rather than Html::element which is why I tried it on line 95. Given this, I'm hoping it should be OK.
I checked the documentation and the difference is that the content string is escaped in Html::element and not in Html::rawElement.
Many thanks, Duncan (19 April 2015)
Everything you're saying makes sense except for the fact that it used to work correctly, with an older version of SF (though it couldn't have been that much older, if you were using "mapping template"). Are you sure about that? And do you remember what SF version it was? Yaron Koren (talk) 15:23, 20 April 2015 (UTC)
Hi Yaron
Yes it seemed unlikely to me also that the same code would produce different results. I even thought maybe I'd used Combobox instead but I checked back and found it was Dropdown. I still have the prototype that worked and I checked the versions. However I find the versions of SF, MW and SemanticTitle are all the same as the current prototype that doesn't (SF3.2, SemanticTitle 2.1, SMW2.0). So I think it must be some other change I've made not SemanticTitle or SF. When I have time I'll try eliminating changes one by one to get to the root of it!
Thanks as always for your help
Duncan (21 April 2015)
Woops - now I realise I have been incredibly dense. I operate a wiki-farm so of course the earlier prototype was running under the same code which had been upgraded and had my 'fix' in. When I regressed to the earlier versions of semantic forms, it appears that the Dropdown field type had never worked with the Mapping Template and this version of Semantic Title. So I must investigate further. Interestingly, if I use the Combobox field type to emulate a Dropdown, I don't get this problem.
Duncan April 24, 2015
Doh - now I really feel a numpty. The property holding the Semantic Title had a data type of Code. When I changed it to Text all worked fine! Oh well, if any one else strays this way then perhaps I'll have saved them some time :-)
Duncan 24 April, 2015
Ah, that would explain it. I'm glad you found the problem. Yaron Koren (talk) 18:48, 24 April 2015 (UTC)

Does "show on select" only saves the presently displayed form inputs and omit the hidden ones?

I use "show on select" in multiple forms to switch among 7 form parts which are all very detailed, I use it to mimic a step by step form input. When I preview the form and submit it I only see the presently shown form part to be parsed in the preview, the other hidden but filled form parts remain in the form but do not get to the preview.

  1. It seems that "show on select" only evaluates the selection that is presently shown and dismisses all other hidden but filled form fields. Is this standard behaviour or a BUG?
  2. How can I accomplish to switch among form parts that all get translated even the hidden filled form fields? Write my own JavaScript program? (I could use the JavaScript mw-collapsible mechanism but on a new multiple form part it dos not work because it is not yet bound to the onclick event of button “Add new”. A work around using jQuery.on(…) would solve it but needs extra JavaScript programming. PS: widgets tabs or accordion of jQuery-UI would close come to my needs but that’s not possible with default Semantic Forms?)

Thanks for any solution --Andreas P.   11:06, 10 April 2015 (UTC)

"show on select" is meant to truly remove stuff from the form, so what you're seeing is correct behavior - trying to use it for a wizard is clever, but probably won't work, as you've seen. And yes, it's too bad that the "collapsible" stuff doesn't work in multiple-instance templates. Though I'm trying to figure what your form looks like, though - is it basically like a wizard within each instance of a multiple-instance template setup? If so, that's complex! The Header Tabs extension is the standard way in which people set up wizard-style functionality in forms, but that won't work if you have more than one wizard. Yaron Koren (talk) 15:38, 10 April 2015 (UTC)
So I need a "show on select" without the removing procedure (frankly a feature request ;-) or an attribute in the setup of {{{field|…}}} that stores also the hidden inputs. What I like about "show on select" is, that you can hide much stuff until you need it. But as you pointed out it is originally meant to remove hidden form inputs before save. :-( --Andreas P.   16:07, 10 April 2015 (UTC)
Is there an official way to integrate custom JavaScript functions in Semantic forms, especially to “Add another” ? I wrote a custom tool that works [1], but not when I click “Add another”. Is there a way? --Andreas P.   21:37, 23 April 2015 (UTC)
Yes - using the relatively new JS hook "sf.addTemplateInstance". See here for how it can be called. Yaron Koren (talk) 23:22, 23 April 2015 (UTC)
Thanks, very good. And how can I check in a sustainable manner if the form is in edit mode (action=formedit …). I do it with
if(mw.config.get( 'wgAction' )==="formedit" 
|| mw.config.get( 'wgCanonicalSpecialPageName' )==="FormEdit"){// when Special:FormEdit
  // do stuff to be executed during form editing (including preview form result?)
}
I'm not sure if preview was clicked that sometimes the URL becomes action=submit during form editing, and so I have to check also for action=submit. That of course is also present on every preview that is a non-form preview. So do I need correct above check or is there another “official” way? --Andreas P.   09:55, 24 April 2015 (UTC)
That one I don't know. Yaron Koren (talk) 13:08, 24 April 2015 (UTC)
OK with the hook sf.addTemplateInstance it works, but I got it only working when writing
(1) mw.hook('sf.addTemplateInstance').add(my_custom_function).fire(my_custom_function);
with (2) mw.hook('sf.addTemplateInstance').fire(my_custom_function); it works only when the form is loaded the first time. So I wonder if (1) is needed here to get it work regularly. --Andreas P.   14:24, 24 April 2015 (UTC)

Limits for large forms? Can’t save larger forms

Hi,

in SemanticForms 3.2 I have a setup like this (no partial forms here)

{{Key Start}}
{{Lead}}<!-- multiple -->
{{Lead}}<!-- multiple -->
{{Key End}}

Unfortunately the following 1604 form parameters could not be saved. When I click the save button the form reappears with old values. The preview shows changes but the attempt to save it fails as well. Where is the approximate limit of managed form fields?--Andreas P.   10:30, 26 April 2015 (UTC)

That's a lot of fields! It looks like you just hit the maximum number of handled fields, which seems to be 1000. You can increase the limit using the max_input_vars setting in php.ini. Although, with that many fields, maybe the better option is to split up those fields into more than one page? That's just a UI issue, though, not a technical one. Yaron Koren (talk) 23:45, 26 April 2015 (UTC)

Styling for datepicker fields is only applied to mandatory fields in SF 3.2

This might be a semantic forms inputs question. But I noticed that with SF 3.2, the fancy new css applied to input fields is not applied to fields with input type=datepicker (or datetimepicker) unless the field is also set as mandatory. Weird? - Lbillett (talk) 15:16, 28 April 2015 (UTC)

That is weird, but yes, that's an SFI issue. Yaron Koren (talk) 15:18, 28 April 2015 (UTC)
Ah, ok. Thanks. It doesn't cause any real problems. I started a thread for it over there. ...and it seems kgh has provided a workaround before I could finish typing this. Lucky me! - Lbillett (talk) 16:13, 28 April 2015 (UTC)

Selecting multiple values in drop downs or combobox

Hi

I wanted to select multiple values for a field using either a dropdown or a combobox. The code I'm using in the form field is:

| {{{field
|Boat Class
|input type=combobox
|values from category=Classes
|mapping template=GetEntityName
|list
|size=15
|existing values only=
}}}

And the corresponding template code is:

! Boat class
| {{#arraymap:{{{Boat Class|}}}|,|@@@@|[[has Boat Class::@@@@]]}}

However, I don't seem to be able to select more than one item before the input returns to the field with the first value selected. I wondered if dropdown or combobox support multiple item select or if I'm doing something wrong?

Many thanks

Duncan (1 May 2015)

No, neither of those support multiple values. The main input types that support multiple values are "checkboxes", "listbox" and "tokens". Yaron Koren (talk) 22:47, 1 May 2015 (UTC)

Populating red-linked pages automatically

Heiya, I am doing something wrong here but I cannot remember how to do it. I just added [[Creates pages with form::Country]] to the property of type page holding a couple of values which are meant to be new pages. I just want to automatically create the pages with the template Country via the form Country. The form country just contains

{{{for template|Country}}}
{{{end template}}}

This way nothing happens even though the job queue is 0. So I am not sure if I need something else to add to the form via e.g. the info tag or if this is just a feature no longer supported since SF 3.0 or if I just have a senior moment right now. A tip will be cool.

Cheers --[[kgh]] (talk) 16:19, 6 May 2015 (UTC)

That should work, so it might be a bug. The page creation is supposed to be triggered when you go to a page containing a red link to that page - have you done that? Yaron Koren (talk) 11:33, 7 May 2015 (UTC)
Ah, your answer points me to the cause of the issue which I guess turns out to be most probably a feature request instead. These values are stored within a subobject. However there is indeed an incoming property to the page which should be created. I just checked if it works if I store the property with it's value on a page directly and this triggered the page creation. --[[kgh]] (talk) 12:19, 7 May 2015 (UTC)

#forminput deforming when placed on a page with an ImputBox

Hey guys, I'm relatively new to mediawiki, and I'm working on a project that uses Semantic Forms to create new pages. However, when using the #forminput parser on a page that also contains an ImputBox (other extension), the text box gets deformed to fill the whole page width. It also uses the same styling as Imputbox (the new Agora design), while the "Add page" button remains in the classic style, and gets placed below:

http://i.imgur.com/AH5MXV7.jpg

But not when the InputBox is not there:

http://i.imgur.com/C9zlu5i.jpg

I haven't been able to find a solution myself, so I'm hoping someone here can help me. The most important thing is to get the forminput in its normal style, but if it could be upgraded to use the Agora design, that would be even better.

It sounds like InputBox is "hijacking" #forminput's look, via the CSS it adds to the page. Although it doesn't sound that bad, given that you prefer the new look! I should standardize the appearance of #formminput - the regular text inputs in forms now look a little nicer, but they don't use the MW classes either, so I should probably modify both. Thanks for the reminder. Yaron Koren (talk) 11:38, 7 May 2015 (UTC)

Error "Main has failed dependencies" when using "values dependent on"

Hi

I have an application that allows me to record results for a sailing model race on the race's page. The race page has a field that contains the 'class' of boat that the race is for. I then have a multiple field containing result lines for each of the boats in the race. On the result line I want to select the boat that the result was for. Each boat has its own page in the Boats category and I want to select the relevant boat from a list of those Boats that correspond to the 'class' that the race was for.

The race class is set up when the race page is first created so that there is a valid value in this field when the form is invoked to populate the results.

My form definition looks like this:

<includeonly>
{{{info|page name=Race day<unique number;random;start=100000>|create title=New race day}}}
{{{for template|Race day|label=Race day}}}
{| style="width:100%;"

...

! style="width: 110px; text-align: left; vertical-align: middle;" | Boat Class:
|style="text-align: left;"| {{{field
|Boat Class
|input type=dropdown
|values from category=Classes
|size=15
|existing values only=
}}}

...

{{{end template}}}

{{{for template|Result}}}
{{{field|Results|hidden|holds template}}}
{{{end template}}}

{{{for template|Result Line|multiple|embed in field=Result[Results]|label=Results}}}
'''Position:''' 
{{{field
|Position
|input type=number
|size=5}}}
'''Boat:''' 
{{{field
|Boat
|input type=combobox
|property=has Boat Class
|values from category=Boats
|values dependent on=Race day[Boat Class]
}}}
'''Score:''' 
{{{field
|Score
|input type=number
|size=5}}}
{{{end template}}}

...

</includeonly>

When I use the form I get an error message in a popup which says "ext.semanticforms.main has failed dependencies". If I remove the "values dependent on" line then it works OK but I get all the boats listed, not just those with the class for the race. I have tried various alternatives with and without the "property=" and "values from category=" but I always get this message. I'm sure I have probably misunderstood something, so I wondered if anyone can help?

Many thanks

Duncan (16th May 2015)

I'm guessing that the issue is due to the first template being a "singleton", and the second one being a multiple-instance template. It would be good if that worked, although I can think of a few reasons why it might fail. On the other hand, that's an unexpected error message, so I'm not sure if that's the cause. Yaron Koren (talk) 20:17, 18 May 2015 (UTC)
Thanks Yaron. I was trying to investigate further when I came across an (I think) undocumented field parameter "values from query" which I thought might be an alternative solution for what I'm trying to do. So I now have the following for the "Boat" field in my form:
{{{field
|Boat
|input type=dropdown
|values from query=[[Category:Boats]][[has Boat Class.has Name::IOM]]
|mapping template=GetEntityName
}}}
This, indeed results in the desired subset of Boats and the mapping template works fine too (as I use Semantic Title, I need this to correctly replace the actual page title with the displayed Semantic Title). Now all I need to do is to pass the query the value contained in the template field "Race day[Boat Class]" in place of the literal value "IOM" in the query.
I've had a look at the way "values from query" works but have to admit I was finding it a bit hard to follow (I'm a novice where coding is concerned). I wondered if it is possible to pass a value from the template field to the "value from query" and if so how? I also noticed that "value from query" appears to accept other parameters in addition to those for selecting the page but when I tried to use "sort=" the query fails to run. I tried delimiters between the parameters as I would for an #ask but they seem not to work either. Is there a particular syntax to use for delimiting the additional query parameters in "values from query" and, if so, where can I find this documented?
Many thanks for your continuing help
Duncan, 23rd May, 2015
No, you can't pass in a form field value to the query, unfortunately. The only solution I can think of here is to have a separate form (and possibly template(s) and category as well, though not necessarily) for each boat class. Hopefully there aren't too many boat classes... Yaron Koren (talk) 23:05, 24 May 2015 (UTC)
Hi Yaron
I thought there may be another way to do this. The Boat Class is defined in the Race Day when that page is created. As the results are added later I thought I might use a template with the "Values from query" as follows:
|values from query=[[Category:Boats]][[Has boat class::{{GetRaceBoatClass}} ]]
Where the template {{GetRaceBoatClass}} contains the following:
{{#show: {{PAGENAME}}|?Has boat class}}
When I use the template {{GetRaceBoatClass}} on the Race Day page it correctly shows the Boat Class. However, when it is used in the "Values from query" statement the template gets replaced by "[[:Class100000|Class100000]]" rather than the page name which is Class100000.
I wondered whether you might have any idea why this substitution is being made in the "Values from query" call?
Many thanks
Duncan, 25 May 2015
I guess I still don't understand what you're trying to do, but I think you can solve that last problem by adding a "|link=none" to the #show query. Yaron Koren (talk) 21:10, 26 May 2015 (UTC)
Hi Yaron
Thanks, using link=none did work as far as returning the page name went, but my form still isn't quite working as I'd expected.
I'm sorry I haven't explained well enough what I am trying to achieve, but I hope you will persevere with me, because I can now make it work but with a slight modification to the SForms code. Each page for a Race Day has associated Boat Class which denotes which class of boat can take part in the race. Once the race has happened, some time after the Race Day page was created the results of the race are entered as multiple lines within a sub object on the Race Day page. On each of these result lines, the form allows one to enter the Position, the Boat and the Score. When entering the Boat I want to select it from a list of Boat Pages in a dropdown. However, I don't want to list all the Boats in the dropdown, rather I just want to list those of the Boat Class associated with the Race Day page. My form is as follows:
<noinclude>
This is the "Race day" form.

To create a page with this form, enter the page name below;
if a page with that name already exists, you will be sent to a form to edit that page.

{{#forminput:form=Race day|autocomplete on category=Events}}

</noinclude><includeonly>
{{{info|page name=Race day<unique number;random;start=100000>|create title=New race day}}}
{{{for template|Race day|label=Race day}}}
{| style="width:100%;"

! style="width: 110px; text-align: left; vertical-align: middle;" | Start:
| {{{field|start|size=10|input type=datetimepicker}}}
|-
! style="width: 110px; text-align: left; vertical-align: middle;" | End:
| {{{field|end|size=10|input type=datetimepicker}}}
|-
! style="width: 80px; text-align: left; vertical-align: middle;" | Location:
| {{{field
|location
|input type=dropdown
|values from category=Locations
|mapping template=GetEntityName
|size=23
|existing values only=
}}}
|-
! style="width: 110px; text-align: left; vertical-align: middle;" | Description:
| style="text-align: left;" colspan="3" | {{{field|description|input type=textarea|rows=5|cols=87}}}
| style="text-align: left;"| {{{field|type|size=30|input type=text|default=Race days|hidden}}}
| style="text-align: left;"| {{{field
|series
|input type=dropdown
|values from category=Series
|mapping template=GetEntityName
|size=30
|hidden
|existing values only=
}}}
|style="text-align: left;"| {{{field
|Boat Class
|input type=dropdown
|values from category=Classes
|mapping template=GetEntityName
|size=15
|existing values only=
}}}
| style="text-align: left;" colspan="3"|{{{field|title|size=85|input type=text|hidden }}} 
|}
{{{end template}}}

{{{for template|Result}}}
{{{field|Results|hidden|holds template}}}
{{{end template}}}

{{{for template|Result Line|multiple|embed in field=Result[Results]|label=Results}}}
'''Position:''' {{{field|Position|input type=number|size=5}}}
'''Boat:''' 
{{{field
|Boat
|input type=dropdown
|values from query=[[Category:Boats]][[Has boat class::{{GetRaceBoatClass}}]]
|mapping template=GetEntityName
}}}
'''Score:''' {{{field|Score|input type=number|size=5}}}
{{{end template}}}

{{Form:Sub gallery}}
{{Form:Sub news}}

 __NOFACTBOX__

{{{standard input|save}}} {{{standard input|cancel}}}
</includeonly>
My remaining problem is with the line "|values from query=[[Category:Boats]][[Has boat class::{{GetRaceBoatClass}}]]". This is causing an error in the getAllPagesForQuery function in SF_Utils.php. When I dump the contents of the $queryObj in that function it tells me:
SMWQuery Object
(
    [sort] => 1
    [sortkeys] => Array
        (
            [] => ASC
        )

    [querymode] => 1
    [m_limit:protected] => 50
    [m_offset:protected] => 0
    [m_description:protected] => SMWConjunction Object
        (
            [m_descriptions:protected] => Array
                (
                    [0] => SMWClassDescription Object
                        (
                            [m_diWikiPages:protected] => Array
                                (
                                    [0] => SMW\DIWikiPage Object
                                        (
                                            [m_dbkey:protected] => Boats
                                            [m_namespace:protected] => 14
                                            [m_interwiki:protected] =>
                                            [m_subobjectname:protected] =>
                                        )

                                )

                            [m_printreqs:protected] => Array
                                (
                                )

                        )

                    [1] => SMWSomeProperty Object
                        (
                            [m_description:protected] => SMWThingDescription Object
                                (
                                    [m_printreqs:protected] => Array
                                        (
                                        )

                                )

                            [m_property:protected] => SMW\DIProperty Object
                                (
                                    [m_key:SMW\DIProperty:private] => Has_boat_class
                                    [m_inverse:SMW\DIProperty:private] =>
                                    [m_proptypeid:SMW\DIProperty:private] => _wpg
                                )

                            [m_printreqs:protected] => Array
                                (
                                )

                        )

                )

            [m_printreqs:protected] => Array
                (
                    [0] => SMWPrintRequest Object
                        (
                            [m_mode:protected] => 2
                            [m_label:protected] =>
                            [m_data:protected] =>
                            [m_typeid:protected] =>
                            [m_outputformat:protected] =>
                            [m_hash:protected] =>
                            [m_params:protected] => Array
                                (
                                )

                        )

                )

        )

    [m_errors:protected] => Array
        (
            [0] => "Class100000" cannot be used as a page name in this wiki.
        )

    [m_querystring:protected] => [[Category:Boats]][[Has boat class::{{GetRaceBoatClass}}]]
    [m_inline:protected] =>
    [m_concept:protected] =>
    [m_extraprintouts:protected] => Array
        (
            [0] => SMWPrintRequest Object
                (
                    [m_mode:protected] => 2
                    [m_label:protected] =>
                    [m_data:protected] =>
                    [m_typeid:protected] =>
                    [m_outputformat:protected] =>
                    [m_hash:protected] =>
                    [m_params:protected] => Array
                        (
                        )

                )

        )

    [m_mainlabel:protected] =>
)
The error seems to be caused by the {{GetRaceBoatClass}} template included in the query. When transcluded this should be repaced with "Class100000" which is the page name of the Boat Class for the Race Day. However the SMWQuery Object is indicating "Class100000" cannot be used as a page name in this wiki.
To get around this I have changed the code in SF_FormPrinter.php to put the parameter "|[[Category:Boats]][[Has boat class::{{GetRaceBoatClass}}]]" through the wiki parser using "$wgParser->replaceVariables( $sub_components[1] )". This changes the parameter to "|[[Category:Boats]][[Has boat class::Class100000]]" and all works as it should.
If I use "|[[Category:Boats]][[Has boat class::{{GetRaceBoatClass}}]]" in a "#ask" inline query it works fine so I wasn't sure why the PHP equivalent returns an error. It does seem to be process the template "{{GetRaceBoatClass}}" as the SMWQuery Object error indicates it knows this refers to page "Class100000" but then it isn't being used in the query in the way I'd expected. Have I misunderstood how the query works in PHP?
Given that the query isn't working for whatever reason, I also wondered if putting the parser function into SF_FormPrinter.php is likely to cause other problems, and if not might you consider including this in future versions?
Many thanks for your patience
Duncan May, 29 2015
Just to clarify - did making that PHP change completely fix your problem? I'm not sure if you're talking about one issue, or two. Yaron Koren (talk) 16:04, 29 May 2015 (UTC)
Thanks Yaron - yes it appears to have completely fixed the problem. Duncan 30 May 2015

Semantic forms in concert with extension:translate?

Are there any …

  1. multilingual-recommendations
  2. or multilingual-experiences
  3. or multilingual-examples

… in using SF in a multilingual wiki, maybe in concert with extension:translate? It raises the question of how to provide for instance on a property page one concept term or a label in different languages. One problem I came across is, that Boolean in SF is bound to the language settings in LocalSettings.php not to the user language. I appreciate if you have information on the items 1, 2 or 3. Thanks --Andreas P.   13:51, 19 May 2015 (UTC)

Imagine i do have 2 categories, "department" and "professor", both with a form related to them, "F1" and "F2" respectively. I want to create an instance of "department" called "DepA" with a form "F1" i will use with that category.

F1 has as property "professor".

If someone fills that box with "value1", standard way will create an instance of "professor" (as property) with "value1".(You know, typical [[professor ::{{{Professor|}}}]]


When i click on "value1", i will be redirected to an empty page.

Instead, i want to be redirected to "professor" categories form.

So i came up to use this in the template:

|[URL/Especial:FormEdit/F2/ ]

which would work perfectly if it was not because will take the raw value it received in the box.

So if i put "mr jhon dun"

What my form box will show is "jhon dun mr jhon dun" and it will redirect me to : URL/Especial:FormEdit/F2/mr, as it understands URL finishes at first space.

Solution? Having something like which automatically filled empty spaces with "_". Any possible way for this?

00maiser00 (talk) 22:20, 21 May 2015 (UTC)

What about to use extension: ParserFunctions with {{#replace: jhon dun mr jhon dun| |_}}? I tested it with ParserFunctions version 1.6.0 and MediaWiki version 1.23.8 and the result should be “jhon_dun_mr_jhon_dun”. Note: this needs $wgPFEnableStringFunctions = true; in LocalSettings.php. In earlier times it did work only with {{#replace: text with blanks|<nowiki> </nowiki>|_}} --Andreas P.   21:28, 21 May 2015 (UTC)
There may be a simpler solution - please check out the Pointing red links to a form documentation. Yaron Koren (talk) 23:45, 21 May 2015 (UTC)

Bug in Upload Window

wgMaxUploadSize setting is not injected into upload window, script fails and image preview wont load.

solution: in SF_UploadWIndow.php

      protected function addUploadJS( $autofill = true ) {
		global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview, $wgMaxUploadSize;
		global $wgStrictFileExtensions;

		$scriptVars = array(
			'wgAjaxUploadDestCheck' => $wgUseAjax && $wgAjaxUploadDestCheck,
			'wgAjaxLicensePreview' => $wgUseAjax && $wgAjaxLicensePreview,
			'wgUploadAutoFill' => (bool)$autofill &&
				// If we received mDestFile from the request, don't autofill
				// the wpDestFile textbox
				$this->mDestFile === '',
			'wgUploadSourceIds' => $this->mSourceIds,
			'wgStrictFileExtensions' => $wgStrictFileExtensions,
			'wgCapitalizeUploads' => MWNamespace::isCapitalized( NS_FILE ),
            'wgMaxUploadSize' => $wgMaxUploadSize,
		);

		$this->getOutput()->addScript( Skin::makeVariablesScript( $scriptVars ) );
	}
Thanks for this patch! I just added it in to the code. Yaron Koren (talk) 20:31, 27 May 2015 (UTC)

Using {{var# in field definition instead of template definition

Hello, I'm using the Variables extension to define my list of available values for fields. It works well when I use theses lists in my template definition something like :

Extract of the template 
...
 |Mots_cles_normes=List (,) of Page (allowed values= {{#var:Normes_et_standards}} )
...
Extract of the form 
...
 |colspan="2"| {{{field|Mots_cles_normes| input type=tokens}}} 
...

But now, I don't want any constaint on my data values in the template but I'd like the form to propose to the users somes values (using these lists) - so I tried to use the variable (or a simple template) in the field definition like :

Extract of the template 
...
 |Mots_cles_normes=List (,) of Page () 
...
Extract of the form 
...
 |colspan="2"| {{{field|Mots_cles_normes| input type=tokens|values={{#var:Normes_et_standards}} }}}  
...

It doesn't work, the field does'nt not interpret the #var ... (it show the string "{{#var:Normes_et_standards}}" instead of the content of the variable as available value ...) Any idea ? --Guillaume Prêcheur (talk) 07:36, 26 May 2015 (UTC)

That's not good - I thought the "values=" value was always parsed, but I guess not. I'll have to fix that. Yaron Koren (talk) 19:52, 27 May 2015 (UTC)

I've got a form input line:

'''Chapter:''' {{{field|Chapter|input type=dropdown|values from property=Chapters|property=Chapter Comments}}}

The 'Chapters' property has entries such as:

War_And_Peace/Book_Eight#CHAPTER_I

Property:Chapters has:

[[Has type::Page| ]]

The dropdown menu truncates the hash and the rest of the line to give:

War_And_Peace/Book_Eight

Any suggestions as to how to fix this gratefully received!

Fustbariclation (talk) 15:06, 27 May 2015 (UTC)

I would make that property of type "Text", instead of "Page". I'm surprised that a property of type "Page" can be used to point to a page section in the first place - semantically, you would think that it shouldn't... Yaron Koren (talk) 19:55, 27 May 2015 (UTC)

Invalid or virtual namespace -1 given.

After updating from 1.23 to 1.25, when I try to create a new page with #forminput I get the error "Invalid or virtual namespace -1 given." I have Semantic forms "3.2 (cc12d8b) 15:26, May 27, 2015" installed. Cody3647 (talk) 23:08, 27 May 2015 (UTC)

When an error like this was reported before, it turned out to be (at different times) a result of the interaction with the ConfirmEdit and SpamBlacklist extensions. Do you have either of these extensions installed? If so, make sure they're up to date; and if that doesn't solve the problem, you might need to uninstall one or the other... hopefully not. Yaron Koren (talk) 03:02, 28 May 2015 (UTC)

Free text compatible with VisualEditor

Hello, As VisualEditor seems to work well and well, I would like to know if it's planned to make it compatible with the free text input part of semantic forms like WikiEditor is already ?

Thanks,

Nicolas NALLET (talk) 18:00, 30 May 2015 (UTC)

It would be great to have that support, but it's not yet doable - see the last item here. Yaron Koren (talk) 19:07, 30 May 2015 (UTC)
Hello Yaron, thanks for your quick reply.
Looking for a workaround I have thought about separating the edition with the form AND the edition of the article himself with Visual Editor.
Do you know if it's possible to have a button at the bottom of the form that can save form's data and redirect immeditaely to the page editable with VE ie redirecting to an url like :

index.php?title=PAGENAME&veaction=edit.

Maybe for new pages the page name will have to be retrieved thanks to the
{{{info|page name}}}
tag... Nicolas NALLET (talk) 13:36, 31 May 2015 (UTC)
There's no way currently to do that in SF. Why not just have two different editing tabs, to let people choose to use either SF or VE? Yaron Koren (talk) 14:37, 31 May 2015 (UTC)
Yes of course it's still possible to use tabs but my aim was to remonve a clic step.Nicolas NALLET (talk) 15:03, 31 May 2015 (UTC)

combobox not being resized

Just a quick note. With SF 3.2 the size= parameter does not seem to work for the "combobox" input type. Cavila (MW 1.22, MySQL 5.5.37-0, Php 5.4.4-14 squeeze, SMW 1.9.2, SF 2.7) 15:33, 31 May 2015 (UTC)

Return to "Page Forms/Archive April to May 2015" page.