Extension talk:Page Forms/Archive March to April 2013

From MediaWiki.org
Jump to navigation Jump to search

Contents

Always display query string?

How can I make my form to display a query result page, so that the query string is always shown in the URL line? is there a simple setting for this? Osishkin (talk) 06:55, 1 March 2013 (UTC)

You mean, have Special:RunQuery show its values in the URL query string? I don't think so; why do you want that? Yaron Koren (talk) 13:40, 1 March 2013 (UTC)
I want to allow users to share (facebook, email etc) pages of query results using an AddThis button. But since the query string is not displayed (I assume due to using a POST request), this is not possible Osishkin (talk) 22:09, 1 March 2013 (UTC)
Hm, that's true. Maybe a "link to these results" link at the bottom of any set of results would fix the problem? Yaron Koren (talk) 14:19, 5 March 2013 (UTC)
I can create that manually, but it would be much better to simply have the results in the URL line, so the AddThis button may be used Osishkin (talk) 14:59, 5 March 2013 (UTC)
By the way, this would also be useful for tracking search queries with Google Analytics Osishkin (talk) 12:01, 9 March 2013 (UTC)

Create dynamic form

I am trying to create a form describing a multi-step process, where the number of steps isn't necessarily known (e.g. imagine a system for creating recepies, where the number of steps may vary). Is it possible to create a form which is dynamic, i.e. that it is possible to add new fields on the fly? (Similar to the CreateTemplate page where you have an "add field" button)

MathiasLidal (talk) 12:52, 5 March 2013 (UTC)

Yes - that's what multiple-instance templates are for. Yaron Koren (talk) 14:08, 5 March 2013 (UTC)

Preload of text input field with special string

Hello, I need to preload a text input field with a special string which is joined together by the string "hvg" plus the hexadecimal Unix timestamp. The PHP formula would look like:

$var = "hvg" . dechex(time())

Can I do this without writing an own extension? If yes, how?

Many thanks in advance for any support!

Cheers...

--Sochin67 (talk) 15:46, 8 March 2013 (UTC)

For something that specific, I think you'd need an extension. Yaron Koren (talk) 20:32, 8 March 2013 (UTC)
Created my first little extension and it works ;-) --Sochin67 (talk) 20:38, 17 March 2013 (UTC)

Embedded template: list of values for field

I know how to define list of values for property so field for this property becames dropdown list with this list of values. But is it possible to define such behaviour for embedded template (with multiple) that defines subobject? Are subobject's fields real properties? Please, give me a clue or small example. Thanks

Yes, the fields in a #subobject call are real properties, and they should be defined on the wiki - including a list of allowed values where necessary. It could be, though, that Semantic Forms won't make the connection between a field and its property, if you use #subobject - if that's the case, you should add a parameter like "|property=property name" to each of those fields' tags.
Thanks, it works!

Subpage behaviour

Hello, In SF 2.5.1 I've noticed that pages within a subpage (Namespace:Basepage/Subpage) seem to ignore default form (in both NS and category). I think it didn't happen in some 1-2 years old versions. Is this an intended behaviour? If so, how should I fix this? Thanks! --Toniher (talk) 17:55, 13 March 2013 (UTC)

Yes, subpages no longer get the default form for their namespace - the thinking behind it was that subpages rarely have the same structure as main pages. As for the category not having an effect either - that sounds like a serious bug. Or do you just mean that page A belongs to a category, but page A/B doesn't get the form for that category? Also, out of curiosity, what namespace is this? Yaron Koren (talk) 21:12, 13 March 2013 (UTC)
Hi Yaron. It's a custom Namespace (Private). However, I'm wrong: it works with categories. No with subcategories (but I see you already commented it here). Mystery solved. Thanks! --Toniher (talk) 10:18, 14 March 2013 (UTC)

Autocomplete on categories with SQLStore3

There is aapparently problem with the "values from category" option. I use it with a combobox, but it pulls every page in the wiki on autocompletion instead of restricting it to the pages from the appropriate category.

  • MediaWiki: 1.20.2
  • Semantic Forms: 2.5.2
  • Semantic MediaWiki: 1.8
  • SQLStore3

--- I'm seeing the same thing too (also with "values from property"). It affects the parameter values for the invoked template.

  • MW 1.20.0
  • SF 2.5.1
  • SMW 1.8rc1
  • SQLStore3
That one is less surprising - only SF 2.5.2 (and newer versions, once they come out) is supposed to fully support SQLStore3.
Okay, I checked out SF 2.5.2 and am still seeing same thing.
I tried to duplicate this, and looked into the code, and now I really can't understand what's going on. "values from category" works fine for me; and in fact, the code doesn't use SMW querying at all, so the use of SQLStore3 shouldn't be affecting it. A few questions: are these wikis where the problem is occurring public? And if not - is this using "remote autocompletion"? And does it really seem to match on every page, or is there some pattern to the set of pages that get matched? Yaron Koren (talk) 15:49, 1 April 2013 (UTC)

Delete a page using a form

Hi Yaron,

thanks for the great work! I use SF 2.5.1 on SMW 1.8/MW 1.20 with formlink and popup to create and edit items on a list (saved as subpages). Do you see a possibility to delete a page as well using SF, maybe using a standard input or a parameter for the formlink? Or could one set a link with parameter action=delete and enable popup for it as well?

Thanks in advance

--80.149.87.126 13:57, 15 March 2013 (UTC)

I don't think there's any way to do that - you would need a separate parser function to handle deletions. (Though it may not be a good idea anyway.) Yaron Koren (talk) 22:12, 15 March 2013 (UTC)
Ok, I can see that. Would it in general be possible to popup a regular link to an internal (or external?) page? Currently I have set a link to the regular ::action=delete page (users have the right here), but it somewhat destroys the user experience by not opening the page in a popup.
Thanks! :) 80.149.87.126 08:49, 18 March 2013 (UTC)
That's an interesting idea, but I'd say it's outside the scope of Semantic Forms. Yaron Koren (talk) 12:16, 18 March 2013 (UTC)

Form to create Google map with multiple markers

Dear Yaron,

I'd like to set up a semantic form to create one Google map with multiple markers and - if possible - separate labels for each marker.
I have managed to put together a form that creates one map with one marker and I also added an additional text field for defining a label for that marker. I could also make this map template "multiple" but of course this adds more maps rather than additional markers inside one map. Could you give me a hint how to tackle this?
Many thanks!

--Sochin67 (talk) 20:36, 17 March 2013 (UTC)

I don't fully understand your setup, but you could have the multiple-instance template store the data, and the "main" template (if there is one) query that same data, and display it in a map. Yaron Koren (talk) 20:49, 17 March 2013 (UTC)
Hi Yaron, I thought it wasn't a good idea to store and query data on the same page, because the query might not produce the right result? --AdSvS (talk) 11:46, 18 March 2013 (UTC)
It should be fine - the issues only come if you then try to store those query results. Yaron Koren (talk) 12:14, 18 March 2013 (UTC)

use dropdown broken on input type category?

Hi Yaron,

input type category will not show up as a dropdown using SF 2.5.1 on SMW 1.8.0.2 and MW 1.20.2. {{{field|Skill|input type=category|top category=Skill|height=200|mandatory|use dropdown}}} only shows up as category tree. Is this a bug, or do I need some more configuration? Additionally: Is it possible to use show on select on a category tree using dropdown? Thanks for your support!

Kind regards --80.149.87.126 09:05, 18 March 2013 (UTC)

You just need to upgrade - that feature was only added in SF 2.5.2. I don't know if "show on select" will work with it, actually... Yaron Koren (talk) 12:12, 18 March 2013 (UTC)
Thanks Yaron - that did it. I didn't see, that it has just been added recently. I tried show on select, and it does not work out of the box, maybe, it can be added in the future? --80.149.87.126 13:30, 20 March 2013 (UTC)
Okay - yes, it's not surprising that it doesn't work. And I agree that it would be great if it could work in the future. Yaron Koren (talk) 18:51, 20 March 2013 (UTC)

