Extension talk:Page Forms

Create forms automatically
Hello, i've done a form to create a personal page (user caracteritics) and i would create automatically a new form for each new user who create an new account on my wiki then, i would like a user to update only the page that bears his name Is it possible? And how can i do? thanks for your answers


 * You probably mean create a new page, not create a new form. You can do this by making this form the default form for the "User" namespace, in addition to using Extension:KeepYourHandsToYourself. Yaron Koren 01:58, 7 July 2010 (UTC)


 * yes i mean create a new page. But which file do i edit to modify the default form for the "User" namespace?
 * Eva 09:30, 7 July 2010 (UTC)


 * See here. Yaron Koren 12:54, 7 July 2010 (UTC)


 * I've managed to do this but i've some problem with the display. I've one part on the left side and an other part in a sort of box (a box called as User, here it's called Eva) and it create some links to non-existent pages but my fields are not of type page


 * Eva 13:39, 8 July 2010 (UTC)


 * If you don't define a type for a property, by default it will be of type "Page" - I assume that's the issue here. Yaron Koren 14:27, 8 July 2010 (UTC)

Show on select question
Hi,

I have been trying to set up a form using "show on select" in the section. There is an interconnected set of choices i.e. choices for field1 are field2, choices for field2 are field3 and so on till field5. A typical field is set up as follows

I want only field1 to show up in the beginning and depending on what the user chooses, show up appropriate choices in field2 and so on. I think i have set up the fields properly, but evidence - the form not showing up correctly - goes against that. many of the "next" fields -field3,field4,field5 etc. - show up even before field1 is selected. but when i select field1, extra fields - with the correct choices in the dropdown menu based on field1 choice - show up while the previously displayed incorrect fields still are very much there.

i would be really glad if someone could provide me some help on how to get the form set up correctly and avoid showing the "next" fields till the "previous" choices are selected. Pointers to some existing code would also be greatly appreciated.

Thanks a lot! Veryhuman 01:09, 8 July 2010 (UTC)

Preview won't work
I have installed Semantic MediaWiki + Semantic Forms, and everything works fine except one aspect. When I use a form to create or edit a page, if I press the "show preview" (I'm not sure of the English translation) button, it starts loading something but it never ends. The only way to use my forms is to fill in the gaps, and press the "show differences/changes". Then I can press "show preview", but my users don't know this way. I have tried with the same form and the same template in another wiki which has another installation of the Semantic Forms and it works. Thanks for your help. --Wikypedista 00:15, 9 July 2010 (UTC)


 * I've had the same problem, but have assumed that parsing data from forms and displaying it as preview would be kinda difficult. I dont really need the preview function though... Veryhuman 02:14, 9 July 2010 (UTC)


 * Sometimes it does take a long time - you can solve this problem easily, by removing the line in the form that starts with '<div id="wikiPreview"...'. Yaron Koren 14:22, 9 July 2010 (UTC)


 * Wow, thank you so much, Yaron Koren. This problem has taken me crazy for months. I have thanked your help in my wiki. I don't still understand what was wrong with that line and what is it's purpose, but at least it works perfectly! --Wikypedista 11:42, 10 July 2010 (UTC)

blank screen uploadwindow
Sorry, its me again Burgy Zapp with Semantic Forms update to version 1.9.1 problem on MediaWiki 1.12.4 with an error:
 * Call to undefined function wfStripIllegalFilenameChars in /var/www/vhosts/kunstbewegung.info/httpdocs/wikide7/extensions/SemanticForms/specials/SF_UploadWindow.php on line 423

In Order to fix the call to an yet non existing funktion in MW 1.12.4 you need to add this function wfStripIllegalFilenameChars( $name ) { $name = wfBaseName( $name ); $name = preg_replace ( "/[^".Title::legalChars."]|:/", '-', $name ); return $name; } to your GlobalFunction.php but beware, it is actually a hac to add a funktion into original files. Sincerely Yours Burgy

blank form after update
I did update Semantic Forms to version 1.9.1 (MW 1.12.4), since then the actual form (2 step process) is shown as blank page. I hope somebody can hint me to the problem. Sincerely Yours Burgy Zapp


 * Hi - this might help debug the issue. Yaron Koren 23:55, 11 July 2010 (UTC)

 Thank you very much. First of all it might seem that proc open function is necessary, but I can not validate that information. But after activating it, I got a more helpful error message:
 * Fatal error: Call to private method Xml::expandattributes from context 'SFFormUtils' in /var/www/vhosts/kunstbewegung.info/httpdocs/wikide7/extensions/SemanticForms/includes/SF_FormUtils.php on line 457

and was able to fix it with this LINK (Problem with "edit with form"), as information I want to share my php version: 5.1.6 (apache2handler).  By the way ;-) Thank you Yaron for pushing the borders of semantic information infrastructure with your much appreciated work!

