Extension talk:Page Forms/Archive December 2010

RunJobs creates an Error

Hi, when i use runJobs to update my wiki i get the Following Error:

.
..
...
2010-12-08 10:24:32 SMWRefreshJob Spezial:SMWAdmin spos=4001 prog=0.149503026679
62 rc=2 run=2 t=43 good

Notice: Undefined offset: 0 in D:\Apache\htdocs\w\extensions\SemanticForms\inclu
des\SF_TemplateField.php on line 64

Fatal error: Call to a member function getWikiValue() on a non-object in D:\Apac
he\htdocs\w\extensions\SemanticForms\includes\SF_TemplateField.php on line 64

SBachenberg 10:31, 8 December 2010 (UTC)Reply

Hi - what versions of MW, SMW and SF are you using? Yaron Koren 23:48, 14 December 2010 (UTC)Reply

Category dropdown

I created a form using SF and added some categories in MediaWiki. I want to allow my users to choose the category in the dropdown fasion in the article, is it possibel to achieve this in SF or I will need to use other extension, if so, what extension? If it is possible to achieve it in SF, please direct me on how to do it.

Hi - no, it's not possible, and there's no extension at the moment that will let you do it. Yaron Koren 17:06, 9 December 2010 (UTC)Reply
Hi there. I recently mailed Yaron about the same topic. I have a working solution for it, but I'm not sure if this is good practice or has flaws. However I got this to work the following way:
  1. In your form add {{{field|Categories|list|size=40|autocomplete on namespace=Category|property=HasCategory}}}. This also works with the parameter "dropdown" altough that won't let you select multiple categories via checkbox. Note: I created a side-question for this below.
  2. In your form's output template you have to add {{#arraymap:{{{Categories|}}}|,|z|[[Category:z]]|}}. This will parse all categories specified in the form in your output. The delimitier "z" will define a "fake" Category Z within your template, so you might want to use some other delimiter. Doesn't really matter as long as you don't fill in the redlink for that category.
  3. For the multi-select checkbox variant from point 1 i created a new property "HasCategory" (of type Page) which helps in limiting down your choice of user-selectable Categories in your form. By editing the property page you can also easily add further categories - even not yet existing ones - just by adding additional [[Allows value::somecategory]] entries. If you don't use a Property in your form, ALL Wiki Categories will be selectable by default.
  4. As a small warning: Don't allow assignment to categories with other forms attached as this may conflict with the form that has been used to create an article.

@Yaron: If this is a good example i might suggest adding this to the Extension-Page since a lot of people might come accross this issue. (Mike)

Oh yeah... that's true. Never mind, then. I don't know if that counts as a good solution, but it certainly works... Yaron Koren 14:32, 10 December 2010 (UTC)Reply

Nice, Thank you Mike for sharing! I have a question about this: This will parse all categories specified in the form in your output. I don't know how to specify categories in the form, how do I do that, what and to where do I add code?
I did all of the steps, and right now I only have working check boxes, The only categories I have with check boxes are the once I added using [[Allows value::somecategory]] but I don't see any categories that I have created before. Where could I have screwed up?

Yes, Category Tree extension is installed and from what I can see I can achieve this http://discoursedb.org/w/index.php?title=Jj&action=formedit but for some reason how much I try I can't get {{{field|Categories|list|size=40|autocomplete on namespace=Category|property=HasCategory}}} to work, I want to get a dropdown with all of my categories listed there. I already tried to replace list with input type=dropdown

Conditional Forms

I think i read something about conditional form options in an earlier discussion but can't remember correctly. Currently i made categories "user-selectable" within my form (see topic above this one), but that could lead to very crowded forms. So the question is: Is there a good way to enable further selection options when activating a form checkbox or bullet point? I guess the proper wording would be "nested forms". I guess I might use the Tabbed sections for this, though a "one extension less" solution is always better. (Mike)

Hi - if I understand what you're asking correctly, see "show on select". Yaron Koren 14:30, 10 December 2010 (UTC)Reply

disabling edit with form?

Is it possible to disbable form edit on a particular page, like how yo can add a default form for a particular page?--Technobliterator 13:20, 11 December 2010 (UTC)Reply