Dropdown menu with blank spaces

Hi Yaron,

I updated from SF 1.8.3 to SF 2.5.2 (along with MW from 1.14 to 1.19, and SMW from 1.5g to 1.8.0.4). SMW's data was repaired after the update and Semantic Drilldown seems to indicate that the new data is fine. I had several dropdown menus created with the "values from category" option that didn't show any more, but I took that as a change in functionality that I could fix that by adding "input type=dropdown" to the template. However, categories with spaces in those fields cannot be searched now. Whether I use the dropdown menu or go back to the text box, the search returns no value. Categories without spaces do work. I'm rather shocked that no one else has the same problem. It must be me doing something wrong, but I've failed to find it. My first contact with SF has been this update.

Is there anything one should do to be able to use categories with spaces in search fields?

Many thanks in advance!

Best,

Oscar

By "search", do you mean the standard MediaWiki search? If so, it doesn't sound like a Semantic Forms issue. Yaron Koren (talk) 12:13, 18 March 2013 (UTC)
No, no, I mean the query search. The "Run query" button in the form that I created. Sorry about the confusion. If I select anything with a space from a dropdown menu, "Run query" returns no result. If I turn the dropdown menu into a text box or a combo box and enter the first non-space characters of that same entry, it does return the correct results. Entries with no spaces in the dropdown menu do work as well. It really looks like it doesn't like the spaces for some reason. Thanks!
Hi Yaron, I was wondering whether you would have some hint that I could try and see if it helps. Thanks! --141.5.11.5 09:30, 25 March 2013 (UTC)
Hi - this actually still doesn't sound like a Semantic Forms issue; it sounds like a Semantic MediaWiki issue. If you call the relevant #ask query directly, and pass in those same parameters, you should see the same problem. Yaron Koren (talk) 13:50, 25 March 2013 (UTC)
Hi Yaron, I'll check with them. Thanks for the hint. I took for granted that SF was running the search using SMW, not that it was kind of a front-end to SMW's search functions. I'll drop a line when they answer, so that this thread can be consider closed. --141.5.11.5 09:16, 26 March 2013 (UTC)

Semantic Forms with MathJax

Was not a Semantic forms issue, see Semantic Mediawiki with MathJax for details.

The whole thing sounds strange - especially the MathJax part. What are the full contents of the "Machineinfo" template? I'm guessing #forminput is not the issue. Yaron Koren (talk) 15:47, 18 March 2013 (UTC)
Hello Yaron. I can reproduce the fault on a clean Wiki (1.20.3) with only the Semantic Mediawiki and MathJax extensions enabled. In this case it does not matter if Semantic Forms is enabled or not and it seems that it is solely a MathJax issue. Because it belongs on the Mathjax page I moved this discussion to the MathJax talk page (Semantic Mediawiki with MathJax. I was so free to clean up the rest of this discussion so people do not get confused. Thanks regards, --Jongfeli (talk) 11:07, 21 March 2013 (UTC)

Form adds '}' on each save

Hi Yaron,

I have a pretty big form (there are about 60 fields in several templates). The problem is that each time that I edit a page with the form, it adds a '}' and several newline chars at the end of the page. So, if I edit it n times, I get n '}' (and newlines as well). I haven't figured out why. I dont think it is a typo in the templates (it wouldnt accumulate the '}'). I would appreciate any help :) Thanks in advance.

Benjamin. --201.217.136.181 16:20, 18 March 2013 (UTC)

That sounds very bad. Could you try to duplicate this problem on a public wiki, like http://scratchpad.referata.com? Yaron Koren (talk) 18:17, 18 March 2013 (UTC)
Well, we found the error finally. It was a typo! We had an extra '}' in a field declaration in the form:
...
{{{field|fieldname}|...}}}
...
that went into the invocation of the template, and resulted in the described behavior. Thanks for the quick response and your great work :)
Cheers, Benjamin.

Advice welcome for Wikiteck/MediaWiki community proposal

Hi, I'm drafting a proposal to improve the ways we reach out to contributors and connect them to MediWiki/Wikimedia people and tasks. So far the proposal is relying a lot on Semantic Forms for a first implementation. However, I lack the expertise, so our advice would be more than welcome. For instance, I'm wondering whether Semantic Forms would be the way to go for user groups. Please watch that page and feel free contributing feedback and help. Thank you!--Qgil (talk) 01:16, 24 March 2013 (UTC)

Edit with form on main namespace

Hi Yaron,
I want to show a form for all articles located in my main namespace. My wiki name is "Test-Wiki". I tried to place "has default form" on the following pages, but wasn't successful so far (Seiten is the German Main Namespace): Test-Wiki:Seiten, Test-Wiki:(Seiten), Test-Wiki:Main, Project:Seiten, Project:Main.
I tried other namespaces like User (Test-Wiki:Benutzer) and Templates (Test-Wiki:Vorlage) and the "edit with form" worked fine. So it seems to be an issue with the main namespace only.
Do you have any idea? Thanks! --Stefahn (talk) 11:30, 26 March 2013 (UTC)

It should be "Test-Wiki:Startseite". That's the current German-language value; I don't know if "startseite" is a good translation for "main". In any case, the SF code should always handle the English-language value as well; that would make things easier. Yaron Koren (talk) 12:23, 26 March 2013 (UTC)
Thanks. With Startseite it works. Startseite means Homepage. Don't really understand why it's not "Seiten" since this is the name of the main namespace - "(Seiten)" also shows up in the advanced search... Thanks anyway :) --Stefahn (talk) 14:14, 26 March 2013 (UTC)

Autocomplete only works after hitting space bar

Hi again,
On several forms I use #arraymap to allow multiple values for the same field (with coma as delimiter). Also I use the beautiful autocomplete function. Now if I come back to an article and want to add another value to the field, I first have to hit the space bar before I get autocomplete suggestions. If I just start typing letters I don't get suggestions. Is this the way it should work? Is there a workaround so that one doesn't have to hit space?
Thank you so much for your excellent work! --Stefahn (talk) 14:42, 26 March 2013 (UTC)

That's true - you need a comma and a space before a value for that value to get autocompleted on. I never really thought about it, but I can see how it could be annoying, or confusing. I'll try to look into it. Yaron Koren (talk) 16:12, 26 March 2013 (UTC)
Thanks for looking into this. Love your work and support!
I noticed one more thing today: It seems unpossible to edit older revisions of a page when using "edit with form". Is that true? If I select an old version and click "edit with form" I am always redirected to the latest version. PS: I only need this option if I want to revert some changes sometimes. Stefahn (talk) 18:28, 26 March 2013 (UTC)
Thanks! Yes, there's no way to do "edit with form" on an older revision - I just thought it would add confusion without any clear benefit. How would this help, when reverting changes? Yaron Koren (talk) 19:25, 26 March 2013 (UTC)
Okay, thanks for the clarification. I only need this if I test things (like Common.css for example) and want to switch back to an older revision that I saved before I started testing. I can still use "edit source" for that. Have a nice day :) Stefahn (talk) 09:00, 27 March 2013 (UTC)

FWIW

The #autoedit function is wonderful! I hadn't used it before, but found a use for it while creating a multiple-instance form with which to create multiple pages. Basically, the audoedit function was embedded in a template, using parser functions such as #if and #var from the Variables extension (the latter for assigning values that are shared by every new page, as opposed to values that are unique to them). Once the page is saved using the form, you can check if the information is correct and if the target pages do not already exist and confirm that the pages can be created. When all is done, you can simply blank or delete the page.

