Extension talk:Semantic Forms

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

Code of "special:CreateCategory[edit | edit source]

Hello there,

at the moment i want something like the "special:createcategory" page, but which creates a category which has to be a subcategory of a category of a certain category tree. Preferably without the option to choose a form for it.

Using a form, it would be something like: {| class="formtable" ! subcategory: |{{{field|subcategory|input type=tree|top category=Knowledge|depth=1 }}} |}

The problem with forms is that it creates pages, and not categories. How could i do to create a "category creator" with my own restrictions?

Thanks.

A "category" is just defined by a page in the "Category:" namespace. Couldn't you just create a regular form like the one you describe, and use it to create "Category:" pages? Yaron Koren (talk) 18:14, 2 June 2015 (UTC)


A form which creates categories? How come? You can create categories with a form, indicating the page created with your form is member of a category, but is there a way to create a form which just creates categories? Maiser(talk)

Modified form and template - duplicated data[edit | edit source]

Hello!

I created a few pages with a form, then I modified the form and the template (I added 5 properties to them in a table). Then on a page when I click on the edit with form button, enter the new inputs and click on save, the data is duplicated on the edited page. The first table doesn't have any values, the second table is filled out with the data I entered, and all other sections are duplicated too. Does anyone know how to solve this problem? 13:53, 5 June 2015 (UTC)

It sounds like you renamed the template at some point? If so, you can use the Replace Text extension to modify all the existing pages to use the new template name - or just edit them manually, if there aren't too many. Yaron Koren (talk) 18:10, 5 June 2015 (UTC)
Thank you for your quick response, but that's not the case, I didn't rename the template, I just added a few new properties to it. What else could be the problem? 13:24, 8 June 2015 (UTC)
It would help to see the form and template. Is this a public wiki? If not, could you pastebin them? Yaron Koren (talk) 14:02, 8 June 2015 (UTC)
Of course, though I've already found out what the problem was. This was the bad one: http://pastebin.com/mNVhqppy and this is the working one: http://pastebin.com/iF1HwA4K 14:19, 9 June 2015 (UTC)
Okay, great! Yaron Koren (talk) 14:50, 9 June 2015 (UTC)

Show on select on Multiple-instance templates[edit | edit source]

Hello!

I would like to ask the experts how can I use "show on select" when using multiple-instance templates.

If I use "show on select" it this way, it does not work

{{{for template|DescripciondelaRuta|multiple}}}
{| 
| {{{field|DuracionSeccionONOFF|input type=radiobutton|mandatory|default=Sí|show on select=Sí=>DuracionSeccionDiv}}}
|-
|<div id="DuracionSeccionDiv">{{{field|DuracionSeccion|input type=textarea}}}</div>
|}
{{{end template}}}

But if I remove the multiple instance, then the "show on select" works.

{{{for template|DescripciondelaRuta}}}
...
{{{end template}}}

Any hints?

Thanks in advance!

That should work... what versions of SF and MW are you using? And do you see any JavaScript errors if you look in the "console"? Yaron Koren (talk) 14:47, 9 June 2015 (UTC)
Thanks for your help Yaron, we really appreciate it .
I am using:
- Semantic Forms (Versión 3.2),
- Semantic MediaWiki (Versión 2.1.1),
- MediaWiki 1.22.15
I do not see any error in the console, though I am a begginer in this fields. Here's the link to our form just in case
You've definitely found some sort of bug in Semantic Forms - I'm looking into it. Yaron Koren (talk) 18:58, 15 June 2015 (UTC)
I believe I've fixed this issue, in Git - if you try out the new code, please let me know if it worked for you. Yaron Koren (talk) 19:05, 16 June 2015 (UTC)
I upgraded to the new SemanticForms (3.3) and it worked!, Yaron Koren you are a genius and super hiper helpful. Thanks! 21:40, 20 June 2015 (UTC)
That's great to hear! Yaron Koren (talk) 12:37, 21 June 2015 (UTC)

missing icons in multiple form[edit | edit source]

hi there, using sf 3.2 and mw 1.23.9: the multiple form doesn't show the icons for new instance and delete instance. Same problem in firefox (v38) and ie (v9). What to do? File:Missing icons.png

Is this a public wiki? If not - I'm guessing that this is a file permissions issue. The "delete instance" icon, for instance, should be viewable from the browser at /extensions/SemanticForms/skins/SF_remove.png in the wiki directory, like here. Can you see it on your wiki? If not, you probably need to make one or more of those directories world-readable. Yaron Koren (talk) 12:57, 15 June 2015 (UTC)
Thanx for your advise; we use a central directory, were we save all extensions to simplify administration, because we have a lot of wikis on our server. I've made a directory extensions/SemanticForms/skins and put the .png into - works. Very fine.
Is it possible, that you use absolute path instead of relative path, to fetch the icons? Maybe you can change it, it might be more comfortable to administrate extensions for lots of wikis. Thank you.
No, the icons are already included with a relative path, from the file /skins/SemanticForms.css. Yaron Koren (talk) 17:20, 15 June 2015 (UTC)

