Extension talk:Page Forms

Loading Screen
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
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
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?
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?
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:

=
This is the "Creature-Loot" template. It should be called in the following format: <pre&gt;

</pre&gt; Edit the page to see the template text.

=
======= 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 &lt;includeonly&gt; 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
Yaron and others, could you please give me a simple example of the new  functionality in a wiki instance? Jaider msg 00:08, 17 September 2014 (UTC)

Multiple template: Edit section SOLVED!
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):

}}}
Problem: has problem:: Solution: has solution:: ...

And this the form (part):

Title: Problem: Solution: 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 " " 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
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  parser function, instead I've tried to use   like this: 

…

It's not reacting at all, if within  tags, but gives out the value of , when within   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
I can't seem to get it to work inside a multi-instance template, but it seems to work fine in a "regular" form.

|See 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)

Embedding query forms with wpRunQuery=true
I tried to embed a run query form with wpRunQuery=true fails with Error: No form was found on page. Is wpRunQuery=true in combination with embedded run query possible in general?

--Planetenxin (talk) 07:41, 7 October 2014 (UTC)


 * Hi - I think this is a MediaWiki issue; I don't think a query string can be included in the standard page transclusion. I'm not 100% sure about that, though. Yaron Koren (talk) 21:07, 7 October 2014 (UTC)


 * As far as I understood from http://www.mediawiki.org/wiki/Transclusion#Special_pages, this should be possible. --Planetenxin (talk) 12:08, 9 October 2014 (UTC)


 * Oh, I see. Well, perhaps the issue is just that you're using "?" and not "|". Yaron Koren (talk) 13:13, 9 October 2014 (UTC)


 * Yaron, sorry I did not mention:
 * will show the embedded query, but the query is not executed automatically (need to click the button first). --Planetenxin (talk) 07:13, 10 October 2014 (UTC)
 * will show the embedded query, but the query is not executed automatically (need to click the button first). --Planetenxin (talk) 07:13, 10 October 2014 (UTC)


 * Oh. I don't know, then; sorry. Yaron Koren (talk) 13:16, 12 October 2014 (UTC)

Define output values for checkboxes using templates with boolean type
Hi there,

I have a question concerning the output values of checkboxes.

The problem itself

I am creating pages with a form (based on a template) using several checkbox inputs. The parameters in the template have attributes with the datatype boolean.

In the created pages the values of these inputs should not be displayed by "yes"/"no", "1"/"0", ... as these are not quite noticable.

A preferred solution would be a definition of checkmark and cross (with unicode) or something like that, if possible with some increasing style. Nevertheless I have no idea how i can override the standard boolean values, which obviously needs to be the first step.

 My implementation

Template:

... ...
 * attSomeAttribute:: Description of the parameter

Form: ... !style="text-align:left"|Description of the parameter ...

I hope the description of my problem is quite understandable.

Thanks in advance --Marc


 * It is quite understandable! You should have something like this in the template:


 * ...or, instead of "True" there, whatever the checkbox input type sets the value to, if the checkbox is selected. Yaron Koren (talk) 21:17, 7 October 2014 (UTC)

Access Parameter Value from Form Article
Having some fun with dynamic form display based on templates. Wondering if it's possible to pass a parameter to the Form (ie. from #formlink) for use in display of the Form (not as a field value). Basically, to use a  value but outside of the tag, in the Form article. I guess kind of like how a template behaves.

ie. Specify |myparameter=myvalue in the formlink (or with query string=) and then accessing it with in the Form article. I'm trying to pass it the name of a template to use. Would mean I'd only need to maintain one form (instead of 50+) for my application. Thanks! - Lbillett (talk) 01:41, 10 October 2014 (UTC)


 * I don't think you can do that, just because the name of the template (defined in the "for template" tag) isn't parsed. Though it's possible that you could add a tiny bit of code to the SF code to get that working... still, it seems strange that you have more than 50 forms, each with a different template, but with the same set of fields for each (if I understand it correctly). Perhaps there's a way to change the whole thing to just one template? Yaron Koren (talk) 13:19, 12 October 2014 (UTC)


 * Ah, I figured as much. It's a bit of a weird application. My form defines a bunch of generic fields (item1, attr1, item2, attr2, etc) and populates the default= values for each by calling a template. 'telling' the form which template to use via formlink would've been snazzy, but is by no means a deal-breaker. Aim is to generate multiple checklists that display/hide fields based on the date (or other conditions). I think I can define the specific part(s) of each form and pull in the common body via template as per here. Thanks! - Lbillett (talk) 12:07, 14 October 2014 (UTC)

Using Semantic Forms with Semantic Title
I am using Semantic Title to set the Title of a page to the value of a Semantic Property on the page. When I use Semantic Forms to select a value from the category with a dropdown it uses the actual name of the page rather than the Semantic Title in the dropdown box. However when the page is saved it shows the Semantic Title in the field, which is what I want. I'd like to be able to show the Semantic Title in the dropdown rather than the actual title and wondered if anyone has tried this and got it to work. The field definition I am using is:

I've also tried using Semantic Forms Select using a query to work around this problem as follows:

If I enter this query directly on a page it correctly shows the Semantic Title with a link to the correct page, but when I use it in semantic forms the dropdown shows a list of semantic property lookups such as:

Membre550295

and the field after the page is saved shows:

has Owner::Johny

Where Johny is a link to the correct page but I don't want to have the semantic property mark-up showing in the field.

