Jump to content

Extension talk:Page Forms/Archive April to June 2012

From mediawiki.org

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

Can you duplicate this problem on a public wiki, like scratchpad.referata.com? Yaron Koren (talk) 14:56, 3 April 2012 (UTC)Reply
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)Reply

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

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

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?

Template:Testvorlage

Blub

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

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

Form:Testformular

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

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

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

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

"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)Reply
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)Reply
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)Reply

BUG: question marks instead of Cyrillic in Uploading filename

Note: Bug 33233 was filed to address this problem too.

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

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)Reply
Resolved: Remove line 386 ($basename = utf8_decode( $basename );) in file SF_UploadWindow.php. It helped me --Pastakhov (talk) 05:37, 16 April 2012 (UTC)Reply
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)Reply

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

no breaks between the templates

It works!! THANK YOU!
Is there also a gimmick that I have no breaks between the templates?
Example:
{{Template1}}
{{Template2}}
{{Template3}}
I want to have:
{{Template1}}{{Template2}}{{Template3}}
--80.149.179.2 11:48, 15 May 2012 (UTC)Reply
I think, I have to delete also a "/n" in SF_FormPrinter.php.
But in which line? Please help me somebody! --80.149.179.2 08:12, 24 May 2012 (UTC)Reply
Okay, I just looked it up - try removing it in lines 287, 300 and 1403. Yaron Koren (talk) 13:16, 24 May 2012 (UTC)Reply

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

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)Reply
Was anybody able to solve this? - I also have SMw+

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

"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)Reply

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

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

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

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

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

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

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

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

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

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

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

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

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)Reply
You can always just add "|property=some property" to the "field" tag. Pimp, right? Yaron Koren (talk) 12:05, 11 May 2012 (UTC)Reply
ROFL. I wish the Lord would take me now.
76.107.76.96 02:18, 12 May 2012 (UTC)Reply

Displaying information based on preloaded data