No, unfortunately - you'd have to use "Page has default form" in place of "Has default form" for that kind of fine-grained control. Yaron Koren 03:53, 12 December 2010 (UTC)Reply

Default text problem

When I create a page using a form I have set it to have some default text in the free text box, but if you dont edit the box it will no add the default text to the page?

'''Free text:'''
Make sure to leave the category details at the end of the page.<br>
{{{standard input|free text
|default=Replace this with an intro.
==Location==
add directions,maps etc here
==Site Type==
Add details about what sort of site it is, woodland, urban etc
==Facilities==
Toilets, covered safe zone etc
==Contact Details==
Contact numbers, email, website, forum etc

[[Category:Airsoft Site]]|rows=10}}}

It will add the page to the correct category but thats all it does.

Redeye 02:54, 12 December 2010 (UTC)Reply

For a default of that length, you should put the text into its own wiki page and use "preload=" - I bet that will work better. Yaron Koren 03:54, 12 December 2010 (UTC)Reply

Well that did not work as I had exspected, if i created a page with the preloaded data and did not edit anything on the page it would try and call a template called {{Airsoft Site}}?

I used this code:

{{{standard input|free text|preload=airsoft site example|rows=10}}}

Any idea how I messed it up? lol Redeye 04:45, 12 December 2010 (UTC)Reply

I assume, in that case, that your form refers elsewhere to the template "Airsoft site". If so, that's an unrelated issue. Yaron Koren 16:05, 12 December 2010 (UTC)Reply

Nope, the only ref to that was in the form itself in the category bit. Redeye 06:32, 13 December 2010 (UTC)Reply

I don't know - I would try replicating this on a public wiki, like scratchpad.referata.com; that will make it easier to debug. Yaron Koren 00:40, 14 December 2010 (UTC)Reply

Having problem with jquery

Im having javascript erros. Also, because of that, autocomplete is not working.

http://dev.wikireceitas.com.br/index.php?title=Test

What can that be?

This looks very strange - the HTML source doesn't contain the main jQuery file. Did you modify any of the Semantic Forms code, by any chance? Yaron Koren 05:21, 13 December 2010 (UTC)Reply
No... Looks fine here: http://dev.wikireceitas.com.br/index.php?title=Especial:RunQuery/Pesquisar_Receitas . I´m using Windows hosting with PHP, I´m changing this week, but I dont know if this is it. Edgard
Ah, I didn't realize that page had an embedded 'RunQuery' - of course, yes. That looks like a bug in SF. Yaron Koren 00:35, 14 December 2010 (UTC)Reply
Yeah... Do you plan to fix that? I´m sorry for asking... :)
I'm glad you reminded me, actually - I looked into this some more, and it appears that you uncovered a bug in MediaWiki itself. I created a bug report for it - we'll see what happens now. Yaron Koren 22:50, 27 December 2010 (UTC)Reply
I don't know if it's the same problem, but I'm having some issues with Semantic Maps on RunQuery page too: http://mapping.referata.com/wiki/Talk:Semantic_Maps#Maps_on_Especial_RunQuery__78 Edgard

Template with parserfunctions ?

Hello there, i'm sorry i'm new into this. I've been looking around without results. Here's my request :

I'm using template with things like :