I've also tried using an alternative query with Semantic Form Select as follows:

This correctly shows the Semantic Title in the dropdown. Once the page is saved however, it contains the the value of the Semantic Title but not as a link to the correct page. Instead it is a red link as a page doesn't exist with that title.

Any thoughts would be most welcome.

Duncan


 * Try using the "mapping template" feature, new in SF 2.8. Yaron Koren (talk) 13:20, 12 October 2014 (UTC)

Hi Yaron, thanks for your speedy and helpful response. I tried this suggestion but at the moment it doesn't quite work as expected. I have my field definition as follows:

And the mapping template contains:

|

In this case the dropdown contains a list of entries in the form <-!LINK x:xx->. If I select one of these, the field correctly contains the link to the selected page using the SemanticTitle as I wanted.

I then tried the mapping template containing:

This time the dropdown list correctly showed the semantic names. When I select one, however, the field just contains the text of the semantic name rather than the link.

I wonder if I have misunderstood the function of the mapping template? I expected that the two field statements above would both return a link to the desired page. I expected that the mapping template would just alter the 'alias' of the selected item in the dropdown not the value returned.

I'd be very grateful if you have any further thoughts.

Duncan


 * I don't quite understand - could you clarify what appears in the form vs. what appears in the resulting wikitext? Yaron Koren (talk) 18:51, 19 October 2014 (UTC)

Thanks Yaron for your help and apologies that I wasn't clear before.

I am using Semantic Title on the pages in my wiki. The real title of the page is:

Classero100001

and the Semantic Title of the page, contained in property "Has Name" is:

Uno Metrico

The field definition on the form is defined as follows:

Example 1

In this example the template GetEntityName contains:

|

when selected the field dropdown shows:

and when saved the page shows (as a link to the desired page):

Uno Metrico

and the page source contains:

|Classero=Classero100001

Example 2

In this example the template GetEntityName contains:

The field dropdown contains:

Victoriana Uno Metrico enteprissma

The saved page shows (as a redlink):

Uno Metrico

And the page source contains:

|Classero=Uno Metrico

What I want to achieve is that the dropdown shows the Semantic Titles of the pages (as in example 2) but the field when saved contains a link to the selected pages (as in example 1). I wonder if I have misunderstood the function of the "mapping template" as I expected the returned value to be the same in both cases (eg as in example 1)?


 * Oh, I see. I'm not surprised that either one is failing; though the way in which they're failing is unexpected. But what you need is a #show statement - so if the semantic property that holds the title is called "Title", the template should hold something like " ". Yaron Koren (talk) 01:51, 20 October 2014 (UTC)

Support for the pattern attribute
Yaron, it would be cool if Semantic Forms could have support for the html5 pattern attribute, don't you think?

Thus, the  parameter in the   tag would just send the regular expression to the   attribute in html. Without the need for JavaScript, etc. Jaider msg 13:57, 12 October 2014 (UTC)


 * Yes... although the case for that would be stronger if Safari supported it as well. Yaron Koren (talk) 22:10, 12 October 2014 (UTC)


 * Ok, well, at least according to this, Safari "supports the pattern attribute, but do not support form validation, so will not prevent an incorrect value from being submitted, but do support the UI pseudoclasses". So it would not do any harm, I think. And according to this: "Opera 9.5+, Firefox 4+, Safari 5+, Internet Explorer 10 and Chrome 5+ are the only browsers with support for pattern at present [February 26th, 2013]. However, with the browser market moving at a fast pace, the others will soon catch up". Jaider msg 22:40, 12 October 2014 (UTC)


 * Oh, okay. You're right that it wouldn't do any harm; maybe it's a good idea. Yaron Koren (talk) 22:55, 12 October 2014 (UTC)

CSRF
Mediawiki 1.23.5. I get message "This appears to be a cross-site request forgery; canceling save" when hitting save or preview on page Special:CreateProperty. However if I disable Extension:ShortUrl everything works fine. --StasR (talk) 11:16, 17 October 2014 (UTC)


 * Hi - that's unfortunate, although I don't know if there's anything I could do about it. Perhaps the ShortUrl extension's Javascript should be set to not take effect on special pages? Yaron Koren (talk) 16:36, 17 October 2014 (UTC)


 * Hi! As far as I can see ShortUrl extension's Javascript is not inserted into the special pages: sample. --StasR (talk) 21:09, 17 October 2014 (UTC)


 * Oh. I don't know, then. Yaron Koren (talk) 18:45, 19 October 2014 (UTC)

textarea didn't parse the first line of the content
mediawiki 1.24wmf21

when i create a form, having a field, it's input type=textarea

then i edit this form, input something like this: then i got
 * 111
 * 222
 * 333
 * 111
 * 222
 * 333,

i debug these html code, found that the first line"111" is "111 "  222  333  

is there anyone can help? or tell me witch part of the SemanticFoms'code is handling this process. Extirpate (talk) 18:16, 17 October 2014 (UTC)


 * i found that this is not the problem of semanticforms, this is a great extension. My problem is the ul or ol nested in the table cell.

for example:

if i make a normal table, and type in         *1 *1       *1         the first *1 acts innormal, and i don't know how to fix it .Extirpate (talk) 18:17, 17 October 2014 (UTC)


 * You just need to add a newline to the template so that the template parameter that holds that bulleted list is on its own line. Yaron Koren (talk) 18:47, 19 October 2014 (UTC)