Special Pages: Create Template...[edit | edit source]

Hi Yaron - I'm finding that when I try to create a template, the properties combobox will populate only for the first field, but the succeeding ones do not. Is there a "fix" for this? Thanks again for all your work with Semantic Forms. Dmlddsoms (talk) 15:16, 13 June 2015 (UTC)

What do you see in the additional ones? Yaron Koren (talk) 12:58, 15 June 2015 (UTC)
The combo-box is empty upon drop down, whereas in the first field, it's completely populated. Dmlddsoms (talk) 14:22, 16 June 2015 (UTC)
What versions of SF, MW and SMW are you using? And do you see any error messages in the JavaScript "console"? Yaron Koren (talk) 18:29, 16 June 2015 (UTC)
MW 1.23.9, SB 1.9.2, SMW 1.9.2 SF 2.7. I'm going to claim ignorance on the JavaScript "console"...Dmlddsoms (talk) 01:46, 20 June 2015 (UTC)
Ah, you're using the version of Semantic Forms from Semantic Bundle. I don't know if I can help with that - it's an old version. You could always upgrade SF manually... or just wait for the next SB. Yaron Koren (talk) 12:36, 21 June 2015 (UTC)
Ok, thanks.Dmlddsoms (talk) 13:22, 23 June 2015 (UTC)

Create a form with multiple input fields[edit | edit source]