Suggestion: Preserve location of template in the markup
I set it up so that pages in the Template namespace use a form. The purpose is to allow standardized documentation of every template, so that it will require an act of will not to provide any. There's just one catch: the SemanticForms extension insists that the template associated with the form appear first. This means that if I put the template inside of a &lt;noinclude&gt; tag, where it belongs, then edit using the form, then when I save it the template is back outside the &lt;noinclude&gt; tag.

Any objection to making it preserve the location of the template in the markup? Is there any particular reason why it doesn't already? Is this going to be a hard thing to do?

Thanks for any feedback you might have.

-- John at Irie dash Inc dot com


 * Hi - it sounds like the issue you're asking about is preserving the order of free text, template call, free text, etc. Partial forms might work better for that case, although only for editing existing template pages. I'd say a cleaner solution, though, would be to have a separate page for the full documentation - maybe at Template:Template-name/doc. Yaron Koren 00:13, 12 July 2010 (UTC)

Where can I view/change property details?
I defined a Property, ProgramTitleEN, which is defined as follows: This is a property of type Has type::String.

It is used in the form as follows: ! Program Title (English):

It is used in the template as follows: ! Program Title (English):
 * Program Title (English)::

On a page that uses the form, in Firebug it shows up like this: 

Where is "cols=80" coming from, and how can I change it? Stlauc 18:55, 12 July 2010 (UTC)


 * That's strange - it looks like a bug in SF; it could be that your (unnecessary) setting of "rows" is confusing it. Yaron Koren 20:22, 12 July 2010 (UTC)

Displaying bullets in forms
1. I want to display a list of categories as a bullet list. The first bullet appears correctly, but subsequent bullets are appended to the first one as follows: OBPG Advice&amp;Consultation *OBPG Entrepreneurship 

This is the template code to insert the wikitext: 2. Also, in a text area I want to use wikitext for a bullet list, so I entered this wikitext: *Updated keywords *Changed URL

It displayed as an asterisk on line 1 and a bullet on line 2.

Can anyone see the errors? Stlauc 19:27, 12 July 2010 (UTC)


 * For the first issue - use "\n" instead of "&lt;br&gt;"; for the second, this is probably the answer. Yaron Koren 20:20, 12 July 2010 (UTC)

1. This works great - thanks Yaron: 2. Got it - In the template, you need to place the field in column one of a new line, E.g., ! My label: '''3. I found a new, deal-breaker issue with "&" characters in category names. They cause me to lose data.''' For example, my initial data when I click "Edit" is this: Any help on this critical issue would be much appreciated. Stlauc 15:21, 13 July 2010 (UTC). Logged as a bug, Stlauc 18:53, 15 July 2010 (UTC)
 * OBPGCategories=OBPG Advice&Consultation, OBPG Entrepreneurship
 * However, when I click "Edit with form", only "OBPG Entrepreneurship" is selected. Therefore I drop "Advice & Consultation" whenever I save the form. This is a serious issue and I've isolated it to the "&" in the category name, e.g., Category:OBPG_Advice&Consultation.
 * My form code is this:
 * My template code is this:

Show on select seems to be broken
I tried to setup show on select as in: here, but instead of producing a drop down menu as expected, it is instead creating a standard text entry field. I was able to replicate this problem: here in addition to my private wiki. I do not know what about the DiscourseDB site is set differently which is allowing it to instead be a drop down selection. I even tried explicitly setting input type to drop down, but it still remains a text entry. Not sure what's wrong here. Thorncrag 00:09, 13 July 2010 (UTC)


 * I am having the same problem. I followed exactly the code on DiscourseDB, but doesnt work. Have been fiddling with different options for 3 days now. Veryhuman 05:24, 18 July 2010 (UTC)


 * That seems unrelated to "show on select" - the issue there is just that the input needs to have a pre-defined set of allowed values for it to be a dropdown. In the case of the Discourse DB form, those allowed values are defined on the corresponding property page. Yaron Koren 16:06, 18 July 2010 (UTC)
 * That the values are defined by a property makes sense, except that how exactly is the Property:Publication type associated to the field "type"? I think this is the bit that is less than straightforward.  Thorncrag 19:07, 18 July 2010 (UTC)


 * Ah - the two are associated in the template, which SF parses when it creates the form. Yaron Koren 00:10, 19 July 2010 (UTC)


 * Hi Yaron, Thanks again for your reply, but I'm not sure if I understand correctly. I have a property (Medicinal significance) of type Boolean with allowed values Yes and No. I have even tried changing property type to String. The field is structured like this   with   and   following. The values show as dropdown alright. But still the fields which are supposed to show up after selecting Yes (medicinal details) or No (no med details) show up even before that. Am I missing something? I wonder whether Thorncrag got his problem resolved with your reply? Thanks Veryhuman 02:25, 19 July 2010 (UTC)


 * Hi - that doesn't sound like the same problem; it sounds like a totally different problem. I don't know what's causing it, but your property should either be a Boolean with no allowed values, or a String with allowed values. Yaron Koren 10:40, 19 July 2010 (UTC)


 * Thanks Yaron. Will post a solution here if I find one. Veryhuman 14:53, 19 July 2010 (UTC)

I haven't had time to revisit this just yet, but I will share what I learn when I do. Thorncrag 18:37, 21 July 2010 (UTC)

Hi, i have a similar Problem with this Tag. I see the div all the time and it should only be visible if "unterbrochen" is selected. I user SMF 1.91 with MW 1.16

SBachenberg 07:01, 4 August 2010 (UTC)

I found a Bug! The Form Fields of the Type Radiobutton doesn't have hmtl id tags, so i get the JS error the_input is null if (the_input.value == options_array[i]) {

SF_yui...tion.js (Line 156)

But I dont know if this is a failure in your extension or my wiki SBachenberg 09:10, 5 August 2010 (UTC)

Add a template for each edit?
Is it possible to add a template for each form edit, rather than for the form edit to make a new templatre? IE If I edit Forum with form edit, could I make it so this template appears every time I edit with form? Thanks in advance--Technobliterator 08:33, 21 July 2010 (UTC)


 * No, that's not possible. If your goal is to create a forum, you might be better off using the Liquid Threads extension. Yaron Koren 13:15, 21 July 2010 (UTC)

Learning Process
Hi people!

I'm here learning Semantic Forms to apply on my Wiki. Some questions:

1. I'm making a Wiki about a city in Brazil. I'd like to have stantard information form Hotels, Restaurants, etc. I think Forms would help a lot! But, I don't know if I'm using it properly. I have created properties like:

a. Property:Hotel_Room_TV Property type Has type::String Prossible values:
 * Allows value::No
 * Allows value::Yes

b. Property:Hotel_Pool Property type Has type::String Prossible values:
 * Allows value::No
 * Allows value::Yes

c. Etc

The result is something like this: http://www.wikirio.com.br/Caesar_Park_Hotel

