Extension talk:Semantic Forms

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

Upload file Window doesn't popup[edit | edit source]

When i click on "Upload File" nothing happens - i have the extention fancybox installed and set $wgBreakFrames= false; When i change this variable to true and then back to false - The upload Window popsup, but only for the next form you are filling out. And then for the second form you want to fill out -> nothing happens, when you click on upload File. This is a cut of my formcode:

Beitragstitel: {{#forminput:form=Problem|autocomplete on category=Übersicht|size=60|limit=50}} fckLR
<div id="wikiPreview" style="display: none;  padding-bottom: 25px;  margin-bottom: 25px;  border-bottom: 1px solid #AAAAAA"></div>
{{{for template|Tabelle}}}
{| class="formtable"
|-! Problemanhang:
| {{{field|Problemanhang|uploadable}}}
|-! Lösung:
| {{{field|Lösung}}}
|-! Lösungsanhang:
| {{{field|Lösungsanhang|uploadable}}}
|}
{{{end template}}}
{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|cancel}}}

This is a cut of my templatecode:

{| class="wikitable"
! Datum
| [[Datum::{{{Datum|}}}]]
|-
{{#if:{{{Problemanhang|}}}|! Problemanhang
{{!}} [[Image:{{{Problemanhang|}}}|200px]] {{#set:Daten=File:{{{Problemanhang|}}}}}}}
|-
{{#if:{{{Lösung|}}}|! Lösung
{{!}} [[Lösung::{{{Lösung|}}}]]}} 
|-
{{#if:{{{Lösungsanhang|}}}|! Lösungsanhang
{{!}} [[Image:{{{Lösungsanhang|}}}|200px]] {{#set:Daten=File:{{{Lösungsanhang|}}}}}}}
|}
[[Category:Übersicht]]
</includeonly>

I would be really greatfull, if you could help me!

See the 5th item here. Yaron Koren (talk) 14:49, 2 July 2014 (UTC)

This is very funny - with &debug=true the upload File window pops up :P And i tested now too with IE and there it works.. I guess there is no possibility to allways set &debug=true at the end of the URL?

Oh, that's too bad - it makes the JS problem (whatever it is) hard to isolate. There's no simple way to do that, but I believe you can accomplish the same thing by adding the following to LocalSettings.php:
$wgResourceLoaderDebug = true;
It's not recommended as a long-term solution, though. Yaron Koren (talk) 15:23, 3 July 2014 (UTC)

Issue with sfautocomplete (values from url)[edit | edit source]

Hello Yaron, I'm having a problem with autocomplete (values from url). When I use values from property or category and start to type in a value on the form, all the values that can be excluded fall off the selection list. However, when I use values from url it only highlights the applicable values instead of eliminating the others. So I am left with a long list of possible values with some highlighted. Is this the way in which the values from url functionality was programmed? Thanks.

Info:
LocalSettings.php = $sfgAutocompletionURLs['Name'] = '<url>.php?search=<substr>';

Form Field = awesometestnames

This is what the php call shows = {"sfautocomplete":[{"title":"Name 1"},{"title":"Name 2"}]}

Clifford.kasper (talk) 21:23, 2 July 2014 (UTC)

That's not good... it sounds like a bug. As it turns out, all of autocompletion, including autocompleting on external values, is getting overhauled as part of this project. If you're willing to wait a month or so, the whole thing will hopefully work a lot better by then. Yaron Koren (talk) 23:31, 2 July 2014 (UTC)


Thanks Yaron Koren. We'll wait until this project gets released before we look any further into it. It looks like a very promising update. Clifford.kasper (talk) 18:12, 11 July 2014 (UTC)

mandatory parameter stopped working for combobox[edit | edit source]

Hello,

As in subject. It was working until today, today suddenly it stopped working. I haven't changed anything in the wiki at all. When you save the form with empty combobox fields, it does not tell you that the field cannot be empty. Mandatory parameter works with other input types!

Any ideas why this is happening?

Have you updated the SF code recently? "combobox" handling changed quite a bit in the last few weeks, in the Git code. Yaron Koren (talk) 18:37, 7 July 2014 (UTC)

Haven't changed anything. It just stopped working. Should I try updating it?

You could update... another option is to look in the JavaScript console, if you know how to do that - my guess is that there's a JS error somewhere, that blocks the combobox checking from taking effect. Yaron Koren (talk) 13:29, 8 July 2014 (UTC)

Form with value mapped to TWO properties[edit | edit source]

What I am trying to do is set the value that the user inputs into the combobox to both the Has Primary Category AND Has Category. Is there a way to do this or am I going to have to find a completely different way to do something like this?

This is what I am trying to use:
! Primary Category:
| {{{field|Primary Category|input type=combobox|values=Has Child|property=Has Primary Category, Has Category|mandatory|existing values only}}}

The form doesn't set the property value; the template does. You would just need to modify the template to set both of those properties to that field/parameter. Yaron Koren (talk) 17:19, 11 July 2014 (UTC)
Thanks Yaron, this just made my job 20x easier.

'View with form' -> can I force a page/category always to open with the form?[edit | edit source]

The 'edit with form' is working very well.

Unfortunately, when the form is saved, the format is not attractive to end-users.

It would be really useful if they could only, or, at least as a default, see the page open in 'Edit with form' - or, even better, an exact alternative 'View with form' that didn't allow changes. The latter would be nice, but isn't crucial.


I see that I can hide the 'edit' tab, but that doesn't really help if it opens in the standard 'read' view, not the form view.

It might work if you could set 'save page' to save the page, but then open it in 'edit with form'.

I"m sure that this can, and is, done, so I know I'm probably missing something obvious!

If you're talking about displaying the form instead of the actual page, I don't believe that can be done. Why not just improve the display of the template(s)? Yaron Koren (talk) 12:29, 15 July 2014 (UTC)

Image uploads on mobile?[edit | edit source]

Has anyone come up with a way to make the image upload work on mobiles? When the pop up launches, it causes a new page on mobile browsers. The new page allows uploading from the mobile browser, but it doesn't insert the image name into the form after the image is uploaded. It just leaves the user at a blank page, causing confusion. I wonder if there's a way to force mobile browsers to allow a pop up?

Notice: Undefined offset: 0[edit | edit source]

Im recieving the following error whenever I try to create a new form

Notice: Undefined offset: 0 in /erp/webcontent/mediawiki/extensions/SemanticForms/includes/SF_FormField.php on line 234 Notice: Undefined offset: 0 in /erp/webcontent/mediawiki/extensions/SemanticForms/includes/SF_FormField.php on line 234

I have been trying to fins the source of this error to no avail. Does it have something to do with having two Hidden fields on my form?

What page are you on when you're creating this form, and does it let you create the form or not? A notice message by itself shouldn't halt the process. Yaron Koren (talk) 19:37, 15 July 2014 (UTC)
I am on Special:CreateForm and it does let me create the form. But I dont understand what the problem is. And for my main form to create new articles it will load the form and allow input, but then freezes mid completion for 5-10 seconds. Once it unfreezes, everything is fine and the article is created like it should be. I do not know if this could be caused by the warning, but it does not throw any errors or warnings when I have the debugger on.
Alright, that's good to know. The second issue seems unrelated - it sounds like normal Javascript loading time. Yaron Koren (talk) 00:59, 16 July 2014 (UTC)

Updating all Pages which use a form[edit | edit source]

So this is probably a very unintelligent question but I have looked all over and I cannot seem to find the right answer. I have a form which I am constantly making updates to based upon new needs from my company. Currently there are over 100 pages which use this form. When I add a new {{{Field}}} tag the only way I know to update each page (template) is to Edit with form and then save the page without making any changes.

For instance, if I added the following to Form:New Task

{{{field|NeedDate|input type=date|default=now|hidden}}}
{{{field|SubmissionComplete|values=true,false|default=false|hidden}}}



Then in Template:Task I added:

{{#vardefine:time|{{#time:F j, Y|now}}


{{#switch: {{{SubmissionComplete|false=
{{#autoedit:form=New Task
| target={{PAGENAME}} 
| link type=button 
| link text=Submission Complete
| query string=New Task[NeedDate]={{#var:time}}
| reload}} | }}


Summary required by: {{#switch: {{{SubmissionComplete
|true=[[Summary Req::{{#time: Y-m-d|{{#expr: {{#time:U|{{{NeedDate|}}} }} + 432000}} }}]]
|false=The submission is not complete.}}

So I have a few things like this on my site. In this the user would click on the button Submission Complete which would set the current date to the Form Field=NeedDate. That field date would feed into the Template, add 5 days and set the due date for the Summary. It is also tied into the Semantic Tasks Extension to send an email update until I can figure out how to work this in with Echo.

The problem is that once I update the Form, it does not populate all the pages which use that form with the new {{{field}}} and there will be multiple errors. If I run SMW_refreshData.php or runJobs.php it will update the Template and property values but it will not add the field to the pages. Is there any script or way to automate this? Thanks!

Clifford.kasper (talk) 15:41, 17 July 2014 (UTC)

Have you tried using the Replace Text extension? There might be a fairly straightforward solution there using regular expressions and wildcards. Yaron Koren (talk) 19:31, 17 July 2014 (UTC)
Yaron Koren, thanks for the quick reply. I'm not wanting to replace something but to add the form Field to the pages. If I used the Replace Text and Identified a line on the form, say a Field tag above where I wanted to add the new one and replaced that Field tag with a new string to include the replacement and the addition, I might overwrite some existing data. Does this make sense? Thanks. Clifford.kasper (talk) 14:00, 18 July 2014 (UTC)
It wouldn't overwrite existing data if you used wildcards. Yaron Koren (talk) 23:20, 18 July 2014 (UTC)

Popup forms[edit | edit source]

I'm either not understanding this, or it isn't working.

I've got a form that works OK. It also works with a file up-load pop-up screen.

I've tried to get the other form to work as a pop-up, but it just goes to that form's page, then, when you fill it in, doesn't return to the original page.

Does the 'popup' have to be in a particular place, or do you have to have some other extension for it to work?

Fustbariclation (talk) 09:59, 22 July 2014 (UTC)

No, and no. Could it be that there's some other Javascript error that's preventing the popup from happening? Yaron Koren (talk) 12:59, 22 July 2014 (UTC)

'add button text=' not working for a file upload[edit | edit source]

The {{{field}} tag seems to be ignoring the 'add button text=' - this is with 'uploadable' set. It sets the 'default value' on the file upload pop-up, but it's not filling in the default value in the form. What is the obvious thing that I'm missing?

Does the order matter? I thought that part of the point in having named parameters was so that it didn't.

....
| Action tracker file:
| {{{field
|Action tracker file
|uploadable
|add button text=Upload action tracker file
|default filename=actions_<page name>.docx
|remote autocompletion
|class=tracker file
|property=tracker file
|default value=actions_<page name>.docx
}}}
...

In the template I've got:

==Action tracker file==
[[Property:Action Tracker File|Action Tracker File]]
[[File::File:{{{Action Tracker File|}}}]]

Fustbariclation (talk) 10:04, 22 July 2014 (UTC)

"add button text" is a parameter for the "for template" tag, not the "field" tag. Yaron Koren (talk) 13:07, 22 July 2014 (UTC)

Trouble with using 'Email' for a default value[edit | edit source]

Most of the default values work perfectly well.

I've been having trouble matching e-mail addresses.

! Logged_Email:
| {{{field|Logged_Email|input type=dropdown|class=Logged_Email|property=Incident Logged Email|default={{#username:}}@kchclinics.com|values from property=Email|rows=1|cols=20|size=20}}}

I know that the usernames are all in the same format as the e-mail addresses - deliberately, so I can do this sort of thing. I've tried various alternatives such as:

default=mailto:{{#username:}}@kchclinics.com
default=Mailto:{{#username:}}@kchclinics.com

It doesn't seem to pick it up though. It says that special properties can be used like other ones, but there's clearly some difference that I'm not understanding.

Fustbariclation (talk) 11:40, 22 July 2014 (UTC)

"#username" is not a special property; it's a parser function. And I'm guessing the issue is that the "default=" value isn't parsed, which means that you can't include parser functions there. If that's the case, that can probably be easily changed/fixed in the SF code. Yaron Koren (talk) 13:09, 22 July 2014 (UTC)

How can i use "values dependent on" parameter?[edit | edit source]

where i can see an example how can i use "values dependent on" parameter?

if not exist an example... my doubt is the next:

i have this:

 {{{field|Country|input type=combobox|values=USA,CANADA,MEXICO}}}

 {{{field|City|input type=combobox|values dependent on=Restaurant[Country]}}}

if i chose USA on the first "field", the second "field" should show values like: NEW YORK, HOUSTON, CHICAGO; LOS ANGELES... my question is: where must be those names of cities?... are properties?, are values of properties?, are pages?, are categories?

i hope can help me... Crystian Marquez

Yes, you have it right. Those city names have to appear in pages in the wiki that use the "Restaurant" template, where "Country" is set to "USA". Yaron Koren (talk) 20:06, 24 July 2014 (UTC)

I cannot make it works...

i have this

Template:Resturant

{|class="wikitable"
!Country:
|{{{Country|}}}
|-
!City:
|{{{City|}}}
|}

Form:Restaurant

{{{for template|Restaurant|label=Restaurant}}}
{| class="formtable"
! Country:
| {{{field|Country|input type=combobox|values=USA,Canada,Mexico}}}
|-
! City:
| {{{field|City|input type=combobox|values dependent on=Restaurant[Country]}}}
|}
{{{end template}}}

and have three diferent pages: Houston, New York, Chicago... whit this code:

{{Restaurant
|Country=USA
|City={{PAGENAME}}
}}

when i want create a new page of an other city for example "Boston" whit the "Restaurant" form, it suppose that the "City" field must show values like Houston, New York, Chicago, at the combobox... but it does not, am i doing something wrong? Crystian Marquez

It's strange that you're using the "Restaurant" template to define cities - Houston is not a restaurant. :) Still, that should work - the only thing that you're missing is that the template needs semantic properties for both "City" and "Country". Yaron Koren (talk) 16:49, 28 July 2014 (UTC)

Thanks!!!...i finally got it work, what i needed was the semantic property...

Autoedit and multi-instance templates[edit | edit source]

Hello! The autoedit function is a real hit with my users. I'm trying to apply it to an embedded multi-instance template that sets some subobjects, but having some trouble. When the button is clicked the page gets modified, but the template values are blank (and it leaves 2 of these blank instances?). The autoedit query string is specifying the name and fields of the embedded template. Should I be specifying something else/more that identifies the template+field set with 'holds template'? Or something else? Using Special:FormEdit/myform works exactly as intended. Thanks! - Lbillett (talk) 14:37, 25 July 2014 (UTC)

After some more experimenting the issue might be better described as - autoedit blows up on multiple instance templates. I expected it might respond by creating a new template instance on the target page (if the 'for template' tag was set to multiple). Might there be another way to accomplish the end effect?
I'm trying to create a simple way to collect dated acknowledgements from users on a target article. I thought I could accomplish it with an autoedit link that would add their username and date as a subobject to the target. If autoedit+multiple instance templates can't do it, is there another way I maybe haven't thought of? The multiple temps and subobjects would allow a lot of useful queries like 'what articles has user x acknowledged and when?' or 'what users have acknowledged article y'. - Lbillett (talk) 18:52, 25 July 2014 (UTC)
Ah. I'm describing a planned feature. Move along, move along. - Lbillett (talk) 00:44, 27 July 2014 (UTC)
Right. :) The handling of multiple-instance templates within #autoedit is definitely lacking at the moment. Yaron Koren (talk) 12:53, 28 July 2014 (UTC)

How to add poem tag within semantic forms[edit | edit source]

I have a semantic form which is working well. However, I have not found a way on how to include the poem extension tags. This means that users have to include the

<poem></poem> 

tag into the input box before typing information in. Is there a simple solution for this. Thanks.

Wikimanz (talk)

If the tag is supposed to cover the entire field, just add it to the template. Yaron Koren (talk) 16:04, 27 July 2014 (UTC)

Cannot make |show on select work with <headertabs/>[edit | edit source]

Hi, I am trying to make something like this work in SF but cannot make the headertabs work together with |show on select:

Is it supposed to work?

{{{field|testfield|input type=checkbox|show on select=Yes=>Yes}}}

<div id="Yes">
=heading1=
text
=heading2=
text
=heading3=
text

</div>

=heading4=
text

<headertabs/>
I would be surprised if that could work... Yaron Koren (talk) 12:52, 28 July 2014 (UTC)
Maybe try using the <h1>heading1</h1> <h2>etc. tags instead of wikitext sections? Sometimes that can make a difference. - Lbillett (talk) 13:09, 28 July 2014 (UTC)
Oh, you want the tab to appear? I'm way off, then. - Lbillett (talk) 13:11, 28 July 2014 (UTC)