Hi,
I hope you can help my with the following problem:
I preloaded data to a form via a query string like the following:
.../index.php/Special:FormEdit/Single_Note?Single_Note[Experiment]=experimentName
Now I tried to display the result of a query on the form page like this:
{{#show: <Single_Note[Experiment]> | ?Overview}}

This did not work. But is there any possibility to access the query parameters for a semantic search?

You'll probably have to use the UrlGetParameters extension. Yaron Koren (talk) 18:52, 22 May 2012 (UTC)Reply
Thank you very much. I'll try that.

Page Display Title Changed after edit using a form ??

Hi

I have set up a form to define a variety of semantic properties in a page and everything seems to be working fine except that after saving the page using the semantic form the display title on the page changes and I need to do a normal edit-save to change it back.

For example:

Can anyone shed any light on this, is it a semantic form related issues or a more general mediawiki issue. Has anyone else experienced this, is there a work around?

Thank you for any suggestions you can offer. Jpadfield (talk) 16:21, 23 May 2012 (UTC)Reply

What happens if, instead of resaving, you just refresh the page, by going to "action=purge"? Yaron Koren (talk) 16:36, 23 May 2012 (UTC)Reply
Ok I have given it a go and yes "action=purge" also corrects the title. I have explored a bit more and the problem seems to be related to a non standard extension which is included in the form. So perhaps it is due to the parsing processes used in the extention. I will need to explore some more. Thanks. Jpadfield (talk) 20:07, 23 May 2012 (UTC)Reply
[SOLVED] The problem was due to an incorrect usage of the parser within $wgOut in an extension. The problem was solved by using:
$localParser = new Parser();
$output = $localParser->parse(
  $output, $parser->mTitle, $parser->mOptions);
rather than:
$output = $wgOut->parse($output);
Jpadfield (talk) 11:44, 24 May 2012 (UTC)Reply

#arraymap

I am attempting to use arraymap. I call it as such on my template:

{{#arraymap:{{{Tier 1|}}}|,|@@@@|[[Tier 1::@@@@]]}}

and get output of:

{{{Tier 1|}}} (Yield icon) with mouseover = The given value was not understood. 

Is there something I am missing?

Scott MediaWiki 1.18.0, PHP 5.3.8 (cgi-fcgi), MySQL 5.5.19, Semantic Forms (Version 2.4), Semantic MediaWiki (Version 1.7.0.1)

What's the value that's being passed in for "Tier 1"? Yaron Koren (talk) 23:59, 31 May 2012 (UTC)Reply
Thx, Tier 1 property is a Text input type. It was loaded with dummy data of "1,2,3" originally loaded when it was simple text field loaded with
! Free Text:
| {{{field|Tier 1}}}
You should probably change the "Tier 1" property to be of type "String", instead of "Text". Beyond that, I don't know - I didn't fully understand your explanation. Yaron Koren (talk) 20:49, 1 June 2012 (UTC)Reply

Show on Select - Slow on Select

In my mw 1.18 and mw 1.19 experimental upgrades, forms with show on select visually look like a throttle was added to the Show On Select items (on or before 2.4.2), causing it to render changes slower than it used to (SF 2.1.2). Is there a global to turn this off? If not can one get added?

Thanks. --Salquint (talk) 02:01, 9 June 2012 (UTC)Reply

"Slow on select" - clever. My guess is that this is related to the use of the ResourceLoader, and the "flash of unstyled content" that comes when the page first loads, which makes it look like the page is taking longer to load - see here. Is that possible? Yaron Koren (talk) 18:02, 10 June 2012 (UTC)Reply

Form fields outside of forms for navigation - jump menu

Is it possible to use a combobox with autocomplete and restricted to category values to create a jump menu? By a jump menu, I mean a device that will take you to the page within the category that matches the value being entered. I'd like to use this on a Main Page as an alternative method of navigation. please forgive me if I'm missing the obvious. Thank you for any help.

--Joel m michael (talk) 18:16, 9 June 2012 (UTC)Reply

That's well out of the scope of Semantic Forms. I would just put in the necessary HTML and Javascript using the Widgets extension. Yaron Koren (talk) 18:03, 10 June 2012 (UTC)Reply
Ah, okay. Thank you. --Joel m michael (talk) 04:46, 11 June 2012 (UTC)Reply

Complex Query with Conditional Statements

I'm trying to create a pretty complex query using a query form for a safety system I'm building. My data structure is essentially:

Page of Category=Hazard, has properties:

  • Hazard type = Note OR Caution OR Warning (three levels of hazard; cannot be null)
  • Location (hazard is present when in a particular location; can be null)
  • Hardware (hazard is involved with handling particular hardware; can be null)
  • Interface (hazard is involved with actuating a particular interface; can be null)
  • Hazard description (explanation of the hazard)

Note: Hardware and Interface are similar. An example of a hardware-related hazard may be the possibility of electrical shock when removing a radio from its housing. An example of an interface-related hazard may be the possibility of electrical shock when disconnecting a particular type of connector; that connector may be on the radio, but it also may be present elsewhere.

I've attempted to create a query form that allows me to select multiple locations, hardware, and interfaces using three comboboxes, and find all Notes, Cautions or Warnings. I believe the query I'm looking to build should look like this:

{{#ask: [[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite A]] OR [[Location::Worksite B]] OR [[Location::Worksite C]]
      OR [[Hardware::Widget A]] OR [[Hardware::Widget B]] OR [[Interface::Connector A]]
|? Hazard description
|  format = template
|  template = My template
}}

I've had trouble building such a query, so I simplified to looking for just Location for now. To accomplish this functionality I build my query with the following:

{{#ask: [[Category:Hazard]] [[Hazard type::Note]] {{#arraymap {{{Location input|}}} |,|x| [[Location::x]] | OR }}
|? Hazard description
|  format = template
|  template = My template
}}

Which should expand to the following for multiple-location queries:

{{#ask: [[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite A]] OR [[Location::Worksite B]] OR [[Location::Worksite C]] 
|? Hazard description
|  format = template
|  template = My template
}}

And expand to the following for single-location queries:

{{#ask: [[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite A]]
|? Hazard description
|  format = template
|  template = My template
}}

The problem is if I query for "Location A" I'll get 5 results, "Location B" I'll get 2 results, and "Location C" I'll get 4 results….but If I query for Location A, B and C together? I get 15 results (not the 11 expected)! Upon further investigation this is because when I query for multiple locations it stops returning only [[Hazard type::Note]]. It will also return Cautions and Warnings.

So what am I doing wrong?

Thanks

Jamesmontalvo3 (talk) 19:19, 16 June 2012 (UTC)Reply

I don't know, but this sounds like a Semantic MediaWiki, as opposed to a Semantic Forms, question. The SMW mailing list might be the best place to ask it. Yaron Koren (talk) 13:10, 18 June 2012 (UTC)Reply
The operator OR is used for taking the union of two queries. So your query is split into 3 querys:
{{#ask: [[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite A]] OR [[Location::Worksite B]] OR [[Location::Worksite C]] 
|? Hazard description
|  format = template
|  template = My template
}}

Is asked in three Steps:

[[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite A]]
[[Location::Worksite B]]
[[Location::Worksite C]]

You have to use Subquerys or the || Operator like:

[[Category:Hazard]] [[Hazard type::Note]] [[Location::Worksite A||Worksite B||Worksite C]]

This Page might be helpfull for you: Selecting Pages --TomyLee (talk) 07:12, 20 June 2012 (UTC)Reply

Autoedit stopped working in MW 1.19.x

Hi, might autoedit have stopped working in MW 1.19.x?

However, this can be overcome by commenting an exception thrown in MW includes/db/Database.inc:

        /**
         * Called by serialize. Throw an exception when DB connection is serialized.
         * This causes problems on some database engines because the connection is
         * not restored on unserialize.
         */
        public function __sleep() {
                // throw new MWException( 'Database serialization may cause problems, since the connection is not restored on wakeup.' );
        }

Can anyone else confirm? --Toniher (talk) 09:15, 19 June 2012 (UTC)Reply

I'm using Semantic Forms and everything works fine. But if i upgrade my MediaWiki installation and the Semantic Forms Extension the Buttons created by formlink doesn't work.

Here are some Data of my installations:

Before updating:

  • MediaWiki 1.15.1
  • Semantic Bundle (Version 2011-03-29.20110329)
  • Semantic Forms (Version 2.2.1)

After upgrading;

  • MediaWiki 1.19.0
  • Semantic Bundle (Version 20120327)
  • Semantic Forms (Version 2.4.2)

Some example of formlink i'm using:

{{#formlink:form=News|link text=eine neue News erfassen|link type=button|query string=News[Art]=News }}

If I insert the dynamic created link from the button into the Browser Adresslist i can create a new Page with SF (like ...index.php?title=Spezial:FormEdit/News&News[Art]=News)

Second i recognise that if i save the new form i get an errormessage at the end of the page "Das Datum „now“ wurde nicht verstanden."

I'm using a field with the actual date:

{{{field|Datum|mandatory|default=now|hidden}}}

The parameter default=now is saved as Datum=now instead of the actual date.

I have made a copy of my Installation into a different Directory so i have both installation parallel. I'm using Internet Explorer 9

Any Ideas what might be the Problem?

--TomyLee (talk) 06:45, 20 June 2012 (UTC)Reply

I have found a solution myself. I need to do two thinks to get the buttons working. First i changed the #formlinkparameter "link type=button" to "link type=post button" and second i need to change the Documentmodus from IE7 to IE9. I have done these with a few lines in localsettings.php
$wgExtensionFunctions[] = 'globalIE9Modus';
 function globalIE9Modus(){
 global $wgOut;
 $wgOut->addMeta ( 'http:X-UA-Compatible' , 'IE=9');
}
--TomyLee (talk) 09:12, 25 June 2012 (UTC)Reply

Error: Backtrace limit exceeded during parsing

Hi Yaron, I'm getting the following error when loading a template into a fairly large form. It's easy to fix, so this is just a heads-up really incase you haven't encountered it in the wild and a bit of googlefodder to help anyone else who comes across it.

Semantic Forms error: backtrace limit exceeded during parsing! Please increase the value of pcre.backtrack-limit in the PHP settings.Semantic Forms error: backtrace limit exceeded during parsing! Please increase the value of pcre.backtrack-limit in the PHP settings.

Changing the PHP ini wasn't an option for my target server but you can either set the value in .htaccess, or you can put this line in your LocalSettings.php

ini_set('pcre.backtrack_limit',10000000); //10million

From what I've seen it seems PHP 5.3 set this to an overly restrictive value, so I set mine to 10 million and that's seems to have solved the problem.

Thanks, Andru

Oh... I should change the error message to say that you can also set it in LocalSettings.php. Thanks. Yaron Koren (talk) 19:52, 20 June 2012 (UTC)Reply

Check value of template variable in form

Hi Yaron, Is there a means you're aware of to check the value of a variable defined in a template from the form which defines it? What I'm trying to achieve is to show/hide a field depending whether it already has a value or not. The following example doesn't work, as the template variables are loaded into the form fields but not defined as form variables, but it demonstrates the functionality I'm searching for. Is there a way you're aware of to simulate this behaviour?

{{{for template|Some Template}}} <div {{#if:{{{some var|}}}|class="active"|class="collapsed"}}> {{{field|some var}}} </div> {{{end template}}}

Thanks Andru

Hi - if that value is being stored semantically, then you could have something like "{{#show:{{PAGENAME}|?Property Name}}" there, right at the beginning of the #if call. (This will only work, though, if the URL looks like "...action=formedit", as opposed to "Special:FormEdit...".) Yaron Koren (talk) 14:06, 25 June 2012 (UTC)Reply

Extending Forms to include executed PHP code?

I have the wish to add some PHP processing when a Semantic Form is displayed. Is this possible? Note that of course I would wish to do it in the most secure way possible. Some sort of local file include perhaps? Thanks.

There are various hooks that let you do that, although maybe more can be added. What specifically do you want to add? Yaron Koren (talk) 16:03, 25 June 2012 (UTC)Reply
Thanks for the response, there's a few things I'd like to do, but here's an example of one of them. A user goes to an existing form to create a new page. The title of the page they want to create is "Town_name,Country_name" ... I wish to pre-populate the form fields for Town and Country from the page name that they are adding. E.g. "Dallas,USA" page creation pre-populates the already defined properties as Dallas for the Town field, and USA for the Country field. Hope that makes sense. ;-) Thanks again.
That makes sense, although it might be possible already with the existing code. One way is with a page name formula, using the "one-step process", and another is using the #titleparts and #explode functions within the "default=" parameter. Yaron Koren (talk) 17:37, 25 June 2012 (UTC)Reply

default=now doesn't work [solved]

After Upgrading my Wiki and Extensions the default=now doesn't work.
See Bug 34549
I edit the File 'extensions\SemanticForms\includes\SF_FormPrinter.php'
On Lines 1158+1161 change the '===' to '=='

And the default=now works again

--TomyLee (talk) 08:45, 27 June 2012 (UTC)Reply

Partial form followed by free text

Hi Yaron. I was wondering why in some of my forms, the free text field was automatically populated with the syntax used on the page (the page to be edited). After comparing the forms I found that the problem is caused by a partial form preceding a free text field – or in any case, removing the partial form from the form page fixed it. Is it a bug or is there anything syntax-wise we should be aware of to avoid this type of behaviour? Regards, Cavila MW 1.17, MySQL 5.5.23, Php 5.3.10, SMW 1.7.1 14:51, 28 June 2012 (UTC)Reply

Hi - I don't know; I know the handling of partial forms has some bugs in it. If you can avoid using partial forms, I'd say that's the way to go. Yaron Koren (talk) 18:51, 29 June 2012 (UTC)Reply
Thanks and no problem! I seem to have misunderstood the function of a partial form anyway, since from an early stage onwards I was somehow under the impression that {{{info|partial}}} was required when a form covers more than one template. In other words, yes, I can happily avoid it. Cavila MW 1.17, MySQL 5.5.23, Php 5.3.10, SMW 1.7.1 18:28, 4 July 2012 (UTC)Reply