Is it ok? What do you guys think?

2. On the same page http://www.wikirio.com.br/Caesar_Park_Hotel how can I remove the red links on Sim/Não (Yes/No)?

3. How can I insert a file name I updated using Forms "[[Image:[[Picture_1::]]" on a Wiki image: |style=" vertical-align: top;"|[[Image:[[Picture_1::]]|none|thumb|Pictures]]. Is there something like concatenate? (The problem is on the same page http://www.wikirio.com.br/Caesar_Park_Hotel)

Regards, Edgard.


 * Hi - for the properties, they should be of type "Boolean" instead. For the image, you should separate out the display from the property setting - have something like " [[Image:|none|thumb|Pictures]] Picture_1::Image: ". Yaron Koren 14:42, 21 July 2010 (UTC)


 * Yo! Thanks for the reply. I did not use bloolean beacause some answers, like ROOM INTERNET, could be "No", "Yes, free" and "Yes, paid". Edgard...

Is there any way to put a default form edit in a template? Like, does page has default form::foo work? Oh and thanks for your other answers.--Technobliterator 18:51, 28 July 2010 (UTC)


 * You're asking whether a feature listed in the documentation actually works? Er, yes it does... Yaron Koren 21:12, 28 July 2010 (UTC)

User does not fill in all the entries..
Hello. If a user does not fill in all the entries to a form and submits it, how can you make it so the final page does not show the property (ex. ) in the spot where the user did not enter data for.

Instead I would like it to show a blank or even a link saying "ADD" that will link to the form edit page where those values are blank.

Thanks. Anyone know?


 * use parser function in the templateMsevero 02:15, 1 August 2010 (UTC)


 * You should change to  - there's a way to do the "add" link thing too, but I wouldn't recommend it. Yaron Koren 15:50, 1 August 2010 (UTC)


 * Awesome, thanks a lot both of you. And Yaron, why do you recommend not doing that? Just curious.--65.87.227.156 17:55, 1 August 2010 (UTC)


 * I just think it looks awkward to have "add data" links all over the place. I mean, I'd think most people could figure that they can use the "edit with form" tab to add missing information. Yaron Koren 23:31, 1 August 2010 (UTC)

Unsupported type "_geo" defined for property.
I get this. Noted it is even on http://halo-smw.ontoprise.com/lod/index.php?title=Wikitext_programming_workshop_1&action=annotate So, my system is MediaWiki 1.15.1, PHP 5.3.2-1ubuntu4.2 (apache2handler), MySQL 5.1.41-3ubuntu12.3, Forms 1.9.1 built from Semantic Bundle (Version 0.4.2.20100719). I even typed a real simple deal to input and display a simple address and still get the error. Is this a bug or am I doing something wrong? Below is my simple form:

The template:

How it looks in Edit:

This is the "testaddress" template. It should be called in the following format:

Edit the page to see the template text.

Didn't know how to pull the property for Freight Yard Coordinates, but it was defined in properties using the geocode dropdown.

This might be all user error; I don't know, but I found it odd that the ontoprise site has the same issue. Thanx.


 * This isn't a Semantic Forms issue - it's because the handling for the "geographical coordinate" type moved from Semantic MediaWiki to Semantic Maps. Yaron Koren 15:16, 2 August 2010 (UTC)

So, I guess the next question becomes how to solve it? I mean do I need to learn some new programming; do I sacrifice the ability to add a map in forms, what specifically do I need to do? Thanx --Vincit Omnia Veritas 21:47, 2 August 2010 (UTC)


 * You should install Semantic Maps. Yaron Koren 14:49, 3 August 2010 (UTC)

Ah, I see now. OK, all the extensions in the Bundle come commented out. So, I set them up. Kicked an error for Revs (1146), but I'll deal w/that on its appropriate area. New question (the ! icon went away so I am REALLY happy), but I believe it is best addressed on the Maps Talk area. So, thanx for getting me in the right direction! --Vincit Omnia Veritas 10:46, 4 August 2010 (UTC)

How to add javascript to new input type
Hi, I'm still learning about mediawiki extensions. I need to make a new input type for semantic forms, and that input type needs to use JavaScript. I have it working as expected on a regular web page, but in a mediawiki form the javascript doesn't seem to have any effect. I have it set up like:

$output = "<input type=" ...etc

$js = "function dosomething(x){" ...etc

return array($output,$js);

The JavaScript function shows up right under the auto-complete functions in the source code, and the autocomplete is working in the forms, but my function isn't. What am I missing? Thanks in advance!


 * Hi - it sounds like you have a bug in your Javascript. I'd recommend looking at the page in Firefox, with the Firebug extension. Yaron Koren 16:45, 3 August 2010 (UTC)


 * Thanks, that is a great tool and it found my error- I was just missing a double quote in my JavaScript function.

Autocomplete on category and its subcategories
Hello. Autocompletion on category show only pages in that category. But what I need to change to show subcategories of that category too? Thanks, Taras, Kyyiv, Ukraine.


 * Do you want both subcategory and page names, or just page names? Yaron Koren 16:46, 3 August 2010 (UTC)

Both subcategory and page names.


 * I doubt SF will ever support such a thing - how could there be a field for which both a page name and a category name would make sense as valid data? Yaron Koren 13:52, 4 August 2010 (UTC)

I have a cookbook site. When creating a receipt, pages with ingredients(categories of the article) are creating automatically when they do not exist. So, the page "Category:Tomato" in the category "Ingredients" is creating. And I want the autocompletion in the form for new receipt ingredients from the subcategories of category "Ingredients". I did that subcategories for the searching by categories.


 * Your data structure is of course up to you, but I would say that you would be better off using semantic properties to define which ingredients are contained in which recipe, rather than categories... Yaron Koren 15:25, 4 August 2010 (UTC)

But how can I make the search by that properties? I need to search recipes that are in a few categories (or properties) in he same time. I used for this extension "Multi Category Search"


 * Semantic Drilldown is one option; so is SMW's Special:Ask page. Yaron Koren 20:15, 4 August 2010 (UTC)

"Add Item" button for multiple Fileds not working with the new MW 1.16 stable release
Hi, I had some multiple Fields with these "Add Item" Buttons. After switching to the new MW 1.16 release the buttons have no effect, there is no item pop off on clicking :-( SBachenberg 07:33, 4 August 2010 (UTC)


 * Hi - by "Add Item" do you mean "Add another"? If so, I can't reproduce the problem - I would recommend looking at the form page in Firefox, with the Firebug extension installed, so you can see the exact Javascript error - my guess/hope is that it's coming from somewhere outside of SF. Yaron Koren 13:56, 4 August 2010 (UTC)


 * Hi, I found the my Error in a Field statement before theses Buttons was a linebreak in the "show on select" statement which killed all the JS for the Page. SBachenberg 08:50, 5 August 2010 (UTC)

Auto-append to page name when adding new through form.
I'm sure there is a way to do this after looking through this extension's page. Only problem is I still have no idea how to actually do it.

What I want: When users create a new page through "Form:Glossary_term", I want the text " (term)" to automatically be appended to the page's name. Right now, there are two ways to get to this form: the sidebar of the wiki and the Category:Glossary page.

I couldn't find any examples (besides the ones buried in the text) that were illustrative enough for me. Sxtynnmach1 14:31, 4 August 2010 (UTC)


 * You'd need to use the one-step process for that. Yaron Koren 14:38, 4 August 2010 (UTC)

Include a link in a text or string property
Hi! I'd like to know if it is possible to add a link to some wiki page inside the value of a string or text property. I don't want just a page property, just need to be able to add links inside text, as the following example:

This is a value of a text property called PropertyName, and Main Page

I'm checking here, but it looks like the and  characters are been misunderstood, making the following appear as the property value when the page is loaded (template created with special:createclass)

PropertyName::This is a value of a text property called PropertyName, and Main Page

instead of

This is a value of a text property called PropertyName, and Main Page

Does anyone know if it's possible to put this links correctly working, and how can I do that?

Matheus Garcia15:29, 4 August 2010 (UTC)~


 * The setting you're looking for might be $smwgLinksInValues. Yaron Koren 20:16, 4 August 2010 (UTC)

arraymap images into a gallery.
I have a form that allows users to upload several images into a field. What I want is all those images mapped into an image gallery.

discourcedb.org maps images like this:. But how would I make it map it into a gallery. Thanks.


 * I'd recommend doing it the way Discourse DB does it, and then using the 'gallery' format in Semantic Result Formats to display the images. Yaron Koren 03:01, 5 August 2010 (UTC)


 * I had a slightly different problem. Maybe this is not the right place to ask this question (sorry!). My images are interwikied through Commons through use of $wgForeignFileRepos. The image names and captions are associated with a semantic property through a template. However, they are not really assigned to a category (I dont know how to assign interwikied images to a category...help here?). If I understand correctly, SRF extension gallery format requires a set of images to work from. I can get the list of all image names like this: '' {{#arraymap: 06:58, 7 August 2010 (UTC)

Multiple-instance template values are being de-duplicated on 'edit with form'
I am new to Semantic MediaWiki & Semantic Forms and am trying to put together a form to track items installed in a computer. The form is working great for the initial creation of an article but when I click 'edit with form' the form removes duplicate instances of the multiple-instance template.

For example, I have a template to enter hard drive size (as a text field) and type (as a dropdown) which is set multiple in my form. When I create the article I add two instances of drive size=500 G and drive type=SATA then save the form. Both items show up in the article. I then click 'edit with form' and the form is populated with only one instance of the values. If I save the form only the one instance is saved in the article.

I can add as many entries to the form in any order such as 500 G;SATA, 80 G;SATA , 500 G;SAS , 80 G;SATA and 500 G;SATA and they will all show in the article on save but only one instance each of 500 G;SATA , 80 G;SATA and 500 G;SAS appears in the form when I edit.

I tried using SIO in the template to wrap the values but the form still de-duplicates the instances on edit. Is this by design or is there an option to have all the saved values displayed on edit?

Thanks, --Roy


 * That sounds like, potentially, a very serious bug. What version of SF are you using? Is this on a public wiki? If not, is there any way you could try to replicate it on a public wiki, like scratchpad.referata.com? Yaron Koren 01:33, 5 August 2010 (UTC)

It is a private wiki so I will put up a sample at scratchpad.referata.com. My version info is as follows: MediaWiki	1.15.4 Semantic Bundle (Version 0.4.2.20100719) which contains - Semantic MediaWiki (Version 1.5.1.1) - Semantic Forms (Version 1.9.1) - Semantic Internal Objects (Version 0.6) Thanks, --Roy


 * Ok, I have the test pages up. It is de-duping the instances here too. http://scratchpad.referata.com/wiki/Hddtest is the page I created with the form. It has 3 instances of the template on it. The form is http://scratchpad.referata.com/wiki/Form:HDD and the template is http://scratchpad.referata.com/wiki/Template:HDD . --Roy


 * That was a very interesting bug - thanks for replicating it so I could see it, and debug it. The problem came about because you had two instances that had the exact same data, which confused SF. I just fixed this problem in SVN; the fix will go into the next version as well. Yaron Koren 05:53, 6 August 2010 (UTC)

After MediaWiki update to 1.16, buttons and titles showing up as  and other tags
Also, the "Edit with form" tabs appear as &lt;formedit&gt;. What's going on and what do I need to change? It looks like if I explicity define things, such as "edit title=blah" in the info field of the form, that text shows up correctly. Did the text defaults get lost somewhere? Sxtynnmach1 19:49, 6 August 2010 (UTC)