Hey, like I wrote above, I would like to create a forminput with multiple input fields. I want to do
that because our workers always mess up the form Name and put in to many spaces 
or delete the commas. I hope you understand what I mean, if not I try to explain it better with this:
Currently our Forminput looks like this
{{#forminput:Installation|70|Installation: Ort,Projektname,Rechner1}}
and after that comes the rest of the form.
Now this is only one input row, and I want three input rows where each contains a part of the title.
Ort:
Projektname:
Rechner:
If it stays like this our workers keep messing up the title names and sometimes the names are full of underlines.
Sorry for my bad english, if there is something not clear I try my best to edit it.

So, this is what I already wrote on the Semantic Mediawiki Talk Page but they sent me over here. They also said I should try the info Tag but somehow I cant get it to work.

When I put this in my code: {{{info|page name=Installation: <Installation[Ort]> <Installation[Projektname]> <Installation[Rechner]>|add title=Installation erfassen|edit title=Installation bearbeiten}}}

It only prints out what is in the first bracket: page name=Installation: <Installation[Ort]> <Installation[Projektname]> <Installation[Rechner]>

Hopefully someone can help me out with this problem.

Make sure that you are going to the form with #formlink, not #forminput - that might be the issue. Alternatively, instead of the whole page name formula thing, you could try the AssembleFormLink extension - it's still experimental, but it is what you're asking about. Yaron Koren (talk) 12:53, 18 June 2015 (UTC)

New Features[edit | edit source]

Hi Yaron,

I’m very excited about SF 3.x. In combination with SMW and MediaWiki this is the most powerful knowledge management platform in the world. Thank you very much for your enthusiastic engagement.

I would like to ask you about some ideas:

  • What about free2use parameters in forms? I.e. one could pass them to the form with query string=par1=val1 and so on. This would be very helpful for flexibilization and will reduce the number of forms needed.
  • In SMW there is a significant difference beetween the notation [[device::server,client,notebook]] and [[device::server]], [[device::client]], [[device::notebook]].
For most of the users is it to difficult to discern, that this requires different requests, like {{#ask: [[device::~*client*]]}} using the first notation vs. {{#ask: [[device::client]]}} using the second.
What about a field type, which can take a comma separated list of values and save them in the second notation?
  • #autoedit is a great feature; can you give it a new function like user or usergroup with which one can restrict the access to change values?
Hi - it's great that you like the system! I wish more people shared your opinion. :)
For #1 - I doubt that's doable. Remember that everything in a form has to go into a template - and those are even less flexible.
For #2 - do you know about #arraymap?
For #3 - a nicer solution might be to use the #ifgroup function from the RightFunctions extension, to only display the #autoedit button in the first place if the user belongs to the right group. Yaron Koren (talk) 14:03, 24 June 2015 (UTC)
Thanks for your quick support and hints, i'll try it next days.
For #1 - i only need it calling the form with #formlink or #forminput, maybe this will be doable?
Sorry, I don't understand. Yaron Koren (talk) 00:13, 26 June 2015 (UTC)
Ok, i'll try to explain:
{{#forminput: form=hardware|link text=new hardware item|query string=hardware[type]=printer&department=personal management&typeList=listOfPrinterTypes}}
{{#forminput: form=hardware|link text=new hardware item|query string=hardware[type]=clients&department=north-west-branch&typeList=listOfClientTypes}}
in both cases i use the form named hardware; the (free2use) parameter typeList should be used in values from property={{{typeList}}}
so it is possible to give the form different list types depending from the value of typeList
Second example:
same like above with another free2use parameter called typeDescription. Serves the user an information about correct data capturing for the defined type.
I tried it using the values you can give to the form with query string; in the example above using {{#ifeq: hardware[type] ...}}, but this doesn't work.
Ah, that makes more sense. I'm still not sure I fully understand, but - perhaps either "show on select" or "values dependent on" could help with this? Yaron Koren (talk) 14:08, 26 June 2015 (UTC)
  1. Right, show on select can help, but every used div must be content of the form;
  2. Right, but i tried to use values dependent on several times without success... It tried it with the example on discourseDB, too; even without success... :-(

SF Upgrade Errors..[edit | edit source]

Hi Yaron,

I upgraded SF and am getting errors on Edit with Form of existing pages, not with adding new.

Error is:

           ext.semanticforms.main: Error: Module ext.semanticforms.main has failed dependencies
           Prevent this page from creating additional dialogues

Dmlddsoms (talk) 13:56, 24 June 2015 (UTC)

There's a problem with multiple-instance templates that's happening for some people; I hope to have it fixed soon. Yaron Koren (talk) 14:04, 24 June 2015 (UTC)
Ok, thanks. Dmlddsoms (talk) 14:12, 24 June 2015 (UTC)

Position of Form Fields and Template resp. to free text[edit | edit source]

Hello,

I am trying to setup a form to create new wikipages. Is it possible to have free text and form fields in a different order than wikipage text and template? What I am trying to do is the following:

Form: Free text input field in between other form fields:

{{{for template|Template}}}
{{{field|...}}}
{{{standard input|free text|...}}}
{{{field|...}}}

Wikipage: Template above the text:

{{Template
|...
}}
My text

However, I get the text above the template. Is it possible to change this?

Thank you for your help!

--82.83.211.13 21:48, 24 June 2015 (UTC)

No, I don't think you can have a free text input displayed between two fields of the same template. If you really wanted that kind of display, perhaps you could use CSS or JavaScript in some way to move the free text display up... Yaron Koren (talk) 19:53, 25 June 2015 (UTC)
Okay, thanks all the same! I'll come up with something. --82.83.217.225 21:38, 25 June 2015 (UTC)

Add unique number if user is not logged in[edit | edit source]

Hi everyone!

Is there a way to add a unique number to the page title only when the user is not logged in?

I use a form to let users add a rating for certain items. Currently, I have the following code at the top of the form to create the page name (passing the user (which is either the user name or "anonymus" if not logged in) and the item to be reviewed):

{{{info|page name=<Review[User]>/Review/<Review[Item]> <unique number;start=1>}}}

However, I only want to add the unique number if the user is not logged in.

As the help page stated that parser functions can be used in the "page name", I tried something like this (using the MyVariables extension, where CURRENTLOGGEDUSER returns either the user name or an empty string):

{{{info|page name=<Review[User]>/Review/<Review[Item]> {{#if: {{CURRENTLOGGEDUSER}}||<unique number;start=1>}}}}}

But when trying to save a new review I get an error stating that the page "..._}" cannot be saved. So I guess the if statement does not get resolved correctly...

Is there any other way to achive what I planned to do? Thanks! --145.253.178.241 12:48, 25 June 2015 (UTC)

If you remove "start=1", the unique number will only show up if the title is a duplicate. Maybe that's a good enough solution? Yaron Koren (talk) 19:59, 25 June 2015 (UTC)
Thanks for your suggestion. The aim was to prevent at least logged-in users from giving multiple reviews for the same item. I think that would still not work after removing the "start=1" . --145.253.178.241 06:49, 26 June 2015 (UTC)

Set a field value silently when using form for editing [Solved][edit | edit source]

I'm trying to set a field to a known value when editing. I can do this easily when the form creates a new page with the default= option. However when using a different form to edit the article I can no longer do this (default= for a hidden field only seems to work on page creation). I tried setting the field as mandatory|values=myknownvalue|hidden but this doesn't have an effect either. I ended up making a normal mandatory field declaration with one value for values=. This has the desired effect except that I'd rather it not be displayed in the form! Ideas? - Lbillett (talk) 19:25, 3 July 2015 (UTC)

Ok, by the time I finished articulating my problem, I think I found a workaround. If you wrap the field tag in a <div style="display: none;">{{{field|fieldname|values=knownvalue|mandatory}}}</div> it will hide the whole input field but the form will set the field as specified. move along! - Lbillett (talk) 19:25, 3 July 2015 (UTC)