Extension talk:Semantic Forms

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

Contents

[edit] Multiple-instance embedded template with header tabs

Hi, it seems that this combination may not be working. This is part of a form definition:

= Channels =
{{{for template|Solution channels|multiple|embed in field=Solution[Channels]}}}
{{{field|Channels|autocomplete on category=Channel}}}
{{{end template}}}

It works fine without the 'multiple'. Than there is a 'Channels' tab in the form with the field 'Channels'. But with the 'multiple' the 'Channel' tab is empty and the multiple part with the 'Channel' field appears outside the tab-range.

Or am I doing something wrong? --AdSvS (talk) 09:12, 3 April 2012 (UTC)

Can you duplicate this problem on a public wiki, like scratchpad.referata.com? Yaron Koren (talk) 14:56, 3 April 2012 (UTC)
I have created a test on scratchpad.referata.com: http://scratchpad.referata.com/wiki/Test_Mieht. The result in the created/edited page seems to be ok. --AdSvS (talk) 11:33, 7 May 2012 (UTC)

[edit] Multiple Parameter Not Working

Hello, the SF 'multiple' parameter is not working on my installation. We use MW 1.17.
On an archive page I found the same topic with MW 1.16. - he said it would work with MW 1.17.... But not in my wiki :-(
I only see the Button "add another", but I can´t click it. What can I do? Cheers, Mediawikitester (talk) 11:50, 3 April 2012 (UTC)

I assume there's some unrelated Javascript error happening - please see the 5th item here. Yaron Koren (talk) 14:57, 3 April 2012 (UTC)

[edit] Hello World not working

Hello,

I try to run the following 'Hello World' to restrict properties to allowed values. I should see a field, that restricts the values to these values. In fact it shows a single-line textfield. Can anyone please help me?

[edit] Template:Testvorlage

Blub

<includeonly>
{{#set: Testattribut=Testattribut}}
{{{Testattribut|}}}

[[:Spezial:EditData/Testformular/{{PAGENAME}}|Seite bearbeiten]]
</includeonly>

[edit] Form:Testformular

<noinclude>
{{#forminput:Testformular}}
</noinclude>

<includeonly>
{{{for template|Testvorlage}}}
Testattribut: {{{field|Testattribut}}}
{{{end template}}}

{{{standard input|save}}} {{{standard input|cancel}}}
</includeonly>

[edit] Property:Testattribut

[[Has type::Type:String]].

* [[Allows value:=Wert1]]
* [[Allows value:=Wert2]]
Hi - Semantic Forms' template parsing (where it tries to associate between template fields and properties) is not perfect - in this case, it could be the extra space in the #set call that's messing it up. If that happens for any reason, you can always hardcode the relationship by adding "|property=..." to the "field" tag in the form definition. By the way, your property page is using very old syntax - that might be the cause too. I would suggest recreating the property using Special:CreateProperty. Yaron Koren (talk) 13:44, 10 April 2012 (UTC)
Thank You! I changed the Property:Testattribut to the latest style
[[Has type::String]]

* [[::Wert1]]
* [[::Wert2]]

Field definition in Form:Testformular ist changed to

{{{field|Testattribut|property=Testattribut}}}

And #set in Template:Testvorlage is changed to

{{#set:Testattribut={{{Testattribut|}}}}}

This is not working.

Declaring the allowed values directly with the field like works fine. I asume this is not the recomended way, as you cannot reuse the value set.

{{{field|Testattribut|values=wert1,wert2,wert3}}}

Any hint?

That's very odd - the generated property page should have "Allows value::Wert1", etc. I can't duplicate that problem, but if you add in "Allows value" to the property page, it should work. Yaron Koren (talk) 15:40, 10 April 2012 (UTC)

[edit] "Values dependent on" explanation

Can someone add an explanation of the new "values dependent on" feature (add in v2.4)?

Does this feature allow us to specify a SMW query based on the value selected in another field? How is the dependency defined?

It's already explained in the documentation, but the explanation could probably be a little more verbose. No, you can't specify a query - the querying is done automatically. The classic use case for it is that, if the user selects a certain value for a "Country" field, the "City" field will then only autocomplete on values that already exist on the wiki on pages with that value for "Country". If that makes sense. Yaron Koren (talk) 15:10, 12 April 2012 (UTC)
Do sub properties work in this context in some smart way? I have a situation with Organizations and Contacts on pages and Customers with Contacts on other pages. On the pages with customers (which are organizations, so Customer could probably be a subproperty of Organization) and contacts I would like to select a customer and then get an autocomplete of all contacts with that organization. Could the 'values dependent on' feature support that in any way? --AdSvS (talk) 07:22, 9 May 2012 (UTC)
I'm not sure if I understand the details (is a contact a person?), but you could always try it... Yaron Koren (talk) 12:58, 9 May 2012 (UTC)

[edit] BUG: question marks instead of Cyrillic in Uploading filename

use form Images_test for upload file аватар.gif.

аватар.gif uploaded in wiki succeeded, but filename in form contain question marks instead of Cyrillic Test_cyrrilic_by_images_test--Pastakhov (talk) 07:50, 13 April 2012 (UTC)

Yes, I know... it's there in the "Known bugs" section. I wish it were fixed already - I spent a while looking into it, but I couldn't figure out a solution. Yaron Koren (talk) 16:12, 13 April 2012 (UTC)
Resolved: Remove line 386 ($basename = utf8_decode( $basename );) in file SF_UploadWindow.php. It helped me --Pastakhov (talk) 05:37, 16 April 2012 (UTC)
Cool - I'll look into that. I seem to recall having tried that, and that it doesn't work in all cases (i.e., that utf8_decode() is sometimes needed), but it's worth examining again. Yaron Koren (talk) 16:24, 17 April 2012 (UTC)

[edit] Template in editor without breaks

How can I create a form with a template, which will show the template in editor without breaks.

Example:
My form generate this text in editor:

{{Templatename
|parameter1=test1
|parameter2=test2
}}

I want to have:
{{Templatename|parameter1=test1|parameter2=test2}}

It is possible?

Greets

I don't think so - why do you want that? Yaron Koren (talk) 16:25, 17 April 2012 (UTC)
I need that, because we use a visual Editor. With that breaks, the editor writes automatically "<br />" and the Template is not working. Also it would be more clearly and the Text in editor would be shorter. --80.149.179.2 09:50, 24 April 2012 (UTC)
Is there really no chance?
I think you can do it manually, by removing the \n from line 1250 of SF_FormPrinter.php. Then again, if you use a form to also *edit* each page, none of this should be an issue... In any case, the WYSIWYG editor you're using clearly has a major bug. Yaron Koren (talk) 17:49, 24 April 2012 (UTC)

[edit] Problem with input type = googlemaps

Hello,
I just installed SemanticForms, Maps and SemanticMaps. Unfortunetaly people of the SemanticMaps Forum couldn't help. The Problem is, that the map cannot be load in a semantic form via input type=googlemaps. This is the same case with yahoomaps and openlayers. There is only the sentence "Loading map form input" visible in the form and no further step is done. Also the browser isn't loading anymore. Firebug extension throws an error that the variable "lat" and "lon" is not defined, but I didn't find the code, where this is declared. My installation: MediaWiki 1.17.0_0 SMW 1.6.1_3 SF 2.2.1_1 Maps/SemanticMaps 1.0.3

I hope somebody can help.

Best regards...

You're apparently using versions of the code from the SMW+ package - so I think only the people from Ontoprise can help you. Yaron Koren (talk) 17:16, 19 April 2012 (UTC)

Unfortunately, they cannot help. Could you think of some reason why the map is not loading? Could this have something to do with the Resource Loader? Could jQuery be the problem? I haven't found this error anywhere else.

Cheers

You can check for a Javascript error - see the fifth item here. Yaron Koren (talk) 17:45, 24 April 2012 (UTC)

[edit] Fatal error: Cannot redeclare class SFUploadWindow in /{path to wiki}/extensions/SemanticForms/specials/SF_UploadWindow.php on line 1102

Hi,

After upgrading from MW 1.17.1 to MW 1.18.2, I can no longer access the Special pages. Instead I get this error message:

Fatal error: Cannot redeclare class SFUploadWindow in /{path to wiki}/extensions/SemanticForms/specials/SF_UploadWindow.php on line 1102
Installed software
Product Version
MediaWiki 1.18.2
PHP 5.2.17 (cgi-fcgi)
MySQL 5.1.39-log
Semantic Forms (Version 2.4.2)

I also experienced a very similar issue on a different wiki several months ago:

Fatal error: Cannot redeclare class SFUploadWindow2 in (path to MediaWiki)/extensions/SemanticForms/specials/SF_UploadWindow2.php on line 1101

Fatal error: Cannot redeclare class SFUploadWindow2 in (path to file) SF_UploadWindow2.php on line 1117

Have any clues emerged since that time which might explain what's going on with this type of error?

Kind regards,

-Davydog (talk) 17:46, 20 April 2012 (UTC)
Hi - it's too bad that this is still a problem. Have you tried un-installing all the extensions except for SMW and SF? Yaron Koren (talk) 03:07, 22 April 2012 (UTC)
Hi Yaron. I've tried just about every combination of extension installation / uninstallation that is practical that I could think of. PortlandWiki has grown to rely on a number of the installed extensions, so I couldn't uninstall them all. Ultimately one of the other admins and I decided to uninstall the semantic extensions.
Sounds reasonable. Yaron Koren (talk) 17:43, 24 April 2012 (UTC)

[edit] "Autocomplete on" or "values from"

I have a weird behavior in my installation. On old versions of Semantic Forms, the field attributo to autocomplete over categories, properties, etc. was "autocomplete on ...". But the new manual says: "values from ...".

I'm using version 2.4.2 ... but I need to use autocomplete on !!! values from desn't work (for me...).

Can I solve this?

Thanks. Fernando Carpani (talk) 18:30, 20 April 2012 (UTC)

Yes, the syntax changed - the correct approach is to have "|input type=text with autocomplete|values from...". (Or "textarea with autocomplete".) If that doesn't work, let me know. Yaron Koren (talk) 20:34, 20 April 2012 (UTC)

[edit] text around the generated form text

Hi,

is there a possibility, to a default text, around the generated Template text?

Example:
My form should generate:
<!-- Please ignore the following text -->
{{Template|
asdfasdf=as
}}
...

<!-- Please start with your article after this line -->

No, there's no way to do that. Yaron Koren (talk) 17:43, 24 April 2012 (UTC)

[edit] if use record properties,the Semantic Forms change very slow!

who can help me?--221.129.245.100 09:48, 27 April 2012 (UTC)

Hi - I don't really understand the question, but I wouldn't recommend using the Record type - I think #subobject or the Semantic Internal Objects extension are the better options. Yaron Koren (talk) 14:29, 27 April 2012 (UTC)

[edit] Namespaces - form autocompletion and template links

I am using a few namespaces (for various reasons - and I know there are arguments against) and want have page links across namespaces with minimal display of the namespace name.

An example. Two classes: Building, Room (form, template and namespace with these names, category with the plural version).

To get this to work I had to do the following: The property Located in building is a Page type.

The Room form (forminput) field to edit the building name:

! Building:
| {{{field|Building|input type=text with autocomplete|existing values only|values from namespace=Building}}} 

OR

| {{{field|Building|property=Located in building|existing values only|values from namespace=Building}}} 

The Room template:

! Building
| [[Located in building::Building:{{{Building|}}}{{!}}{{{Building|}}}]] 

Notes:

  • Template: to avoid red-links the template needs to insert the namespace destination of field value for the link to work. This seems to mess up some of the semantic property detection.
  • Form: autocompletion doesn't work without the 'input type' or 'property' defined. Presumbly the template changes prevent auto property detection.

Q: Is there a better way?

Thanks. Bejay (talk)

That looks fine to me... I assume everything works? The second option, using the "property=" parameter, is the way to go - SF's property detection will never be perfect, so that's the ideal way to get around any problems. Yaron Koren (talk) 13:26, 1 May 2012 (UTC)

[edit] Pointing red links to a form only works if those links are of property type Page

Quoting from the page: http://www.mediawiki.org/wiki/Extension:Semantic_Forms/Linking_to_forms#Pointing_red_links_to_a_form :

"The standard way to point red links defined by a property to a certain form is to simply add the special property 'Has default form' (see 'The "edit with form" tab') to the page for that property." I've found this is doesn't work when the property-type is String, but it does when the property-type is Page.

I have a template with properties of type String and Page. Some of the values for the Page-type properties are the names of non-existent pages; when clicked, the new page creation form is shown, as desired. However, some of my String-type properties are also linked: that is, they have double square brackets around them. I have set $smwgLinksInValues = true; in my LocalSettings.php, so that they are treated properly as links.

In the query results, if those values aren't the name of an existing page, they show up as red links as expected; but though I've added the "default form" property to that property's page, when they are clicked they still go to the default non-form "Create new page" page.

I don't know if this is a bug or not, but I thought I'd report here in case anyone else has this problem; a bit of clarification in the docs might also be helpful. Pjrich (talk) 20:51, 1 May 2012 (UTC)

No, it's not a bug - maybe the documentation should be somewhat clearer. Yaron Koren (talk) 12:37, 2 May 2012 (UTC)

[edit] Multiple field display

I am having trouble with multiple instance templates, i have created a "gallery" template and form that let users upload several images to be inserted into a gallery via the template. My question is, how do i map each instance to a value to add to my template?

The form has a field called "ImageG" set to multiple. Now in my template, i would usually display the image by using [[File:{{{ImageG|}}}]] but how do i pull out the other files users add? Is there a way to append a number or something to the end of the field name each time an instance is created so my template would display...

[[File:{{{ImageG}}}]] [[File:{{{ImageG-1}}}]] [[File:{{{ImageG-2}}}]]

or something like that. I looked at SIO extensions, is that what i should use? I'm a bit confused on how to implement it.

Thanks!

There's definitely some confusion here - is this a template that appears on the page multiple times, or a field that holds multiple values? And are you trying to store these file names semantically? Yaron Koren (talk) 12:42, 2 May 2012 (UTC)
I don't need to store anything semantically, it's a template that appears multiple times and not a field that holds multiple values. The goal is to upload an image and if the user wants they can click "add another" and upload another image and so on to add to a gallery at the bottom of a page. I just don't know how to pass the filename from the field into the template the form is used to fill out because there are multiple instances.
Well, if the goal is to display images somewhere other than in the template they're contained in, you'll have to store their names semantically. The best way to do that is with either the Semantic Internal objects extension or the #subobject parser function. Yaron Koren (talk) 20:59, 2 May 2012 (UTC)
Sounds good, what if i don't want to display them anywhere other than the template they're contained in? I really don't need to use semantic properties and just want to make it simple.
I don't understand the question, then. Yaron Koren (talk) 02:25, 3 May 2012 (UTC)
Sorry about my poor understanding, hopefully it will be easier to just show you. I have a form that creates this page. At the very bottom of the form is a multiple instance template that uploads images. They display at the bottom of the page stacked on each other vertically. I would like to display these images in a gallery instead of just one after the other but don't know how or where i should add the code. If you want to play with it you can use..

username: User

password: password

Thanks for the help! SMW is awesome by the way, i just started playing with queries and im blown away by the ability to pull info from the wiki and display it in a meaningful way.

Hi - I'm pretty sure, in that case, that you need to store the images semantically, and then query them. Yaron Koren (talk) 13:11, 6 May 2012 (UTC)

[edit] Free Text dependent on other field

I want to preload a free text with the standard input field, but this will be dependent on a field of the template. This means in some cases the free text should be empty and in other cases there should be content of an template (with the preload parameter). The show on select can not be used for that function, but how can i realize it?

Thanks in advance!

There's no way to do that, unfortunately. Yaron Koren (talk) 12:43, 2 May 2012 (UTC)

[edit] Modify page automatically and open it

Hi,

Would it be possible to modify a page automatically and open it in the same link? Now there is a parameter 'reload' that works on the page you're on. Perhaps the option to open the modified page could be added?

--AdSvS (talk) 11:40, 7 May 2012 (UTC)

I'm not aware of any way to do those two things at one time. Yaron Koren (talk) 13:23, 7 May 2012 (UTC)

[edit] Values from allowed values?

Is there a way to restrict the selectable values to the set of values of Allows value for the "associated" (or a specified) property? Because that would be pimp.

76.107.76.96 02:15, 11 May 2012 (UTC)
You can always just add "|property=some property" to the "field" tag. Pimp, right? Yaron Koren (talk) 12:05, 11 May 2012 (UTC)
ROFL. I wish the Lord would take me now.
76.107.76.96 02:18, 12 May 2012 (UTC)
Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox