Extension talk:Page Forms/Archive March 2012

From MediaWiki.org
Jump to navigation Jump to search

Is there a way to query field values in Semantic forms?

Hi everyone,

Im making a small php app, which has to get the field values of an specific page, for an specific Semantic form.

Is some way to do that? I've been looking the mediawiki API (api.php), and I cant find a query that covers my needs.

I would need something like

api.php?action=query&title=PAGE_TITLE&form=SEMANTIC_FORM_NAME&format=json

Is there any possible way to do this?Many thanks in advance.

Sub-Form of Semantic Forms

Hey, dear All

Is there any possible to build a Sub-Form inside Semantic Forms? Or, can we create a Sub-Property which belongs to a Property?

Right now the case is, we want to create a Form, and for Property A, there is no direct content for A, but A has for Sub-Properties, A1,A2,A3 and A4, and we need to input content into A1-A4.

Is there any possible way to do this?Many thanks in advance.

I'm not sure I understand your question - but "show on select" might be helpful here. Yaron Koren (talk) 16:50, 5 March 2012 (UTC)
Many thanks, as your suggestion, I use the "mutiple template" and it seems to fit with our target, but still we need to talk about it tomorrow.
But many thanks anyway, for every help!!

Weirdness using "button" formlink

For some reason when I try to use any formlink with type BUTTON, it doesn't work but instead the popup only loads the main page of the wiki. Weird thing is that I've checked the form action and it is indeed the correct string (even pasted it in to ensure that it would bring me to the right form entry). Just tested this on SF 2.4 (fresh download) and MW 1.17. Thinking back, this actually broke a while back. Maybe I posted here already? Not sure. Weird! It might be conflicts if nobody else is experiencing this.    Thorncrag   20:10, 5 March 2012 (UTC)

Don't know about the release version. Just tried it on an MW 1.17 with the current dev version of SF and it worked alright. Maybe give it a try. There were several changes in the handling of parser functions. --F.trott (talk) 20:19, 5 March 2012 (UTC)
I had the same issue. Then I changed from the default method Mediawiki URLs to more friendly URLs, i.e. example.com/wiki/Page_Name. When I did that, formlinks worked. To do this,
  1. Add the following line to your LocalSettings.php:
    $wgArticlePath = "/wiki/$1";
  2. Then create a .htaccess file (if not there) in your wiki's root directory, and add:
RewriteEngine On
RewriteRule ^wiki/(.*)$ /index.php?title=$1 [PT,L,QSA]
RewriteRule ^wiki/*$ /index.php [L,QSA]
RewriteRule ^/*$ /index.php [L,QSA]
  • Careful if you already have a .htaccess file. Cavalierly, modifying this file can cause issues with your wiki.

--70.91.187.57 18:35, 13 March 2012 (UTC)

Lingo Extension

Hi. I have started using Semantic Mediawiki 1.7.0.2 wit Semantic Forms 2.3.2

If I have words or phrases in Field names that are on a page called Terminology and used by the Lingo Extension then the extension is interfering with the rendering of the "Edit with Form" page. The inserted Spans are a problem.

I will have to be careful with my terminology!

Fixed in the dev version of SF on SVN. --F.trott (talk) 22:57, 5 March 2012 (UTC)
Sorry to say, not fixed. See Lingo Talk Page Jeremy.Osborn (talk) 09:28, 24 March 2012 (UTC)

Preloading data into multiple instance template

What preload data into form with multiple instance template? --Pastakhov (talk) 10:24, 6 March 2012 (UTC)

If I understand the question correctly - you need to add another index in the query string; see here for one example: http://discoursedb.org/wiki/Special:FormEdit/Item/Some_Item?Opinion[Topic][1]=ABC (sorry, it was too hard to make it a link). Yaron Koren (talk) 01:52, 9 March 2012 (UTC)
Rectification: Some_Item?Opinion[index][FieldName]=ABC
http://discoursedb.org/wiki/Special:FormEdit/Item/Some_Item?Opinion[1][1]=Topic1&Opinion[1][2]=Position1&Opinion[2][1]=Topic2&Opinion[2][2]=Position2
In form Item Field name not Topic, field name is 1. Thanks for help --Pastakhov (talk) 05:05, 19 March 2012 (UTC)
BUG: by link http://discoursedb.org/wiki/Special:FormEdit/Item/Some_Item?Opinion[1][1]=Topic1&Opinion[1][2]=Position1&Opinion[2][1]=Topic2&Opinion[2][2]=Position2 show two "Opinions...", but "Save page" set only one (last) "Opinions..." --Pastakhov (talk) 07:50, 29 March 2012 (UTC)
BUGFIX: https://gerrit.wikimedia.org/r/#/c/32014/ --Pastakhov (talk) 03:36, 14 November 2012 (UTC)
Yes, thanks :-) --Pastakhov (talk) 06:40, 9 March 2012 (UTC)
What move data from one multiple instance template to another? Or what get row index in #ask: query? --Pastakhov (talk) 16:24, 13 March 2012 (UTC)
I didn't understand the first question, but for the second question, you should store that information using the Semantic Internal Objects extension. Yaron Koren (talk) 17:27, 13 March 2012 (UTC)
I have page with multiple instance template. In template i use Semantic Internal Objects. I need button to copy data from this page to new page.
{{#formlink:form=myForm | {{#ask: [[MySIOProperty::{{FULLPAGENAME}}]]
|mainlabel=-
|?Sio1
|?Sio2
| format=template
| template=Test
| link=none
}} }}

Template:Test

|tmpl[fld1][ -= need get row index =- ]={{{1|}}}
|tmpl[fld2][ -= need get row index =- ]={{{2|}}}

what get row index from #ask: query? mainlabel returns {{FULLPAGENAME}}#rowindex. How to get rowindex without {{FULLPAGENAME}}# ? Or any ideas, thanks... --Pastakhov (talk) 03:43, 14 March 2012 (UTC)

Getting the index is indeed tricky - the NumerAlpha extension might help. Yaron Koren (talk) 12:24, 14 March 2012 (UTC)
it needs used additional template, for get one index to several rows. NumerAlpha extension may help, but it looks ugly and difficult to. It would be great to have the column "index number" in #ask:. many thanks --Pastakhov (talk) 13:13, 14 March 2012 (UTC)
I solve similar problems by using Extension:Arrays, and some advanced MediaWiki template programming to handle counting custom formatted SMW data. You can see an example I'm working on here: http://www.coincompendium.com/w/index.php/Sandbox/eBay_sighting_list_test Badon (talk) 21:28, 14 March 2012 (UTC)
In sample: {{#vardefineecho: mycounter | {{#expr: {{#var: mycounter }} + 1 }}. Thanks, --Pastakhov (talk) 05:05, 15 March 2012 (UTC)

fancybox not being loaded by form pages

I am having trouble with uploading files in my forms. Fancybox.js does not seem to be loaded with the page. I am running mediawiki 1.18 and SF 2.4.1 at first i thought it was a problem with resource loader but i saw SF is on the list for "Resource loader compatible extensions". If it's not showing up on the page, how do i go about tracking down the problem? Can i manually load it somehow?

I have no idea - are you using a skin other than Vector? Or are you using some other extension that might be interfering with the Javascript? And what version of Semantic MediaWiki are you using? Is this a public wiki, by any chance? Yaron Koren (talk) 01:28, 9 March 2012 (UTC)

Mediawiki 1.18 semantic forms 2.4.1, here is an example page, i have enabled editing for anons so you can see what i'm talking about. PlantWiki. I use a custom skin based off Monobook (pretty much only css has been changed). I'm a LAMP developer and don't have much experience tracing javascript so i'm a little lost. Thanks for the help!

Ah - the fact that it's a public wiki is extremely helpful. Your problem is a Javascript error, coming from this file. (I've never heard of the "JavaScript" extension before.) And you're using version 1.7.0.2 of Semantic MediaWiki, by the way. Yaron Koren (talk) 11:56, 11 March 2012 (UTC)

Your amazing, thanks for the support! I'm pretty sure your the only dev i have seen with this kind of commitment to helping those using their extension. Much appreciated.

Agreed! Badon (talk) 19:47, 13 March 2012 (UTC)

Text box too large

Hello everyone, I'm having trouble enlarging or shrinking a text box (not a textarea) size. I tried using 'size=' parameter but it just remains the same. I have also tried using different browsers but the outcome is still the same. Please help.

What's the full {{{field}}} tag you have? Yaron Koren (talk) 19:31, 9 March 2012 (UTC)

That would be {{{field|Hydrogen|size="1"}}} where hydrogen is the name of the property. Thanks again

Try removing the quotes around "1". Yaron Koren (talk) 13:30, 13 March 2012 (UTC)

Oh it works perfectly now! Thanks Yaron!

request: wikieditor textarea size

Since textareas where editor=wikiEditor are contained by the wikiEditor UI and we thus don't appear to have control over the wikiEditor container size, it would seem logical to disable the number of columns and disable setting width to 'auto' when editor=wikiEditor. Thoughts?

Nevermind, I found that this happens when the textarea is set to autogrow. When autogrow is taken off, the textarea fills the wikiEditor space.

Are you using WikiEditor with forms? I know a lot of people have been asking about this but Yaron has mentioned it's currently not possible.

When did I say it wasn't possible? It's been possible since version 2.3. Yaron Koren (talk) 11:56, 11 March 2012 (UTC)

Problems editing a page

I would like that the tab "Edit with form" shows up in every page. So, I created the page "MyWiki:Main" (but changing with my wiki's namespace) with the content [[Page has default form::form-name]].

Am I doing something wrong?

Also, when I'm editing a page, it doesn't show the real source and I really like to edit the source.

For example, the source is:

'''Name:''' ABC

When I try to edit it shows:

{{Name
|Name=ABC
}}
For the first question - it should be "Has default form", not "Page has default form". For the 2nd question - that is the real source. Maybe you should read up more about MediaWiki templates. Yaron Koren (talk) 11:57, 11 March 2012 (UTC)

Category select depth

I have the following code in a form: {{{field|categories|input type=categories|top category=Categories|width=600|height=200|hideroot|depth=1}}}.

However, there seems to be an issue in that I can only select categories up to depth 1. I am able to expand categories to view subcategories of them, but I can't tick the box next to a subcategory, rendering them slightly pointless.

Considering the large number of categories (and especially subcategories) my project has, that is annoying. Is there any way to fix it? Dendodge (talk) 00:49, 12 March 2012 (UTC)

The problem is that categories loaded in the background are directly provided by the categories extension. The semantic forms extension does not get a chance to modify them and insert the checkboxes. A rather weak workaround would be to insert the following lines of code into SFCategoriesInput::getHtml()
  // Hide subcategories.
  $tree = str_replace('<div class="CategoryTreeChildren" style="display:block">', '<div class="CategoryTreeChildren" style="display:none">', $tree);
  $tree = str_replace('data-ct-state="expanded">[<b>−</b>]', 'data-ct-state="collapsed">[<b>+</b>]', $tree);
  $tree = str_replace('title="collapse"', 'title="expand"', $tree);
Setting depth>1 will then still load subcategories but will not initially expand the main category nodes. This is quite inefficient, though: If you have a lot of categories your page will load very slowly. And as soon as you go deeper than the initially loaded category tree, you'll have the same problem as before: No checkboxes. So this solution is not a very satisfactory one.
A much cleaner and faster solution would be for the category tree extension to implement a hook that the semantic forms extension can use to modify ajax HTML output before it is passed to the browser. That requires a change to the CategoryTree extension and I don't know whether its maintainer would accept it. Maybe some JS hacking could solve the problem without having to modify the CategoryTree extension?

Dynamically extend form

Hi,

I try to do the following: I have a base form/template ("Job") and I want to extend the base form with a specific other template depending on the selection of a "Job type" list box. This already works with: {{{field|Job type|input type=dropdown|mandatory|show on select=website=>jobtype_website;application=>jobtype_application}}}

I have two <div> section in my form (with id "jobtype_website" and "jobtype_application"). These two DIVs contain a complete form specification.

Now, when I save the form, both template definitions are included into the final page, even the one that was not visible in the form. Is it possible to create a template definition only when the DIV containing the form is visible? Or when a specific field inside the extended form is filled?

Or, as an alternative solution: Is there a possibility to limit the "multiple" form to allow only 0 or 1 forms?

Thanks. Jens--157.161.162.66 15:10, 12 March 2012 (UTC)

Hi - being able to limit the number of instances of a multiple-instance template might have been a reasonable solution here, but unfortunately it can't be done. What's so bad about having the extra, unused template in the page, though? If the issue is that it's displaying some header that you don't want it to, you can get around that by using #if to only show the header when necessary. Conversely, you don't need even need three templates - you can have everything in one big template, again using #if to only show the relevant parts each time. Yaron Koren (talk) 17:02, 12 March 2012 (UTC)

Dynamically show listbox entries depending on selected value of other listbox

Hi,

as described in the title, I have to listboxes. The first one shows the main category. Now depending on the selected values (one or more are possible), I want to show different values in the second listbox. I tried the "values dependent on" parameter but it didn't work out and I couldn't find a description in which way it should be implemented.

Or can it be easier to realize with an ask query?

Hope someone can help. Thanks, Chris

Unfortunately, this can't really be done. As noted in the documentation, "values dependent on" only works with the input types 'combobox', 'text with autocomplete' and 'textarea with autocomplete'. You might be able to do mimic this using "show on select", but note that each "shown" field would have to have a different name. Yaron Koren (talk) 13:43, 13 March 2012 (UTC)

Issue with Edit with Form

I have put 2.4.1 on my IIS 7.5 wiki and I get the following error:

"PHP Fatal error: Class '<' not found in D:\www\IIS7\http-root\ict-test-wiki\extensions\SemanticForms\includes\forminputs\SF_FormInput.php on line 308"

Product Version MediaWiki 1.18.1 PHP 5.2.17 (cgi-fcgi) MySQL 5.5.11

Semantic extensions Semantic Bundle (Version 20120124) Semantic Forms (Version 2.4.1) Semantic Forms Inputs (Version 0.5) Semantic MediaWiki (Version 1.7.0.2) Semantic Result Formats (Version 1.7)

Can someone help and suggest where I might be able to fix things?

Thank

Hi - this looks like a bug in SF that's appearing due to your PHP version, and possibly due to IIS as well. If possible, to help us in fixing it, could you add the following line between lines 304 and 305 of that file (\includes\forminputs\SF_FormInput.php);
print_r( $bt[1]['args'] );
...and print out here what gets displayed? Yaron Koren (talk) 13:31, 14 March 2012 (UTC)

I'm getting the exact same error on a linux server. MediaWiki 1.18.1, PHP 5.2.17 (cgi-fcgi), MySQL 5.1.56, Semantic MediaWiki 1.7.1, Semantic Forms 2.4.1 Output after adding 'print_r( $bt[1]['args'] );'

Array ( [0] => Array ( [0] => SFTextAreaInput [1] => getHTML ) [1] => Array ( [0] => [1] => Test Template[Name] [2] => [3] => [4] => Array 
( [possible_values] => Array ( ) [value_labels] => [is_list] => [semantic_property] => Name [property_type] => _txt ) ) ) Array ( [0] => 
Array ( [0] => SFTextAreaInput [1] => getHTML ) [1] => Array ( [0] => [1] => Test Template[Address] [2] => [3] => [4] => Array 
( [possible_values] => Array ( ) [value_labels] => [is_list] => [semantic_property] => Address [property_type] => _txt ) ) ) Array ( [0] 
=> {{{for template|Test Template}}} {| class="formtable" ! Name: | {{{field|Name}}} |- ! Address: | {{{field|Address}}} |} 
{{{end template}}} '''Free text:''' {{{standard input|free text|rows=10}}} {{{standard input|summary}}} {{{standard input|minor edit}}}
{{{standard input|watch}}} {{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}}
[1] => [2] => [3] => 229 [4] => [5] => Radge [6] => ) 
Fatal error: Class '<' not found in /home/rellard/public_html/www.ecig-boxmods.com/extensions/SemanticForms/includes/forminputs/SF_FormInput.php on line 309
Okay - it must just be PHP 5.2, then. This is clearly a pretty major bug. Yaron Koren (talk) 17:01, 16 March 2012 (UTC)

If it's any help I can probably upgrade my hosting to PHP 5.3 to see or would that cause more problems? Done, It's fine now with PHP 5.3 Thanks a lot :)

Hi - this was just fixed in SVN by Stephan Gambke; if anyone has this problem and has SVN, just update the code. If you don't have SVN, you can make the change manually - see here. There will hopefully be a new version of SF with this fix, soon. Yaron Koren (talk) 19:59, 16 March 2012 (UTC)

Multiple values for a template

Hi all,

Relative at this example

{{{for template|InfrastructureType|multiple|add button text=Another type}}} 
'''Give a type''': {{{field|Infrastructure Type|mandatory|input type=dropdown| property=TypeInfras}}}
{{{end template}}}

I don't know if it's a bug but when I was using Semantic Forms 2.4-alpha it worked well. But when I upgraded the new version Semantic Forms 2.4.1 I can't edit a page using this Form

best regards, Fary

What do you mean - why can't you edit the page? Yaron Koren (talk) 15:12, 14 March 2012 (UTC)

If I edit a page I have a blank page.

Ah - please see here. Yaron Koren (talk) 16:35, 14 March 2012 (UTC)

I increase my memory at 128M and if I put in my LocalSettings

error_reporting( E_ALL );
ini_set( 'display_errors', 1 );

It shows

Fatal error: Call to a member function getOutput() on a non-object in ..../extensions/SemanticForms/includes/SF_FormEditAction.php on line 179

instead of the edit page

Cool, thanks. You've found a bug - thankfully, it seems that it only appears when there's more than one form defined for a page. Also, I'm guessing that you're using MediaWiki 1.17. Anyway, I just checked in what I think is a fix - if you have SVN, please update, and let me know if that fixed the problem. Yaron Koren (talk) 13:41, 15 March 2012 (UTC)

I'm using MediaWiki 1.17.0 but the problem is the same

You updated Semantic Forms? What's the error message you're getting now? Yaron Koren (talk) 17:42, 15 March 2012 (UTC)

Error message is the same:

Fatal error: Call to a member function getOutput() on a non-object in ..../extensions/SemanticForms/includes/SF_FormEditAction.php on line 179

when I use Semantic Forms 2.4.1 with MediaWiki 1.17.0 but if I use Semantic Forms 2.4-alpha there's not problem

You must have somehow not updated SF fully - at the very least, you should have gotten a different line number. Yaron Koren (talk) 11:58, 16 March 2012 (UTC)

Yeah! it's working now. May be my update wasn't complete. Thanks Yaron

It's great to hear that the fix worked. Yaron Koren (talk) 16:04, 16 March 2012 (UTC)

Forms fail after updating to latest Semantic Bundle

I just updated to the latest Semantic Bundle and get the following when I try to Edit with form:

Fatal error: Class '<' not found in /home/content/65/6092565/html/scientolipedia/extensions/SemanticForms/includes/forminputs/SF_FormInput.php on line 308

The line 308 is:

$input = new $calledClass ( $sfgFieldNum, $cur_value, $input_name, $is_disabled, $other_args );

Thanks in advance for any help. DaveL (talk) 14:41, 16 March 2012 (UTC) MediaWiki 1.18.0,PHP 5.2.17 (cgi-fcgi),MySQL 5.0.92-log, Semantic Bundle (Version 20120308)

This bug was already reported, above (I assume it's due to the use of PHP 5.2). IIf possible, could you try the debugging call, as I suggested above? Yaron Koren (talk) 15:15, 16 March 2012 (UTC)
The printout is here DaveL (talk) 16:07, 16 March 2012 (UTC)
Thanks for the printout; that was helpful. This problem has been fixed in SVN; see above. Yaron Koren (talk) 20:00, 16 March 2012 (UTC)
Thanks Yaron, that fixed it. DaveL (talk) 21:01, 16 March 2012 (UTC)

Sizing Image For Display On Form

SF 2.3.2/MW 1.18: I am wanting to have the form display a given size for the image that I upload (e.g.; 200x200). Is this possible and if so how would I do it? Thanx! --Coffeehound (talk) 21:36, 18 March 2012 (UTC)

That's not really possible, unfortunately - right now the size is hardcoded, so the only way you could change it is by modifying the file /libs/SF_imagePreview.js (where, ironically, the width is right now set to 200 pixels). Ideally, this should be a user setting. Yaron Koren (talk) 13:26, 19 March 2012 (UTC)
All good! I really love the extension and thank all of you for putting your time into these things and answering ?s from folks like me! With that said, I changed the 200 to 100 to see if it did anything and nothing happened. The photo is displaying at 640x480 (which is the size that it uploaded at). You may see it at http://offgridops.org/foreclosurepedia/index.php/1772077367 (I have taken the security down for a day and will have to reinstate it after a bit as it is a US Government real estate asset). Thanks, in advance, for any help!--Coffeehound (talk) 19:50, 19 March 2012 (UTC)
Hi - oh... I think you're talking about the display of the image on the page, not on the form. It's important to note that, once a page has been created with a form, Semantic Forms has no control over its display or behavior. To change the image size, see here. Yaron Koren (talk) 21:40, 19 March 2012 (UTC)
Thank you for a quick reply. Yes, you are correct; I am referring to the page created as an end product of the form. So, to make sure I understand do I need to: a) ensure that the size of photos to be used are uploaded at the size I want; or b) am I able to set the size in the template? The template is ! Main image | [[Has image::Image:{{{Main image|}}}|]] [[Image:{{{Main image|}}}]] |- I added |100px in both areas after Main image| and got no change in the size of the photo on the page. Thanx! --Coffeehound (talk) 23:12, 19 March 2012 (UTC)

Multiple image uploads per form

My first image is within an infobox and displays fine after uploading using

[[Image:{{{Image|}}}|200px]]

in the template. Using the same method further down the template

[[Image 2:{{{Image 2|}}}|250px]]

just causes a red link to appear.

I'm really stuck. Do I need to define an arraymap and if so can you give me some help please?

You just need to change the 2nd one to
[[Image:{{{Image 2|}}}|250px]]
. Yaron Koren (talk) 13:27, 19 March 2012 (UTC)

Thanks Yaron

Sometimes you just need a second set of eyes to look at what you're doing :) Badon (talk) 03:46, 30 March 2012 (UTC)

fatal error using SF 2.4.1

I ran into the following error:

PHP Fatal error:  Class '<' not found in <extension_path>/SemanticForms/includes/forminputs/SF_FormInput.php on line 308
Hi - yes, that bug has been fixed in SVN (see above). I hope to release a new version with the fix very soon. Yaron Koren (talk) 15:08, 20 March 2012 (UTC)
Sorry, I didn't see the previous post. I did SVN update (to revision 114383) and it solved that problem. However, I'm noticing this now:
PHP Fatal error:  Class name must be a valid object or a string in <extension_path>/SemanticForms/includes/forminputs/SF_FormInput.php on line 313, referer: <referrer_url>

line 313 shows:

$input = new $calledClass ( $sfgFieldNum, $cur_value, $input_name, $is_disabled, $other_args );

This error is being thrown when calling Special:FormEdit.

If it would help to know, the page name is being created by the form's one-step process. 'Info' tag follows the pattern:

{{{info|page name=Namespace:<Template[Property]>_<unique number;start=1>}}}
That's bad... if possible, could you put in that same print_r() call, described above, and let me know what that prints out? Yaron Koren (talk) 18:50, 21 March 2012 (UTC)
exact print_r output (retaining original template & property names):

Array ( [0] => Array ( [0] => SFTextAreaInput [1] => getHTML ) [1] => Array ( [0] => [1] => Facility[Description] [2] => [3] => [4] => Array ( [input type] => textarea [editor] => wikieditor [cols] => 120 [no autocomplete] => 1 [possible_values] => Array ( ) [value_labels] => [is_list] => [semantic_property] => Description [property_type] => _txt ) ) ) Array ( [0] => Array ( [0] => SFTextAreaInput [1] => getHTML ) [1] => Array ( [0] => [1] => Permit[num][Description] [2] => [3] => [4] => Array ( [input type] => textarea [editor] => wikieditor [no autocomplete] => 1 [part_of_multiple] => 1 [origName] => Permit[Description] [possible_values] => Array ( ) [value_labels] => [is_list] => ) ) ) Array ( [0] => Array ( [0] => SFTextAreaInput [1] => getHTML ) [1] => Array ( [0] => [1] => Equipment[num][Comment] [2] => [3] => [4] => Array ( [input type] => textarea [editor] => wikieditor [no autocomplete] => 1 [part_of_multiple] => 1 [origName] => Equipment[Comment] [possible_values] => Array ( ) [value_labels] => [is_list] => ) ) )

Hi - thanks. Unfortunately, that's not enough to diagnose the problem. Could you change that print_r() statement to just be "print_r($bt)", and then email me the results, at yaron57@gmail.com? It'll probably be too huge for this page. Yaron Koren (talk) 13:18, 22 March 2012 (UTC)

Fatal error: Class '<' not found

QUICK SOLUTION: Upgrade semantic forms to 2.4.2

MW 1.18.1/SF 2.4.1

Fatal error: Class '<' not found in /home/offgrido/public_html/onyx/extensions/SemanticForms/includes/forminputs/SF_FormInput.php on line 308

Absolutely nothing in the wiki except a new form.

Any help would be great! --Coffeehound (talk) 23:02, 20 March 2012 (UTC)

I ended up redoing the SMWAdmin and it seems fine. Sorry for the bother. You can delete this if you want. --Coffeehound (talk) 23:12, 20 March 2012 (UTC)


I'm having the same issue, but updating the database tables doesn't fix it - what did you mean by 'redoing the SMWAdmin'? (29 March 2012 (UTC)

I don't know what that person meant, but if you upgrade to SF 2.4.2, the problem should go away. Yaron Koren (talk) 16:47, 29 March 2012 (UTC)

I can confirm: I had same issue with Mediawiki 1.18.2 and SF 2.4.1. Now by downloading SF 2.4.2 I could fix this issue. Thanks for the tip and the correction! Thomas →10:27, 31 March 2012 (UTC)

initialize hidden field after query

I'm using MW 1.18 / SF 2.3.2

I have a form with a field (hidden in my case) for a query page. The query returns with links to run the query with some values for that field (i.e. RunQuery/Querypage&Querypage[hiddenfield1]=2&...). So my problem is that I need to initialize the hidden field value after the query page data is loaded. Is there a built-in way to do this? to initialize a field value to its default after query processing? Osishkin (talk) 14:46, 21 March 2012 (UTC)

Unfortunately, I don't think so... why do you need a hidden field, though, for a query form? Yaron Koren (talk) 15:33, 21 March 2012 (UTC)
In my case I return a paginated table in response to the query. I obviously can't know the number of pages returned before the query is executed, So even if I wanted (and I don't, it's ugly) I can't display a "Choose results page number" combobox.
The solution I've chosen is to maintain a hidden field with the page number. However, I now realized this raises a bug - if the user queries with page=2, and afterwards decides to run a completely different query, the page number in the hidden field is still maintained. The new query may not even have 2 pages of results, and the result may be null. Osishkin (talk) 16:35, 21 March 2012 (UTC)
If you can demonstrate the issue for me, I might be able to suggest a better solution. Can you share a link to an example? Badon (talk) 03:49, 30 March 2012 (UTC)
Well I can try, but my wiki is in Hebrew, so you might have to make an effort. This link is for a RunQuery page where the user asked for page 3 of detailed results table (if you look at the URL you can also see the relevant parameter). The result is composed of three parts - general overview (non-paginated), detailed overview (paginated) and on the bottom you see the actual form. If you now replace the text in the first top right input box to הפועל לוד, and run the query - you now see a non-empty general overview table, and an empty table in the second part. Using printouts I figured out that the hidden field is still set for 3, which is obviously not relevant for the new query result, and messes up the paginated second part. Hope you got the idea. Osishkin (talk) 07:29, 9 April 2012 (UTC)

Upload not inserting images into forms

Using upload in a form input i get the normal upload window, select the file to upload, and see the filename appear in the upload window. Although i see the loading bar appear for a second, there is no image preview and when i click "upload" the upload window goes blank, does not close, and no image appears in my form (no image or filename inserted into the input box). However, the image has been uploaded to the wiki when i check my recently uploaded files. You can view the problem here and use the following login info...

Username: user Password: password

Thanks!

The issue is a Javascript bug coming from outside Semantic Forms - see the 5th item here. Yaron Koren (talk) 20:17, 22 March 2012 (UTC)
When i add the debug URL i get an error. How should i append the debug command to the formedit URL?
You should add "&debug=true", not "?debug=true", to the URL. Yaron Koren (talk) 00:27, 23 March 2012 (UTC)
I get an error saying MW user is undefined. Here is the line it references in my page code..

<script>if(window.mw){ mw.user.options.set({..... (let me know if you want to see all of this it's a half page) } </script>

Now the weird thing is i turned off my extensions i had added since i last had it working. Then turned them back on. Images now show in the form and upload correctly but there is no preview image in the upload window. It previewed once out of 5 times i uploaded. The bug seems intermitten but i'm not changing things each time i try.

Well, whatever the cause is, I believe it's not related to Semantic Forms. Yaron Koren (talk) 16:45, 23 March 2012 (UTC)
Actually, if I understand the description of the issue correctly, I think it is related to SF. If the user tries to upload a file before SF's JavaScript fully loads, the upload will succeed, but the uploaded file will be "lost", just like was described by the person above. The solution to Bug 32424 might also solve this problem. Basically, the upload field and link should only be shown in certain circumstances. By using JS to display it, the user will have to wait for the JS to load before they can use it. Badon (talk) 04:01, 30 March 2012 (UTC)

embed in field question

In a template (escaping all), I have

{{{for template|^page}}}{{{field|header|holds template}}}{{{end template}}}
and later
{{{for template|^header|embed in field=^page[header]|multiple}}}

No button is shown for adding instances of the ^header template; before I added this code into the form the button was showing and operating fine. Instead I now see displayed: @insertHTML_^page___header@ Any ideas? I have 2.4 SF + 1.6 SMW + 1.17 MW.

I tried this feature because I want to specify default templates for the "header" field by something like {{{field|header|holds template|default={{^header}}}}}

Will I be able to get this to work or is there a another way. --Hypergrove (talk) 08:43, 26 March 2012 (UTC)

My guess is that this is failing due to the "^" in the template name (which would be a bug). Is this happening on a public wiki? If not, is there any way you could reproduce the problem on a public wiki, like scratchpad.referata.com? Yaron Koren (talk) 13:28, 26 March 2012 (UTC)
removed the 'hat' symbol and the code is behaving differently, not correctly yet. It is placing the add-another-button at the position of the template that embeds the repeating template, not within the scope of the repeating template as it did prior to my inserting this code. I assumed the formatted form would NOT look any differently, that the 'embed in field' for-template would still generate its button at the point that that for-template is located, NOT at the point of the field that contains the 'holds template'. I am not able to rearrange the for-templates to accommodate this (unexpected?) layout becuase my form is now organized as for-template header -- free form -- for-template footer. I was trying to request SF to format the following template invocation in the page:
{{page |header={{header}} |footer={{footer}} }}
And is there a way to specify a default template instance that is embedded in the field marked as "holds template"? thanks, --Hypergrove (talk) 19:21, 26 March 2012 (UTC)
Well, right below where the multiple-instance templates are is where the "Add another" button should go, no? It just seems weird to have it anywhere else - you press a button and something pops up in some other location on the page. For your last question, preloading the form with content might achieve that. Yaron Koren (talk) 19:45, 26 March 2012 (UTC)
yes, I agree that's where they should go, but it's not happening... I have set up a demo of my system right now, without using the embed feature, just plain multiple templates being displayed by a form template. At this point, the add-another button is no longer shown, the legend of an instance fieldset IS shown but at the top of the form, the cancel button doesn't work now and so on - it's just all wrong! Thanks so much for your looking at this Yaron.
Hi - well, now everything is starting to make more sense. This is a complex form! It contains form templates, and there's a lot going in every component. This is too much for me to analyze right now - I would try simplifying the form to try to isolate the part(s) causing the problem. You could start by just using the "mw-collapsible" class instead of the "^collapsible" template. By the way, scratchpad.referata.com is the general testing wiki, not smw.referata.com - it's fine, though. Yaron Koren (talk) 13:01, 27 March 2012 (UTC)
Sure - i've removed all unrelated code at a demo of my system. It's much shorter now, just for template - field - end template are escaped in ^form Thanks --204.16.43.16 06:08, 28 March 2012 (UTC)
Great - but now it's working, no? Yaron Koren (talk) 10:21, 28 March 2012 (UTC)

forminput - entry mandatory

Is it possible to make an entry mandatory in the forminput field? This will keep the form from loading with no page name or only a super page name. --Dgennaro 18:58, 26 March 2012 (UTC)

That's probably a good idea - it would require some Javascript. Yaron Koren (talk) 19:11, 26 March 2012 (UTC)

form preloading question

If I have a multiple template in a form, I don't see how to to preload a page with an instance of this template. There's the preload arg on the free form text field, but I don't see how that can be a solution, particularly when that 'field' is said to be include-only content. I don't quite see how a multiple template can be instantiated by providing a preload arg to the free-form field (does the design basically rely on a side effect?). Thanks for guidance. --204.16.43.16 19:12, 28 March 2012 (UTC) ...Reading older posts, it seems there's no way yet to preload instances of a multiple template (as opposed to preloading values within a multiple template). Embed in field and holds template I thought would work (and then givng a default value for the "holds template" field but the add-another button is not being created or formatted correctly.

This definitely could be documented better, but there's a way to do it: instead of "templateName[fieldName]", you have things like "templateName[fieldName][1]". As for the template-embedding thing - please let me know if you think you've found a bug. Yaron Koren (talk) 21:14, 28 March 2012 (UTC)
Oops - that should actually be "templateName[1][fieldName]". Yaron Koren (talk) 12:38, 29 March 2012 (UTC)

RunQuery - transclusion of categories field

I noticed today when you transclude a RunQuery page onto another page an it contains a "categories" field that the categories will appear to be all top level categories even if they are nested. --Dgennaro 20:07, 29 March 2012 (UTC)

Do you have a demo for that? Badon (talk) 04:07, 30 March 2012 (UTC)

BUG: incorrectly saved page with preloading data into multiple instance template

sample link http://discoursedb.org/wiki/Special:FormEdit/Item/Some_Item?Opinion[1][1]=Topic1&Opinion[1][2]=Position1&Opinion[2][1]=Topic2&Opinion[2][2]=Position2 show two row in "Opinions for this item", but page save only one (last) row --Pastakhov (talk) 07:09, 30 March 2012 (UTC)