Even if the route, from a form to a page with 'formlinks' to multiple pages, does not look very straightforward, it's a great time-saver when you need to create a whole series of pages.

I wouldn't be me if I didn't have a couple of odd things to point out:

  • URLs passed through the #autoedit function end up being rendered incorrectly. I don't recall the exact code, but I think there is some html code added to the URL string.
  • Wiki-style italics are converted to html-style italics. No problem there though.
  • All parameters in the template, even those for which the fields were left empty, are represented in the new pages. Not really an issue either, but it can be inconvenient when there's lots of them. One possible solution here is to press the same button with which the page was created and the empty parameters will be removed.

Cavila (MW 1.19.2, MySQL 5.1.66, Php 5.3.3-7, SMW 1.8, SF 1.5.2} 16:48, 26 March 2013 (UTC)

Hi Cavila - could you create one or more bug reports on Bugzilla for these issues? It would be very helpful in getting them fixed. Maybe two would be good - one for the formatting problems, and one for the empty parameters? Yaron Koren (talk) 13:04, 28 March 2013 (UTC)

"Show changes" fails / redirects to normal edit view

Hi Yaron,
I noticed some strange behavior with "Show changes" when editing with a form:

  • On two of my wikis if I click the button, there is no diff view but all my changes (in the form) get deleted.
  • On another wiki if I click the button, it takes me to normal edit view (with diff view). Is this the normal behavior? Can you think of something that goes wrong with my two other wikis?

Thanks! Stefahn (talk) 14:27, 27 March 2013 (UTC)

What version of MediaWiki and SF are these different wikis running? Yaron Koren (talk) 16:26, 27 March 2013 (UTC)
All wikis run MW 1.19.2. The two wikis, on which the preview fails, run SF 2.5.2 alpha - the wiki where it takes me to normal edit view runs SF 2.5. Should I update all SF versions to the latest one? Thanks for your help! Stefahn (talk) 10:16, 28 March 2013 (UTC)
Hi - that might be the issue. I would try upgrading one or both of the failing wikis to 2.5.2, and see if that fixes the problem. Yaron Koren (talk) 13:07, 28 March 2013 (UTC)
Okay, updating / downgrading to 2.5.2 did the trick. Thanks.
I found another issue with "show preview". In the main namespace it works fine, but in my custom namespace "Link" the preview fails and says "The page bla.de 1 does not exist". In "edit source" mode the preview works fine.
BTW: In the template I use parser functions #if, #explode and #titleparts - maybe that interferes with SF somehow? Thanks.
Update: Found out that the preview works when first creating the page, but fails when editing the page... Maybe that helps. Stefahn (talk) 13:03, 1 April 2013 (UTC)

Partial form bug in SF 2.5.2

Hi, we recently upgraded to SF 2.5.2 and noticed that when saving partial forms, the entire page would get overwritten with just the partial form content (in our case subobjects). This occurs across several different partial forms. We did not have this problem with the previous version of SF using the same partial forms. Longphile (talk) 02:32, 28 March 2013 (UTC)

Ah... there have long been problems with partial forms, but I guess they've gotten worse. I've actually been planning to get rid of partial forms for a while, due to all their problems - maybe this will speed up the process. If it's possible, you should switch to using regular forms, that only happen to include the fields that you want to edit, if that makes sense. Yaron Koren (talk) 14:56, 28 March 2013 (UTC)
We removed the partial form tag and switched the forms to regular forms with just the partial fields and it works fine. Longphile (talk) 00:00, 29 March 2013 (UTC)
Cool. Yaron Koren (talk) 01:37, 29 March 2013 (UTC)

"Subforms" through templates?

In an older version of SMW (MW 1.15.0 with SF 1.7.3) I'm using a hack based on HTML entities to make my forms more DRY. A dozen or so forms have the same structure so I decided to avoid overlapping and I managed to do this by using HTML entities in a template, e.g.

{| class="formtable"
! Geldigheid:
| {{{field|Geldigheid-begin|input type=date}}} t/m {{{field|Geldigheid-einde|input type=date}}}
}}

Unfortunately my hack doesn't work anymore with Semantic Bundle 1.8alpha. Is there another way to do this? I could also turn all the forms into one form but this is probably more work to figure out. Guaka (talk) 15:18, 28 March 2013 (UTC)