{{#if: {{{keyword}}} | [[property::{{{keyword}}}]] | [[property::No keyword]] }}

It was actually working, if someone do :

|keyword=

This will show No keyword. But with forms it's not working anymore.

Is there a way to show a default value when someone isn't filling a field on form ?

Thanks, sorry for my messy English.
--Nuks 15:12, 13 December 2010 (UTC)Reply

I don't understand - does this question have anything to do with forms? Yaron Koren 00:38, 14 December 2010 (UTC)Reply
It does, yes, it seems like if someone doesn't fill a field on a form, there's not "|keyword=" writed, so my "default" value ("generated" by my #if) isn't working. I hope it's clearer. I mean, what i want to do is : if someone doesn't fill a field, i want some default value to be displayed. I've found how to display a default value IN a field but i want a default value is the field is empty. Is there a way to do that ? Thanks. --Nuks 18:27, 14 December 2010 (UTC)Reply
Ah, I think I get it. It's not related to forms, but if you replace "{{{keyword}}}" with "{{{keyword|}}}" in the #if statement, it should work. Yaron Koren 23:47, 14 December 2010 (UTC)Reply

SF using FCKEditor (issue ongoing)

I'm experiencing a weird behaviour when using SF 2.0.4 (not 2.0.6 due to the still-existing {{#info: display... bug )and SMW 1.5.4 in combination with the FCKeditor 2.6.6. My Wiki is set up as follows:

  • Category "Content" uses Form: Article -> Template Article --> Puts all items in Category Content
  • Category "Tools" using Form: Tools -> Template Tools --> Puts everything in Category Tools

Both Tools and Article forms each are nearly identical regarding their contents, but call different output templates and preload different wiki content. They read as follows:


"Header stuff here..."

  • {{{standard input|free text|preload=Template:WikiPage|class=formtextarea|textarea|rows=30|size=250}}}
  • {{{info|WYSIWYG}}}
  • {{{for template|SubPageDisplay}}}{{{end template}}}

"additional footer stuff here"...


The problem is the preloading of content into the forms, with 2 different cases observed:

  1. When i create a new page everything is fine, content gets preloaded from the template:Wikipage / template:Toolpage and saved as intended. But when i edit with form and start using FCK, the freetext-content gets reloaded from the template again upon saving, which completely negates any form of editing. In short: The article gets reset to default values.
  2. When i define Category Tools to be a subcategory of Category "Content", FCK will then always use the preload of the form defined within Category "Content" instead. (I know this is due to conflicting forms defined, just for testing).

Is there any way to prevent FCK from doing this, maybe by adding some Syntax in my preload-templates or forms? The only solution i see so far is to completely forget about "preload" when i want to make use of FCK or disabling the editor before saving changes. (Mike)

Hi - the {{{info|WYSIWYG}}} tag is not part of Semantic Forms; it's only part of (I think) the SMW+ version of SF - are you using SMW+? If not, is there any way you could replicate this on a public wiki? If you create a new wiki on referata.com, it lets you activate FCKeditor on it - I'd suggest doing that. I also can't replicate the #info problem, but maybe those two are related - some JS error is causing both to break. Yaron Koren 02:08, 16 December 2010 (UTC)Reply
I realized yesterday that there was something fishy about this {{{info|WYSIWYG}}} Tag. I guess it was a leftover from "extensions/UsabilityInitiative" which i tried out. However, removing this had no effect on the FCK-related Problem. Unfortunately, removing the "preload" from my "standard input" field didn't help either. Only deactivation of FCK before saving helps with the problem. The Editor then will just save an empty page and ignores my entry completely. I guess it relates to my forms being more complex with multiple x xxx {{{end template}}} calls. I'll try to simplyfy things slowly to narrow down on the problem.
Regarding the {{#info - bug: It was working fine with SF 2.0.4, maybe i need to try "Data Repair and Upgrade" within the Admin Functions of SMW.
I'll do some more testing (also in referata) and report any findings here. Thanks. (Mike)
Update: See issue below. You were right, this info-thing WAS related to the problem. Updating to SF 2.0.6 destroyed the functionality of my #info tags, but the editor is working again. It's my wild guess, but maybe there were some issues related to FCK, info tags and SF and therefore the #info-parsing got deactivated?

The "preload-issue" however seems to exist "sometimes". I'll test it further.

{{#Info tags within forms issue (Resolved)

As a update to the issue mentioned above, using SF 2.0.6:

  • {{#info tags do work in the wiki layout (i.e. within tables, templates or divs)
  • However they do not work within forms anymore. Instead the info tag content gets rendered right into the page output directly, no (?) icon appears. This feature was still working correctly in my Wiki when using SF 2.0.4. (Mike)

Example:

{{{for template|User}}}
{| class="formtable"
! First Name:
| {{#info: This text will destroy your table layout)}} <<<<<<<<<<<<<<<<<<<<<< SEE HERE
| {{{field|First Name|mandatory|size=30}}}
|}
{{{end template}}}
Hi - this works for me. What versions of SMW and MW are you using? Yaron Koren 17:47, 16 December 2010 (UTC)Reply
Sorry, forgot to sign my entry - Mike here. ;-)
It worked with Forms and FCK for a brief period. I don't know what changed but at the moment the form help and FCK did work. I think de- and reactivation of the editor has something to do with it.

Versions are as follows:

MediaWiki  	1.16.0
PHP 	5.3.0 (apache2handler)
MySQL 	5.1.37
Semantic Drilldown (Version 0.8) 	
Semantic Forms (Version 2.0.6) 	- changed back and forth from 2.0.4 and 2.0.6 and now it works all of a sudden. o_O
Semantic Internal Objects (Version 0.6.2) - To assign Projects to User relations
Semantic MediaWiki (Version 1.5.4)
FCKeditor (Version 1.0.1) - i think there was something fishy here as Version wasn't displayed correctly.
I've been experimenting with various versions and snapshots to narrow down the problem. Re-Downloaded all Versions again, then tried the "Initialize and Upgrade Tables" as well as "Data Repair" function of SMW. Seems ok for the moment and i hope it stays that way now.
I think this were two different issues and i don't know what caused the {{#help issue. Regarding FCK Editor: I got the version from the page you linked on your SF-Page [1] but this one was classified as "compatible up to MW 1.15". I'd recommend changing your link / and or instructions to this page instead. The "beta" remark was holding me of at first but this version seems to work good atm.
On a general note: as a newbie to wikis i find it highly confusing that snapshot Versions are sometimes highlighted in bold and also listed above, making them seem to be the preferrable choice for visitors. Then there are versions of sourceforge and sometimes additional tarballs. Those are often displayed with identical Version numbers in the Wiki (with no visible Release state) but obviously on a highly different functionality level. Is there a general recommendation on which versions to go for when working with SMW? My guess would be SourceForge (if available) as those seem to work best for me most of the time.
Oh and once again thanks for your ongoing support and - Merry Christmas. ;-) (Mike)
Thanks, happy holidays to you too! I wish the MediaWiki snapshot versions didn't exist at all for the SMW-related extensions - they're just random snapshots, and they cause a lot of confusion. Generally, if you follow the download instructions on each extension's page, that's the best way to go. There's also the Semantic Bundle, which is meant to hold the best-working version of each relevant extension. Yaron Koren 15:10, 17 December 2010 (UTC)Reply

Silent definition error?

When defining a property using the silent definition in a template, the form that accompanies it does not include the properties of that property. Such as it does not recognize that a URL property should be a property. Am I doing something wrong?

No, that's a known bug; see the first item here. Yaron Koren 23:56, 15 December 2010 (UTC)Reply

Wiki text editor

I noticed that there weren't any basic text editor for the text boxes. How can I add the basic text editor to the text fields and no, WYSIWYG won't work for me, I just need basic text editor?

There's no way to do that, unfortunately. Yaron Koren 16:07, 21 December 2010 (UTC)Reply
I see! For further testing I went with FCK Editor, I see that it works for {{{standard input|free text|rows=10}}} but not for other fields, ex. {{{field|Definition|rows=10}}. Is there a way so that FCK Editor works for those fields too?
No. Yaron Koren 13:22, 23 December 2010 (UTC)Reply

strange problem

When I try and add a template to my wiki page using a form it replaces it with the category. So if I enter

{{updateinfo}}

I get

[[Category:Airsoft Site]]

It has been working fine but now its all gone wrong!

Also it seems to add it to the page with the already placed category link, my other worry is that at this rate if 100 people edit using the form it will add 100 category calls lol

As with your previous question, I don't understand this one; and once again I'd recommend to replicate it on scratchpad.referata.com. Yaron Koren 13:23, 23 December 2010 (UTC)Reply

How did you know it was me? lol. The problem was that I had 2 free text boxs, one was for people to put the page content and the other was restricted(but not even sysop's could edit it) with a default value of [[Category:Airsoft Site]] No idea why it messed it up when it had been working fine but I just removed the extra box so its now working fine.I will have to get round to doing the scratchpad thing when i get a chance. Just super busy now my wiki has gone out to testers (so many school boy errors lol) --Redeye 04:38, 24 December 2010 (UTC)Reply

Does SF support autocompletion for templates that use the 'multiple' parameter?

I'm having some trouble getting autocompletion to work when I add the 'multiple' tag to the template field. I'm curious if it's just my install that has gotten messed up, so I'm just going to ask if anyone knows if SF support autocompletion here?
I have FCKeditor 2.6.6 installed as well and I'm using SF 1.9.1 and SMW 1.4.3

Autocomplete works fine here:

{{{for template|info|label=Add message}}}
'''Text'''{{{field|text|autocomplete on namespace=file}}}
{{{end template}}}

But wont work in this situation:

{{{for template|info|label=Add message|multiple}}}
'''Text'''{{{field|text|autocomplete on namespace=file}}}
{{{end template}}}

--Ovoned 20:57, 26 December 2010 (UTC)Reply

Hi - yes, it's supposed to work. You're using an old version of SF, so that might be the issue. You should probably also upgrade SMW while you're at it. Yaron Koren 21:51, 26 December 2010 (UTC)Reply
Good to hear! I'll keep at it then. Maybe I'll try an upgrade. --Ovoned 07:58, 27 December 2010 (UTC)Reply

boolean error?

I have a field on my form that uses a boolean to pick 3 values, but in the front end I have my 3 values plus "none" and when I pick one of my valuse I get a warining triangle next to it that says "Full/Semi, is not a reconised boolean (true/false) value" Why is it doing that?

the code im using is this:

|-
! Blow Back:
| {{{field|Blow Back|input type=radiobutton}}}
|-
! Fire Select
| [[Fire Select::{{{Fire Select|}}}]]
This is a property of type [[Has type::Boolean]].

The allowed values for this property are:
* [[Allows value::Full]]
* [[Allows value::Full/Semi]]
* [[Allows value::Semi]]

I picked Boolean because I only want people to be able to pick one answer.

--Redeye 13:58, 27 December 2010 (UTC)Reply

Your property should be of type "String", not "Boolean". Yaron Koren 14:33, 27 December 2010 (UTC)Reply

Upload files using the form!

According to this http://www.mediawiki.org/wiki/Extension:Semantic_Forms#Uploading_files I can achieve this uploading form http://discoursedb.org/wiki/Special:FormEdit/Images_test/How

Is there instructions/steps on how to achieve this? I already enabled upload on wiki and extracted FancyBox Javascript library into extensions folder. I don't know if SF links to FancyBox extension or I need to add the line of code in LocalSettings.php that will point to that extension.
I pasted this code ! Main image: | {{{field|Main image|uploadable|autocomplete on namespace=File}}} into the template, I got this code from this page http://discoursedb.org/w/index.php?title=Form:Images_test&action=edit I see the text area and upload link, when I click it, I get redirected to upload page instead of seeing that upload page in a pop out window.

My guess is that you have a bug in the Javascript, coming either from SF or from some other piece of code. I would recommend looking at the page with the Firefox browser and the Firebug plugin (download it if you don't have it), and seeing if any error messages show up at the bottom. Yaron Koren 20:05, 28 December 2010 (UTC)Reply
I am getting this error

/* MediaWiki:Monobook.js */ /* Any JavaScript here will be loaded for users using the MonoBook skin */; wgServer="http://localhost"; wgScript="/wikifail/index.php" wgAjaxUploadDestCheck = true; wgAjaxLicensePreview = true; wgUploadAutoFill = true; Yes, I am using MonoBook skin! Tried googling, but can't find how to fix this error, help needed!

That doesn't sound like an error message, but in any case, what MW version are you using? Upgrading might help. Yaron Koren 05:02, 29 December 2010 (UTC)Reply
When I click Upload file link it redirects me to the upload page (http://localhost/wikifail/index.php?title=Special:UploadWindow&sfInputID=input_2) with that message on the top of the page. I am using MW (Version 1.15.3), SMW (Version 1.5.2), SF (Version 2.0.7)
Ah. Never mind, then. Did you try using Firebug? Yaron Koren 14:42, 29 December 2010 (UTC)Reply
I get this:
$.support is undefined
(?)($=function())http://localhost/wikifail/extensions/SemanticForms/libs/jquery.fancybox-1.3.1.js?207 (line 29)
$ = function()
jquery.fancybox-1.3.1.js?207()http://localhost/wikifail/extensions/SemanticForms/libs/jquery.fancybox-1.3.1.js?207 (line 1077)
isIE6 = !$.support.opacity && !window.XMLHttpRequest,
http://localhost/wikifail/extensions/SemanticForms/libs/jquery.fancybox-1.3.1.js?207 (line 29)

jQuery("#fancybox_input_2").fancybox is not a function
sf_autocomplete(input_name="input_2", container_name="div_2", values=[""], api_url=null, data_type=null, delimiter=null, data_source="File")http://localhost/wikifail/extensions/SemanticForms/libs/SemanticForms.js?207 (line 23)
input_name = "input_2"
container_name = "div_2"
values = [""]
api_url = null
data_type = null
delimiter = null
data_source = "File"
attachAutocompleteToField(input_id="input_2")12 (line 528)
input_id = "input_2"
attachAutocompleteToAllFields(base=form.createbox)12 (line 496)
base = form.createbox
attachAutocompleteToAllDocumentFields()12 (line 485)
(?)(c=Object { originalTarget=, type="load", more...})http://localhost/wikifail/extensions/SemanticForms/MarkitUpMW/jquery.pack.js?207/eval/seq/1 (line 1)
c = Object { originalTarget=, type="load", more...}
(?)()http://localhost/wikifail/extensions/SemanticForms/MarkitUpMW/jquery.pack.js?207/eval/seq/1 (line 1)
jQuery.ui.autocomplete.prototype._renderItem = function( ul, item) {
http://localhost/wikifail/extensions/SemanticForms/libs/SemanticForms.js?207 (line 23)

jQuery.ui is undefined
[Break On This Error] jQuery.ui.autocomplete.prototype._renderItem = function( ul, item) {
http://localhost/wikifail/extensions/SemanticForms/libs/SemanticForms.js?207 (line 23)
Aha! What are the full file names that showed up with the "..."? Are they coming from an extension, or maybe from some skin customization? Yaron Koren 22:02, 29 December 2010 (UTC)Reply
Errors updated above!
It looks like http://pastebin.com/8f1iZXyx javascript code is messing with jquery.fancybox-1.3.1 .js file in libs folder. Any ideas how i can prevent this from happening?
I don't understand - how did you fix the problem? Yaron Koren 23:20, 29 December 2010 (UTC)Reply
Unfortunately I didn't! I only found what .js file caused the error.
Could you send me (at yaron57@gmail.com) the HTML source for the form that has the non-working "upload" link? Yaron Koren 03:44, 31 December 2010 (UTC)Reply

Commas in defined field values

Is there a way to add commas (,) into defined field values? Currently I have the HTML code for the comma (&#44;) which works initially, but if you go back to edit the page using the form it will not recognize the previous entry because the HTML comma code has been parsed as a comma.

Example: The "Lions&#44; Tigers and Bears" field value becomes "Lions, Tigers and Bears" and these are not the same.

Thanks in advance. --Dgennaro 19:02, 28 December 2010 (UTC)Reply

Ah... that sounds like a bug in SF: it shouldn't be altering any of the text. But if you have commas within values in a multiple-value field (it sounds like that what you're asking about), the best solution might be to switch to another delimiter, like semicolons. Yaron Koren 20:09, 28 December 2010 (UTC)Reply
The values are in the value parameter when you define the field.
Example: {{{field|fieldname|values=Lions&#44; Tigers and Bears,The three little pigs}}}
Thanks again. --Dgennaro 20:57, 28 December 2010 (UTC)Reply
Oh, now I get it. That's a problem, then. Another solution is to associate that field with a property, and attach those values to the property using "Allows value". Yaron Koren 23:20, 28 December 2010 (UTC)Reply
Thank you. This would work great for my situation. But another thing to think about is what if you used a combobox or did a "show on select" for an "Other" selection and had the "Other" field value associated with the same value?
Thanks for the help. --Dgennaro 18:17, 29 December 2010 (UTC)Reply

dropbox help

I'm trying to make a drop down box with a list of iteams people can pick but I want the iteams to link to pages, how do i do that? This is to edit forms ive already made. I tried to make a mock form and copy the code but there seems to be no diffrence in code between the dropdown box and a text box? -- Redeye 04:22, 31 December 2010 (UTC)Reply

Try adding "input type=dropdown" to the relevant "field" tag in the form, plus one of the "values..." parameters. Yaron Koren 19:35, 2 January 2011 (UTC)Reply
Return to "Page Forms/Archive December 2010" page.