Hi - those just look like regular curly brackets when your comment is displayed, but I know you typed in stuff like "&#123;" instead. Anyway, it's strange that it doesn't work any more. Do the same templates that used to work no longer work, and are you sure that it's due to the escaping thing? And if so, what if you used something like "<nowiki>{{{</nowiki>field..." instead? That should also work. Yaron Koren (talk) 15:23, 28 March 2013 (UTC)
I found out it's because of some JS (and/or CSS) that broke with the upgrade: class="fold-content" style="display:none;". But I'm happy to know about the <nowiki>{{{</nowiki> trick, might look better than HTML entities. Your "Working with MediaWiki" has been a good read by the way, תודה! Guaka (talk) 10:28, 29 March 2013 (UTC)
Bevakasha! Yaron Koren (talk) 02:47, 1 April 2013 (UTC)

Some guidance on different attachment behaviour with Semantic Forms

My semantic forms are working quite well; I can fill in a form (with a map) which creates a page based on my template.

Now I'd like to extend it so users can optionally add one or more files. I can get one file attachment working quite well.

There's two things I'm trying to figure out:

- is there a way for me to override the default upload form? I'd like to override the usual description / licensing / watch this file dialog and use my own semantic properties (author, publication date, etc).

- how can I make a form that ask the user for one attachment, but there's an 'add another' button which expands the form for a new entry?

Hopefully that make sense. And I really appreciate Semantic forms.

Alexthepuffin (talk) 19:50, 30 March 2013 (UTC)

Hi - for the first one, if you're talking about using an SF form to create the file page, I'm pretty sure there's no way to do that at the same time that you're uploading the file from within another form. However, you can associate a form with the "File:" namespace, which will make it easier to add that information as soon as the user goes to edit the file page.
For the second question, you can either have the "uploadable" field allow multiple values (use #arraymap in the template for that), or have a multiple-instance template for the uploaded files. If that makes sense. Yaron Koren (talk) 02:46, 1 April 2013 (UTC)
Okay! I'm on the right track, thanks. I'm really just following the instructions here: http://www.mediawiki.org/wiki/Extension:Semantic_Forms/Manual/Using_Semantic_Forms_for_file_pages_and_uploads#The_one-step_process . It explains how to add a field to an uploaded file, and I'll use that to include a gallery of files associated with that page.
I'm not there yet, but I'll use multi-instance templates to handle multiple files. Thanks. Alexthepuffin (talk) 02:46, 2 April 2013 (UTC)

Problems with passing fields as a query string to FormEdit

I'm having a problem getting a #formlink to pass on a value to preload into a form.

You can see the #formlink I'm using here: http://developingottawa.ca/index.php?title=Fsdf . It looks like this:

{{#formlink:form=Document form

| link text=Click here to upload a file

| Document form[Location]=Page Forms/Archive March to April 2013 }}

It is supposed to pass to the form 'Document form' the value of the page name to the field 'Location'. It calls the URL:

http://developingottawa.ca/index.php?title=Special:FormEdit/Document_form&Document_form%5BLocation%5D=Fsdf

That URL looks correct.

But the form doesn't fill in the field 'Location' at all.

The form includes:

! Pertains to location:

| Location

What am I doing wrong? Alexthepuffin (talk) 03:04, 2 April 2013 (UTC)

The fact that this wiki is public makes debugging much easier. :) It's because the query string should have the name of the template, not the name of the form - so it should be "Document template[location]". Yaron Koren (talk) 14:47, 2 April 2013 (UTC)
AHA! Thanks for debugging this for me. It is what I get for not using the same names for my forms and templates. Alexthepuffin (talk) 21:25, 3 April 2013 (UTC)

'Serialization of 'Closure' is not allowed'

Hi, I am trying to create forms using SemanticForms and it seems that there is a bug or problem with the SemanticForm creation.

If you go to this website: http://semantic-mediawiki.org/wiki/Demo:Event_calendar/Create_events_using_a_form and click the button Create Form.

After you click that button it directs you to: http://semantic-mediawiki.org/wiki/Special:FormEdit/Event_calendar_item?

Error:

Unexpected non-MediaWiki exception encountered, of type "Exception" exception 'Exception' with message 'Serialization of 'Closure' is not allowed' in /srv/semantic-mediawiki_org/www/core/extensions/SemanticForms/includes/SF_FormPrinter.php:440 Stack trace:

  1. 0 /srv/semantic-mediawiki_org/www/core/extensions/SemanticForms/includes/SF_FormPrinter.php(440): serialize(Object(Parser))
  2. 1 /srv/semantic-mediawiki_org/www/core/extensions/SemanticForms/includes/SF_AutoeditAPI.php(838): SFFormPrinter->formHTML(' / includeonly /<d... ' , false, true, 4410, , , 'Demo:Event cale...')
  3. 2 /srv/semantic-mediawiki_org/www/core/extensions/SemanticForms/includes/SF_AutoeditAPI.php(116): SFAutoeditAPI->doAction()
  4. 3 /srv/semantic-mediawiki_org/www/core/extensions/SemanticForms/specials/SF_FormEdit.php(90): SFAutoeditAPI->execute()
  5. 4 /srv/semantic-mediawiki_org/www/core/extensions/SemanticForms/specials/SF_FormEdit.php(46): SFFormEdit::printForm('Event_calendar_...', , NULL, true)
  6. 5 /srv/semantic-mediawiki_org/www/core/includes/SpecialPage.php(613): SFFormEdit->execute('Event_calendar_...')
  7. 6 /srv/semantic-mediawiki_org/www/core/includes/SpecialPageFactory.php(499): SpecialPage->run('Event_calendar_...')
  8. 7 /srv/semantic-mediawiki_org/www/core/includes/Wiki.php(291): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
  9. 8 /srv/semantic-mediawiki_org/www/core/includes/Wiki.php(565): MediaWiki->performRequest()
  10. 9 /srv/semantic-mediawiki_org/www/core/includes/Wiki.php(458): MediaWiki->main()
  11. 10 /srv/semantic-mediawiki_org/www/core/index.php(59): MediaWiki->run()
  12. 11 {main}

I have installed on this wiki and get this error also. It is strange since it happens both on semantic-mediawiki main wiki website. It does not seem to be isolated to my server. Anyone else having this problem. Could someone please help with this. Thanks!

Looks like this is discussed on stackoverflow: [[1]]. Maybe you can find that in SF_FormPrinter.php, line 440 99.246.162.126 12:42, 2 April 2013 (UTC)
Thanks!, Here is the code:

438 $oldParser = $wgParser;

440 $wgParser = unserialize( serialize( $oldParser ) ); // deep clone of parser
441 $wgParser->Options( ParserOptions::newFromUser( $wgUser ) );
442 $wgParser->Title( $this->mPageTitle );
443 $wgParser->clearState();

Line 440 gives the error and it says its a deep clone of parser. It is strange that it serializes it and then unserializes it..

Yes, I'm aware of the problem. That code is necessary in order to do a deep clone, but it fails with the latest versions of MediaWiki. It's something that I hope will be fixed soon. Yaron Koren (talk) 15:58, 2 April 2013 (UTC)
OK Thanks I'm using the newest version of MediaWiki. I'm looking forward to using the Forms when it's fixed.. they look really useful!

Problems with googlemap in multiple form element

Dear all
I'm having issues as follows:
I have a form with a template definition which is defined as "multiple". Inside there is a field wth input type=googlemaps. When using the form and clicking on the "Add another" button it opens and you can already see that the preloaded map looks strange, its somehow devided into squares with different colors as if the map could not load properly. Furthermore, the preloaded grey text which asks to enter the address in the coordinates text field does not disappear when clicking into the field. Finally when I enter something into one of the text fields and click on the update button, the page reloads and everything is gone, i.e. the form loads normal but the multiple form element is closed as it was the first call and nothing is saved.
What could be the problem here?
Many thanks!!
--Sochin67 (talk) 14:31, 4 April 2013 (UTC)

That sounds like an issue with Semantic Maps - I would ask in one of the venues for that extension. Yaron Koren (talk) 15:11, 4 April 2013 (UTC)
I'll do - thanks, Yaron! --Sochin67 (talk) 17:35, 4 April 2013 (UTC)

Automatically escape Pipes

hiyas,

we are using SF to enter code, so we encountered problems with code using pipes. here is my quick and dirty workaround, maybe it helps someone:

  • installed Extension:Pipe_Escape
  • changed SF_FormPrinter.php
    • line 1262: $template_text .= "|{{#!:$cur_value_in_template}}";
    • line 1266: $template_text .= "\n|$field_name={{#!:$cur_value_in_template}}";
    • Added in line 1612 at the beginning of function formFieldHTML
      • if ( preg_match ( ""#^\{\{\#\!\:#s"", $cur_value ) )
{
$cur_value = substr ( $cur_value, 5, -2);
}

this adds the parser tag {{#!: of the pipe escape extension at the beginning of any entry and closes it behind. for editing, it is being removed before showing up in the form.

seems to work with mw 1.20, smw 1.8, sf 2.5.2 and pipe escape 0.1.1, still not thoroughly tested.

have fun!

Preloading won't work in free text

Hi, I'm trying to preload a template into my free text box by using the line:

{{{standard input|free text|rows=10|preload=Template:Step-by-step_preload}}}

The preload parameter is literally the only change that I've made to the form definition, but just in case, here's the full one:

<noinclude>
This is the "Step-by-step" 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=Step-by-step}}

</noinclude><includeonly>
<div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div>
{{{for template|Step-by-step}}}
{| class="formtable"
! Project:
| {{{field|Project}}}
|-
! Activity:
| {{{field|Activity}}}
|}
{{{end template}}}

'''Free text:'''

{{{standard input|free text|rows=10|preload=Template:Step-by-step_preload}}}


{{{standard input|summary}}}

{{{standard input|minor edit}}} {{{standard input|watch}}}

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

The preloading doesn't work. Period. I've been trying around for ages and I can't seem to get it to work. I apologise if this is a trivial problem, but I'm quite new to Semantic Forms (and Mediawiki for that matter).

You're quite new to SF, but you've been trying to get this working for ages? :) Anyway - it looks like you've found a bug, that seems to have been in place since SF 2.5. Sorry about that - hopefully it can get fixed soon. Yaron Koren (talk) 19:30, 4 April 2013 (UTC)
I believe this has now been fixed in the version of the code on Git, and of course the fix will go into the next release of SF. Yaron Koren (talk) 13:41, 8 April 2013 (UTC)

Thanks a lot Yaron, I'm glad that (what felt like) ages of searching uncovered a bug.

Custom buttons with WikiEditor in Forms

We use some custom buttons in WikiEditor. When you edit a normal page these buttons are loaded via Mediawiki:Common.js via #wpTextbox1, like this:

/* Adds <data link> button to toolbar */	 
			$('#wpTextbox1').wikiEditor('addToToolbar', {
					'section': 'main',
					'group': 'format',
					'tools': {
							'datalink': {
									label: 'Data Link',
									type: 'button',
									icon: '//Blabla.Blabla.com/wikiname/img_auth.php/9/9f/picture.png',
									action: {
											type: 'encapsulate',
											options: {
													pre: "{{S|<type>|<value>", 
													post: "}}"
											}
									}
							}
					}
			});

WikiEditor works just fine in a form but these buttons are not loaded for a Property or the Free text field in a form like this:

{{{for template|Test}}}
{| class = "formtable"
! String1:
| {{{field|String1|rows=4|editor=wikieditor}}}
|}
{{{end template}}}

{{{standard input|free text|rows=4|editor=wikieditor}}}

{{{standard input|save}}} {{{standard input|cancel}}}

The HTML generated for a normal page, the Property field and the Free text field look like this:

Normal page:

<div class="wikiEditor-ui-text">
<textarea id="wpTextbox1" lang="en" name="wpTextbox1" dir="ltr" style="" rows="30" cols="80" accesskey="," tabindex="1">
</textarea>
</div>

Property:

<div class="wikiEditor-ui-text">
<textarea id="input_2" class="wikieditor createboxInput" style="width: 100%" cols="90" rows="4" name="Test[String1]" tabindex="2">
</textarea>
</div>

Free text:

<div class="wikiEditor-ui-text">
<textarea id="sf_free_text" class="wikieditor createboxInput" style="width: 100%" cols="90" rows="4" name="sf_free_text" tabindex="3">
</textarea>
</div>

For the Property input_2 is used and for the Free text sf_free_text is used. I added these to Mediawiki:Common.js but the buttons do not show up. I am not a programmer and I don't exactly know when Mediawiki:Common.js is "loaded" but does Semantic Forms go trough Mediawiki:Common.js for the Property and Free text fields when the WikiEditor is used as an editor? Is there a way to get this to work? Thanks, --Jongfeli (talk) 07:48, 5 April 2013 (UTC)

Preload of text from Wiki page into free text field fails

Hello Yaron!
I have a form with a free text field that I used to preload with some lines of text located in a separate template wiki page (preload=Vorlage:HVG Ereingnis Footer). It used to work fine until some days ago. Now the free text field stays empty. The preload text consists of a simple Cite reference code and a form definition. I realized this malfunction some days after I updated Semantic Forms from 2.5.1 to 2.5.2.
Do you think that could be the reason?
Many thanks!
--Sochin67 (talk) 07:54, 5 April 2013 (UTC)

Yes - by coincidence, someone else just discovered this bug yesterday; see two sections above this one. It's good to know that it only showed up in 2.5.2. Yaron Koren (talk) 12:23, 5 April 2013 (UTC)

Forms and {{subset: }}

Maybe this is all related to the above topics around preload, but my approach was a bit different. Maybe I'm doing this the wrong way.

What I want is that a semantic form will produce a page that looks like this:

field1 = something they filled out
field2 = something they filled out

The following is text that the user can edit and is preloaded from template 2:
Users can edit this text

The following text continues from template 2:
field 3= something they filled out

The contents of template 1 are something like this:

field 1 = [[field1 ::{{{field1|}}}]]
field 2 = [[field1 ::{{{field2|}}}]]

The following is text that the user can edit and is preloaded from template 2:
{{subst:template 2}}

The following text continues from template 2:
field 3 = [[field1 ::{{{field3|}}}]]

template 2 has:

Users can edit this text

And it displays fine. But when you go to edit the page, one sees only:

field1 = something they filled out
field2 = something they filled out

The following is text that the user can edit and is preloaded from template 2:
Users can edit this text

And that's it. The rest (field 3 = ...) just gets cut off. Maybe the code generating the page has a bug and ends early after including template 2?

I have a complex example; the view of the generated page is here:

The edit form is here:

(I include the above public wikis mostly because it appears to increase my popularity on this forum)

I tried the same with {{safesubst:..}.

I'm using 2.5.2. Any ideas? Alexthepuffin (talk) 14:28, 5 April 2013 (UTC)

Yes, linking to public wikis is always encouraged. :) Did you mean to have this for your 2nd URL, though? And if so, I only see one template there - am I missing something? Yaron Koren (talk) 15:51, 5 April 2013 (UTC)
Maybe I need to be clearer about this: the page uses template 1 which includes template 2. But here's the missing info...
Template 1 is here: http://developingottawa.ca/index.php?title=Template:Wards
Template 2 is here: http://developingottawa.ca/index.php?title=Template:Location-bottom
I can whip up a simpler example if this is not clear.
But no, the edit URL I posted is in fact correct, it shows that the generated page's wikitext is chopped compared to its preview.
Alexthepuffin (talk) 17:54, 5 April 2013 (UTC)
Okay - I'm still not sure I fully understand, but anyway forms can't handle "subst". So yes, I would recommend using "preload" in the free text field instead - once that works again, that is. :) Yaron Koren (talk) 19:19, 5 April 2013 (UTC)

increment variable from one instance to next of a multiple optional template

SMW & Semantic forms are fantastic. Many thanks for this contribution to the internet.

In http://www.coetus.eu/wiki/Formulaire:SERIE-test I would like to allow users to specify the year of publication of each volume of a work published in several volumes (eg Diderot & d'Alembert Encyclopedia in-4 in 30 volumes). To help non-computer-scientist users to input these, I'd like to allow them to use a block of 10 volumes, and be able to call it multiple times. I use a prefix to thus be able to call numbers: t01 t02 t03 t04... t09 when prefix is 0 t1 t2 t3 ... t9 when prefix is empty (case of book in 9 or fewer volumes) t10 t11 ... t19 when prefix is 1, etc.

I hoped I could use a variable, and increment it at the end of one call to the block of 10 volumes :

{{#vardefineecho:prefixe | {{#expr: {{#var:prefixe}} + 1 }} }}

so it would naturally have the right value when the user would add the next block of 10 volumes. But the next block does not take into account the modification of the "prefixe" variable that happened inside

Any clue what I could do ?


Also, I'm looking for a simple way to let the user input the number of volumes (hence I could create automatically the number of blocks he needs). Will I be able to use the "show on select" and in the div sections, call the model http://www.coetus.eu/wiki/Mod%C3%A8le:10tomes ??

Many thanks in advance for any clue you could give me.

www.coetus.eu administrator, April 6th, 2013.

For the incrementing variable thing, the NumerAlpha extension may help. I can't think of any way to set the number of instances in advance. Yaron Koren (talk) 12:33, 7 April 2013 (UTC)
This extension is very interesting, but does not solve my problem because when you instanciate several time a "multiple" template, the value that NumerAlpha tags had in the first instance are reused in the next one, i.e. it's like the template is built once, copied after all of it's tags where interpreted, and then pasted each time you instantiate it.
I'm now trying to solve my issue using show on select, with optional fields that would be of "holds template" type, so the template. I would find it extremely helpful that the documentation gives a simple example on how this "holds template" gets used, eg like I finally found in http://www.mail-archive.com/semediawiki-devel@lists.sourceforge.net/msg03519.html
Yet I struggle with 2 issues :
[1] I manage to include a template in a field, only if the template is defined as "multiple". Eg it works in http://www.coetus.eu/wiki/Formulaire:SERIE-test-multiple but not in http://www.coetus.eu/wiki/Formulaire:SERIE-test which is the same text but without the "multiple" in the template definition for the embedded templates.
Any clue on how I could use a non multiple template inside a template field ?
Once these work, I should be able to use "show on select" so as to only include the embedding fields that suit my purpose (eg one field for 1 to 9 volumes, one field for 1 to 19 volumes, one field for 1 to 29 volumes etc).
A last word, I bought your "working with mediawiki" book to thank you for your great contribution to the community, and to learn. I find the book very clear and useful at the beginning, but I'm quite disappointed the section on semantic forms is a copy paste of the online documentation, when I was indeed seeking for more pedagogy and examples.
Thousands of thanks for your huge support to SWM & SF, these are fantastic concepts and very good tools, just the documentation is sometimes a bit hard for non specialists.
Coetus (talk) 12:43, 14 April 2013 (UTC) signing now I created my account ;-)
Hi - the template-embedding thing was only really meant to be used with multiple-instance templates. If it's not a multiple-instance template, would it be possible to just move all those fields into the form's main template, without the need for embedding in the first place? As for my book - I'm aware that more could have been written about SF. At the same time, the chapter on SF was already by far the longest in the book, and the book was intended to appeal to an audience of general MediaWiki users, not necessarily people interested in SMW and SF; so there was a balancing act there. If you can detail something you'd like to see added to the online documentation, though, I'd be very willing to look into expanding that. Yaron Koren (talk) 03:18, 15 April 2013 (UTC)

Making a map location mandatory?

I have a form and I have several fields that are mandatory. I have a clickable map, and I'd like one of the map to be required. So the user has to click on the map to drop a marker.

I tried adding the 'mandatory' option to my field, as in:

{{field | Latlng | input type=googlemaps | centre=45.417°N 75.7°W | width=800 | height=500 | zoom=12 | autozoom=off | mandatory |}}}

But it doesn't do anything.

Maybe this is a question about SemanticMaps and not Forms, but i'm not quite sure... Alexthepuffin (talk) 19:24, 7 April 2013 (UTC)

Yes, this is a Semantic Maps issue - specifically, it's about the Semantic Maps form input. Yaron Koren (talk) 22:56, 7 April 2013 (UTC)

Bug with preview

Hi,

When I use a form to create or edit a page, preview works. But if I create a page my_wiki:Namespace or a catégorie with « Has default form::xxx », then I have a tab to edit a form as expected, but no more preview at all. Message in console web (firefox) when I try to preview is : « HTTP/1.1 400 Bad Request ». I have mediawiki 1.20.3, Semantic Forms 2.5.2 and Semantic MediaWiki 1.8.0.4. Thank for help. 109.218.2.133 10:02, 8 April 2013 (UTC)

Are you saying that the preview works when the URL looks like "...Special:FormEdit...", but not when it looks like "...action=formedit"? Yaron Koren (talk) 12:56, 8 April 2013 (UTC)
I tried again, and yes, this is the problem. 109.218.2.133 15:32, 8 April 2013 (UTC)
My guess is that this is due to some problem with your URL rewriting. Can you tell what the URL is that is leading to the "Bad Request" error? You might need to use the Firebug plugin for that - look in the "Net" tab. Yaron Koren (talk) 15:57, 8 April 2013 (UTC)
With "&action=formedit" : http://myurl/wiki/api.php, I have that message :
{"errors":[{"level":3,"message":"No form specified. Will try to find the default form for the target page."},{"level":0,"message":"Pas de formulaire sp\u00e9cifi\u00e9."}],"status":400,"form":{"title":""},"target":"When the Sleeper Wakes"}
No error for same url with Special:FormEdit 109.218.2.133 17:52, 8 April 2013 (UTC)

Autogrow, WikiEditor and Internet Explorer 10 do not work properly

Hiyas,

using Internet Explorer 10, autogrow for the free text does not work properly in combination with the WikiEditor (without, it does). It will not grow enough, so the top of the entered text will disappear. As there is no scrollbar, this turns out to be a problem for most users.

Apart from a fix, would it be possible to reenable scrollbars with autogrow, so I can offer autogrow to the users of working browsers and at least scrollbar for those who want or have to use IE?

Kind regards and many thanks --80.149.87.126 15:01, 8 April 2013 (UTC)

Bug in text with autocomplete?

Dear Yaron,
maybe this is related to my above topic "Preload of text from Wiki page into free text field fails".
I just found out that the autocomplete function in a text field doesn't work anymore. The field definition part looks like this:
input type=text with autocomplete|default=Ereignisse|values from namespace=category|mandatory
I use this in various forms and they all seem to fail now.
Nothing has changed in the wiki system apart from the Semantic Forms update to 2.5.2. as mentioned in my previous topic.
Could this also be related to the Semantic Forms update?
Many thanks! --Sochin67 (talk) 12:09, 8 April 2013 (UTC)

My guess is that it's because you have "category" instead of "Category". If that's the case, then this is most likely a minor bug that was introduced in 2.5.2. Yaron Koren (talk) 13:29, 8 April 2013 (UTC)
I think that was it - seems to work. many thanks!! --Sochin67 (talk) 13:35, 8 April 2013 (UTC)

"Holds Template" description is not clear

It's defined as:

holds template - Specifies that this field is meant to hold a multiple-instance template, and does not have its own form input. It is used in conjunction with the "embed in field" parameter for the 'for template' tag (see above).

But, the "multiple-instance" part is throwing me and I'm wondering if it's a typo. If it's not, maybe an example would help. --Al Johnson (talk) 23:37, 11 April 2013 (UTC)

Do you know about multiple-instance templates? Yaron Koren (talk) 00:40, 12 April 2013 (UTC)
Yes, and I use them. So, does the field hold all of the values of all the instances of the specified "embed in field" template? Does the specified template have to be a multiple instance one? An example would be great. --97.122.210.123 01:16, 12 April 2013 (UTC)

bug

With #forminput and 'popup', 'mandatory' doesn't work. 109.218.158.50 09:02, 12 April 2013 (UTC)

I thought that was fixed... what version of SF are you using? Yaron Koren (talk) 12:28, 12 April 2013 (UTC)

UploadWizard fields in Semantic Forms

I'm trying to use UploadWizard with Semantic Forms. I would like to set a field within UW-uploaded docs that can be searched for using #ask. I don't think UW can do this right now, but I'm not sure.

There's a few ways I see this working:

1. Use one of the existing UW fields

The UW template already has fields like 'description'. Use that to add to contain the page(s) associated with the uploaded document. But can such a property (which wasn't set with semantic) be search with #ask? I don't think that worked for me. If that can work, I'll spend more time sorting out what's wrong.

2. Add a new SF field to UW

Here, I'd modify UW to add a new field that is searchable with semantic. Is there any code I can use as a reference on how to do this?


Hopefully this makes sense. I can't find any prior discussion on this topic.

Thanks. Alexthepuffin (talk) 13:06, 15 April 2013 (UTC)

Hi - I would think the easiest solution is to just modify one or more of the templates that UploadWizard adds calls to on the page, to add property tags to the relevant fields so that they're stored semantically. Yaron Koren (talk) 19:29, 15 April 2013 (UTC)

Autocomplete using Semantic Query?

Going through the docs, I may have just missed it or it may not exist. Is there a way to create a dropdown box entry containing the results of an ask query as it's options?

i.e I would like to be able to enter a 'customer id' property into one input field, then be faced with a list of 'customer contacts' related to that customer in the next input field on my form? Ashimema (talk) 17:24, 16 April 2013 (UTC)

That's something that's actually hopefully coming in the next version of SF. You may already be accomplish this, though, depending on your exact data structure setup, using the "values dependent on" parameter. Yaron Koren (talk) 19:11, 16 April 2013 (UTC)

Hi Yaron, as usual it sounds like you've preempted my requirements, it's great news that this will be appearing in a future release :). I'm investigating your suggested 'values dependant on' parameter now, I don't think i've used that one before, all I can find in the docs at the moment is a basic mention of it, is there an example of it's use easily available anywhere? As always, thanks for doing such a great job on this extension! Ashimema (talk) 08:02, 17 April 2013 (UTC)

You can see an example in the "Item" form on Discourse DB. Yaron Koren (talk) 13:11, 17 April 2013 (UTC)

Insert text between fields in generated page

Hello. Is is possible to insert hardcoded text between the field values in a generated page? Using the discoursedb as an example what I would like to do is add a header between the opinions and the referenced items (having the header show up only if there are referenced items would be ideal, but is not required) I assume this would be possible using a suitable template and hidden field with default value but is there any easier way?

MathiasLidal (talk) 08:51, 17 April 2013 (UTC)

Nevermind. Just found out about holds_template/embed_in_field and that solves my problem :)

Is there a bug when assigning properties within a template?

I'm seeing some inconsistent behaviour. My normal view is that I'm not doing it right, but now the behaviour seems somewhat random.

I have three pages ( 1, 2 3) which each reference a template (called information) setting a parameter (called 'description'). The template assigns a semantic property (called 'Community description') from the description parameter. Another page does a semantic #ask to print a table. The table always contains all the rows, but frequently the 'Community description' column is empty for some or all the entries.

Changing the content of some of the pages seems to make the problem come and go, but I haven't been able to correlate any change to the differing behaviour.

I know it's really hard to track down bugs when it can't be reproduced. Is this a known bug, am I doing something wrong or is this not believable without a test case?


There's a lot more text on each of the pages, so here's the relevant parts of each of the files iinline:

For page 1:

...
{{Information
|description=This won't show up in a semantic query.
...
}}
...
[[Category:Test category]]

For page 2:

...
{{Information
...
|description=A test description.
...
}}
...
[[Category:Test category]]

For page 3:

{{Information
...
|description=A test description that doesn't show up.
}}
...
[[Category:Test category]]

In the template:

...
[[Community description::{{{description}}}]]
...

And the test page that does a semantic query:

...
{{#ask: [[Category:test category]]
|?Community description
}}
...

which shows a table of all items in test category, displaying the Community description property.

I'm so confused... Alexthepuffin (talk) 16:28, 17 April 2013 (UTC)

I don't know whether there's a bug there or not, but in any case, this doesn't look related to Semantic Forms. Yaron Koren (talk) 19:58, 17 April 2013 (UTC)
Hello Alex, I saved:
{{#ask:[[Category:test category]]|?Community description}}
on your test page [2] and it works just fine. --Jongfeli (talk) 13:24, 18 April 2013 (UTC)

Saving tab separated information

Hi, I have a SF which has 2 main sections, separated in tabs using the header_tabs extension.

I want that If I save the page from one tab, then save only the fields included in that tab, so I could fill properties like "savedFromTab1" or "savedFromTab2", regarding the tab that triggered the saving.

Otherwise is there some way to know which tab triggered the saving?

Regards, Marcelo.

No, there's no way to do either of those things. Yaron Koren (talk) 13:51, 19 April 2013 (UTC)

Querying on a field doesn't work?

On Test page4, I pass 'foo' as the only parameter to Template 1. This assigns {{{1}}} to semantic property test field 1. The page is also assigned to category Test category 2. That part displays fine.

Next on Test page4, I do a semantic query on everything in the category. This table shows one entry, including the test field. That's good.

After, I do a semantic query for everything with property 'test field 1 of 'foo'. It should show an identical table, but it is empty. I don't think it should be.

What am I doing wrong?

(I don't think it is the confusing problem I had above. And this is simpler to explain)

Alexthepuffin (talk) 16:38, 19 April 2013 (UTC)

Hello Alex. When asking properties of a certain value you should use the ":" twice, [[test field 1::foo]]. This is all very well documented on http://semantic-mediawiki.org/wiki/Help:User_manual and are semantic basics. I made the same mistakes when I started with sematics but reading the documetation did the trick for me :-). Btw this question is not really a Semantic forms question. Regards --Jongfeli (talk) 02:58, 20 April 2013 (UTC)
Ah, I see my mistake. Thank you, Jangfeli. Alexthepuffin (talk) 19:38, 21 April 2013 (UTC)

Edit a Class

I'm not sure if this is the right place to ask this question.

I have created classes and want to change a single property. Is there a "class editor" ?

thank you.

No, but if you use the Page Schemas extension, it lets you edit and re-edit the schema, and then generate everything from that. Yaron Koren (talk) 16:23, 21 April 2013 (UTC)

Troubles with default values

Hi Yaron, I've been trying the default value feature, but I think Im doing something wrong, or maybe the feature is broken.

I have a semantic form with a field which has a default value. Something like:

FieldName

I have a template for this. The thing is, when I edit a page through the form, the input field "FieldName" is empty. Shouldn't appear there the "current user" name? and when the page is save, my template field is not filled.

I also try setting as default value an inline query, but I got the same results. Something like:

FieldName

Am I missing something? It is ok that the input remains empty?

Thanks

EDIT: I've been playing with this feature, and I found out it works only when creating a new page from the form. When doing it through the "Edit with form" tab, it doesn't work. I need that every time a page is edited through its form, a particular field has to be fill with value {{#ask:....|format=list|headers=plain|sep=,|link=none}}. I thought that was the default parameter for. Some way to do it?
No, there's no way to preload a field when editing an existing page with a form. If you just want to store the last person who edited the page, I think SMW lets you do that directly with the "Last editor is" property. Yaron Koren (talk) 16:30, 21 April 2013 (UTC)

Avoid overwritting fields

Hello, is there some way or workaround to avoid overwritting template fields whenever a page is edited? Thanks in advance.

What do you mean by overwriting template fields? Isn't that what editing is for? Yaron Koren (talk) 16:31, 21 April 2013 (UTC)

Remove items from combobox

Hi everyone, I have a lot of items entered into combo-boxes by users of our wiki that aren't really conforming to our required structure. this is no fault of the user, we just aren't defining our requirements well enough. either way right now there are a lot of things in our combo-boxes that really shouldn't be there and to encourage our formatting we'd like to remove the items we dont like. we cant seem to just delete these, so where are they saved / cached? there doesn't seem to be any reference to them on the property page?

I can think of two options: fix those bad values in the pages in which they're stored, or manually set the correct set of values in the field tag, using "|values=...". Or both. Yaron Koren (talk) 16:32, 21 April 2013 (UTC)
Where are the bad values stored, the only place i would suspect is the proporties page defined for the combobox field in the form, but that page does no show the stored values
They're stored in the individual pages that use that property (and were probably created with that form). Yaron Koren (talk) 12:55, 24 April 2013 (UTC)
So, I need to find a page using the incorrect value and update it to a correct value?
Yes. Yaron Koren (talk) 13:06, 24 April 2013 (UTC)
Great that worked, this is going to take ages......
You might be able to speed up the process with the Replace Text extension. Yaron Koren (talk) 19:42, 24 April 2013 (UTC)

Am I using free text properly?

If I have a form that looks like this:

{{{for template|foo}}}
{{{end template}}}
{{{for template|bar}}}
{{{end template}}}

It will generate a page that looks like this:

{{foo}}
{{bar}}

Instead, I'd like the generated page to look like this:

{{foo}}
Some static text that is part of the page and not transcluded from a template.
{{bar}}

I tried to use the free text input, so something like:

{{{for template|foo}}}
{{{end template}}}
{{{standard input|free text|rows=10|hidden|default=Some static text that is part of the page and not transcluded from a template.}}}
{{{for template|bar}}}
{{{end template}}}

But that just generated, again:

{{foo}}
{{bar}}

Am I doing that right? And thanks for your patience with me.

Alexthepuffin (talk) 12:52, 24 April 2013 (UTC)

That seems like it should work... if you want that text to always be there, though, why not just make it part of one of the two templates? Yaron Koren (talk) 12:57, 24 April 2013 (UTC)
Maybe there's a bug, it works as expected without the 'hidden' field. So having the field hidden in the form seems to also hide it in the generated page. That's not expected behaviour (to me, anyway). Is it worth me putting together an easy mockup of it?
The reason to not include the text in one of the transcluded templates is that I want my users to be able to easily edit the wikitext on the page itself. Alexthepuffin (talk) 14:55, 24 April 2013 (UTC)
Well, I don't understand the logic of having the text be editable only within "edit" but not "edit with form", but it's your wiki. Anyway, this does seem like a bug, but you could probably work around it by putting the field within a "<div style="display: none;"> tag. Yaron Koren (talk) 19:46, 24 April 2013 (UTC)

Show all categories with input type "categories"

Hi, first of all - thanks for this great extension. It`s really helpful. :-) I would like to let my users choose the category for an article from a list. I try to accomplish this through the input type "categories". It works fine, but I would like to show all categories in the list and not only one top category (and its subcategories). Is it possible to define the "root category" as top category? Many thanks in advance! Dadai12 (talk) 12:01, 24 April 2013 (UTC)

Unfortunately, no. If you don't care about the hierarchy display, you could also do "values from namespace=Category". Yaron Koren (talk) 19:44, 24 April 2013 (UTC)
Thanks for the suggestion. The list would be OK without the hierarchy display, but I have got a little problem with the display of the result. The output is always the page without the namespace (e.g. [[Administration]] instead of [[Category:Administration]]. Could you give me a hint how to do this. Sorry for the newbie question... Dadai12 (talk) 10:02, 25 April 2013 (UTC)
That's fine - you just need to have the template add the "Category:" part. Yaron Koren (talk) 14:11, 25 April 2013 (UTC)
I put the "Category:" part in my template and it works just fine now. But the page is not put in the displayed categories. Is this the default behaviour or did I get something wrong? This ist my template so far: {{#arraymap:{{{Category|}}}|,|x|[[Has category::Category:x|x]]}} Dadai12 (talk) 13:08, 26 April 2013 (UTC)
Take out the "Has category::". Yaron Koren (talk) 14:24, 26 April 2013 (UTC)

Not ppopulating field with property values (solved)

Hello, I am having some troubles getting the enumeration fields to populate with the allowed values defined in the property. The funny thing is that it used to work and then one stopped, so I manually set the 'values=' parameter to bypass it, but it doesnt work neither. I also try with "values from property". All the other input are working just fine, except one. I checked a lot the names of my property and field cause maybe it was a typo, but not. Perhaps my properties became corrupted somehow. I also try to create a new property for the template field that is failing, and it still doesnt work. Any tips, hints, answers or guidance in this issue would be greatly appreciated.

this is the code of my input in the form:

Purpose

this is the code of my property:

This is a property of type Has type::String.

Allowed values:

  • Allows value::value1
  • Allows value::value2
  • Allows value::value3

Cheers, Chei.

Probably the form is just not correctly associating the field with the property. Instead of "values=" or "values from property=", you should use "property=property name". Yaron Koren (talk) 14:25, 26 April 2013 (UTC)
awesome! that worked. thanks a lot and thanks for this great extension.

Watch page doesn't work!?

Hi Yaron,
I just noticed that checking "Watch this page" doesn't add the page to my watchlist.
I use {{{standard input|watch}}} as suggested and I'm quite sure it used to work some months ago. Right now I'm on SF 2.5.2 - you can see my other version stuff here.
If I create a page without the help of a form "Watch this page" works fine.
Thanks for your advise!

Stefahn (talk) 09:36, 28 April 2013 (UTC)

Hi - oh, you want that checkbox to actually work? :) Yes, it looks like changes in SF 2.5.1 caused it (and the "minor edit" checkbox) to stop working. Thanks for pointing this out - hopefully it can get fixed soon. Yaron Koren (talk) 22:41, 28 April 2013 (UTC)
Thanks for your reply. If you know which change caused this faulty behavior it would be very nice if you could tell me. Maybe I could fix my SF code then. I'm using SF for all of my articles and I'm afraid my users don't get mail notifications about changes others made to the articles. Thank you so much! Stefahn (talk) 08:43, 29 April 2013 (UTC)
It was a pretty big change - if it's important, I would just revert to SF 2.5, if you know how to do that. Yaron Koren (talk) 13:53, 29 April 2013 (UTC)
Hm, I'm afraid reverting will lead to more problems than I have now ;) I hope this bug will get fixed soon. I just added me to the bug so that I will be up to date. Thank you so much for your excellent work! Stefahn (talk) 16:54, 29 April 2013 (UTC)

autoedit issue with SF 2.5.2 / SMW 1.8.0.4 and MW 1.20.4? (solved)

I encounter some difficulties when using #autoedit in the above combination. The git version (Friday, 26th) did not work neither. Already tried to get it working for a whole day. Probably I am just doing something wrong.

What I try to have is to toggle between true and false of a boolean property "test" which is called by a template on a test page.


Form autoedittest

{{{for template|autoedittest}}}
{| class="formtable"
! Test:
| {{{field|test|input type=checkbox}}}
|}
{{{end template}}}

Template autoedittest

{| class="wikitable"
! test
| [[test::{{{test|}}}]]
|}
{{#if:{{{test|}}}|                         # also tried without the #if clause
 {{#autoedit:form=Autoedittest
  | target={{FULLPAGENAME}}
  | link type=button                       # also tried post button or blank
  | link text=wahr                        
  | query string=Autoedittest[test]=Ja     # also tried ja, true, nein, false, falsch
  | reload
 }}
|
 {{#autoedit:form=Autoedittest
 | target={{FULLPAGENAME}}
 | link type=button                        # also tried post button or blank
 | link text=falsch                        
 | query string=Autoedittest[test]=Nein    # also tried ja, true, nein, false, wahr
 | reload
 }}
}}


Page Testpage

 {{autoedittest
|test=Ja       #(also tried true, wahr)
}}


So far, everything works like it should. If I click the button I get a message "Testpage has been updated using autoedit successfully".


But - the property is not updated accordingly.


If I call the form manually, everything works fine. I shut off all other extensions (besides SMW, Vector, Parser functions, MSupload, MSlinks, Validator, Wikieditor) to remove any potential conflict - same result. Tried without the #if clause (having two buttons then) - same result.

My Questions:

  1. Something wrong with my implementation or does #autoedit not work in the combination mentioned above?
  2. Additional question: is there any possibility to trigger the #autoedit by another form or template automatically on "save"? (The idea is to mark a page as "processed" when a certain form/template is applied.)

Thank you so much for your help!

--Frabo (talk) 07:09, 29 April 2013 (UTC)

Hi - changing the link text won't have an impact on what #autoedit does. When you click on the link, does the other page's wikitext get changed? Yaron Koren (talk) 13:55, 29 April 2013 (UTC)
Hi Yaron, thanks for the quick reply. Of course, I didn't change the link text but the answer sorry for the typo, I corrected above.

I changed {{FULLPAGENAME}} to {{PAGENAME}} and it works! There was a second mistake in my #if clause (#ifeq is required here). The working solution for the template is

 {| class="wikitable"
 ! test
 | [[test::{{{test|}}}]]
 |}
 {{#ifeq: {{#show:{{PAGENAME}} |?test}} | falsch |
  {{#autoedit:form=autoedittest
  | target={{PAGENAME}}
  | link type=button
  | link text=wahr
  | query string=autoedittest[test]=Ja
  | reload
  }}
 |
  {{#autoedit:form=autoedittest
  | target={{PAGENAME}}
  | link type=button
  | link text=falsch
  | query string=autoedittest[test]=Nein
  | reload
  }}
 }}

It is somewhat puzzling when to use "Ja/Nein" and when to use "wahr/falsch"...

Any idea for the second question? How to trigger a #autoedit by another template?--Frabo (talk) 10:50, 30 April 2013 (UTC)

Cool. I'm not sure if I understand the second question, but there's no way to have the save of one page lead to a change in another page. Yaron Koren (talk) 13:49, 30 April 2013 (UTC)
Many thanks again. I already had the feeling that there is no easy way to do that... --Frabo (talk) 13:54, 30 April 2013 (UTC)