Extension talk:Page Forms

From MediaWiki.org
Jump to: navigation, search

multi instance template Spreadsheet-style editing[edit]

I have multi instance template and have a couple of issues.

  • Date Picker does not seem to work. Is this possible?
  • Can I add PlaceHolder text?
  • The headings are the field name not the title. Is there a way to fix that?
Thanks, --Legaulph (talk) 16:53, 1 March 2018 (UTC)
The answer to the first two questions is "no", unfortunately. What do you mean by the title? Yaron Koren (talk) 17:01, 1 March 2018 (UTC)


The Headings in the top bar |--Legaulph (talk) 17:54, 1 March 2018 (UTC)
I don't understand the question, then. Yaron Koren (talk) 18:01, 1 March 2018 (UTC)
So if I have
{{{
! Start date:
| {{{field
|start date
|input type=text
|mandatory
|date format=mm/dd/yy
}}}
Start date: does not show for the heading it displays start date from field name. --Legaulph (talk) 18:16, 1 March 2018 (UTC)
Oh, I see. You can set it manually by adding a "|label=" parameter to the field tag. Yaron Koren (talk) 03:24, 2 March 2018 (UTC)
That works, Thanks. --Legaulph (talk) 11:55, 5 March 2018 (UTC)

Missing two listboxes... (part 2)[edit]

Hello, Sorry to reopen the "Missing two listboxes" topic. Yaron Koren asked «Do you still think "two listboxes" has advantages over "tokens"?"». Yes, I do! The difference between "two listboxes" and "tokens" is the same as between "text with autocomplete" and "combobox". Users prefer to select an item from a list rather than type it. Furthermore, "two listboxes" is better than the "listbox" input because users do not necessarily know that the control key allows to select several values ... So I vote for the introduction of the "two listboxes" input in the "Page Forms" extension. Please do, semantic master, millions (billions ?) of users humbly are asking you.
By the way, great job Yaron for all your work! --Megajoule (talk) 15:35, 9 March 2018 (UTC)

Thanks, and I'm pretty sure my software doesn't have millions of users. :) What about "two listboxes" vs. "checkboxes"? Yaron Koren (talk) 16:01, 9 March 2018 (UTC)
Hmm... Nice try but I'm not sure that "checkboxes" is the most appropriate input if you use "values from category=some category" whereas some category has millions (um, hundreds...) of pages... --Megajoule (talk) 22:27, 9 March 2018 (UTC)
I don't understand - would "two listboxes" work with hundreds of values? Yaron Koren (talk) 14:05, 11 March 2018 (UTC)
Yes, indeed. I've just tried a "two listboxes" input with 973 pages in the category. And it works perfectly. --Megajoule (talk) 18:00, 14 March 2018 (UTC)
Well, I should have worded it better. I'm not surprised that it works, it just seems very unwieldy to have a "two listboxes" input with hundreds of values, where you have to keep scrolling up and down to find different values. Do you really think "two listboxes" is easier to use than either "tokens" or "checkboxes" with that many values? Yaron Koren (talk) 18:18, 14 March 2018 (UTC)
The choice in "two listboxes" is restricted, which is often necessary : you can't type a "fanciful" value. And either you can go through the list or you can use the autocompletion field. This option makes it easy to fill a basket. In short, users like it. --Megajoule (talk) 21:42, 14 March 2018 (UTC)--

Oh yeah, I forgot that "two listboxes" had an autocompletion helper feature. Though I should note that in the "tokens" input you can use "existing values only" to prevent users from creating new values. But I'm curious about the last thing you said - "users like it". This is a lot to think about, because as far as I remember you're the first person who has asked for "two listboxes" to come back since it went away around September 2016 (even in the discussion you linked to, the person didn't really seem bothered by the switch to "tokens"). Without getting into too many details, roughly how many people have you heard expressing an opinion on this? Yaron Koren (talk) 00:30, 15 March 2018 (UTC)

OK, you convinced me. I'll manage with "tokens" and try to carry out effective change management with my users... Thanks. Megajoule (talk) 08:54, 29 March 2018 (UTC)

Hello again... How should I do with tokens so that a possible value can only be selected once (as in two list boxes ...)?
-- Annoying Megajoule (talk) 17:20, 13 April 2018 (UTC)

Unfortunately, there's no way (short of modifying the code), though it would indeed be nice if selected values got removed from the set of possible values. Yaron Koren (talk) 01:57, 16 April 2018 (UTC)

Radio button[edit]

Hi!

I have big problem with Radio buttons. Imported the Template:Location map from wikipedia, everything work great but selection of multiple maps doesn't work at all.

I was trying all different solutions but nothing seems to work. http://escforumwiki.com/index.php?title=Template:Location_map#User_selection_of_multiple_maps --Tymek1988 (talk) 00:05, 14 March 2018 (UTC)

Could you link to a form where the problem can be seen? I don't understand how that page you linked to is related. Yaron Koren (talk) 00:26, 14 March 2018 (UTC)
its releted because it shows that it doesn’t work, I don’t get any error message. This how it looks in wikipedia: https://en.wikipedia.org/wiki/Template:Location_map#User_selection_of_multiple_maps and that’s mine: http://escforumwiki.com/index.php?title=Template:Location_map#User_selection_of_multiple_maps--Tymek1988 (talk) 08:53, 14 March 2018 (UTC)
Is this a question related to the Page Forms extension? You do have Page Forms installed on your wiki, but it doesn't look like you have any forms defined. Yaron Koren (talk) 16:18, 14 March 2018 (UTC)
After little search I found that I need Template:Switcher and MediaWiki:Common.js, still doesn't work tho, but hope I will find the problem soon --Tymek1988 (talk) 22:44, 14 March 2018 (UTC)

TinyMCE[edit]

Hi Yaron, hope all is good! I have just installed TinyMCE onto my development server, but I can't seem to figure out how to get it working on the Page Forms. Where do I place the "editor=tinymce"? I have tried in the form, or is it in the backend extension files?

Any help would be appreciated.

Gary --Squeak24 (talk) 11:34, 16 March 2018 (UTC)

You have to put in the "field" tag in the form definition - it should work for any textarea input. Yaron Koren (talk) 12:55, 16 March 2018 (UTC)
Brilliant, thank you. --Squeak24 (talk) 13:24, 16 March 2018 (UTC)

Default value in a "datetimepicker' or "datepicker" field[edit]

Hello,
In a previous version of SMW I used default={{#timel: Y/m/d H:i}} in a "datetimepicker" field or default={{#timel: Y/m/d}} in a "datepicker" field.
It seems it doesn't work anymore: the "#time" parser function is not systematically evaluated:
DateTimePickerBug.png
default=now could be a solution but the time value (H:i) is missing...
Megajoule (talk) 08:48, 29 March 2018 (UTC)

Sorry about that - I just checked in what I think is a fix for this. Yaron Koren (talk) 17:04, 6 April 2018 (UTC)
Thank you for your quick reaction. I just tested: it works for a datepicker field but for a datetimepicker field, it is the "now" string that is saved: {{myTemplate | date1 = now | date2 = 2018/04/13}} where date1 is a datepicker field and date 2 is a datetimepicker field. Megajoule (talk) 17:46, 13 April 2018 (UTC)
Are you using the latest version of the code? Yaron Koren (talk) 21:38, 13 April 2018 (UTC)
Yes I am. {{{field|date1|input type=datetimepicker|default=now}}} works well in the form : now is well replaced by the current date and time. But after validating the form, date1=now is saved in the page. Megajoule (talk) 17:51, 14 April 2018 (UTC)
Sorry about that. I neglected to do a full test of my fix. I just checked in a further fix that I think takes care of the issue. Yaron Koren (talk) 02:51, 18 April 2018 (UTC)
Thank you Yaron. Megajoule (talk) 07:11, 18 April 2018 (UTC)

"values from concept" only works if $wgPageFormsUseDisplayTitle=false[edit]

About this topic:
I confirm that "values from concept" doesn't work except if $wgPageFormsUseDisplayTitle is set to false (true by default).
Megajoule (talk) 09:44, 29 March 2018 (UTC)

wpRunQuery=true doesn't work in PF 4.3[edit]

Using MW 1.29, updated PF to 4.3: wpRunquery=true stops working. Query field is correctly set but query isn't run. Back to 4.21, things run as expected. Steph.

Oops - I did change around some variables, forgetting about the "wpRunQuery=true" query string option. I just added a new setting to replace the old one - instead of adding "wpRunQuery=true", you now just need to add "_run" by itself. Sorry about the problem. Yaron Koren (talk) 03:45, 9 April 2018 (UTC)

How to link to form that creates pages in a namespace?[edit]

this is for the sidebar. This is the correct link we need to get to: https://gunretort.xyz/index.php/Form:Retort?namespace=Draft

based on the manual... https://www.mediawiki.org/wiki/Extension:Page_Forms/Linking_to_forms#Using_#forminput

...i tried this on a page: {{#formlink:form=Retort|link text=New Retort|query string="namespace=Draft"}}

which directed to: https://gunretort.xyz/index.php/Special:FormEdit/Retort?%22namespace=Draft%22

which returned a database error. Not even sure i can use curlies in the sidebar.

i tried this in the sidebar: Form:Retort?namespace=Draft|New Retort

but for some reason, it resolves incorrectly to: Form:Retort%3Fnamespace%3DDraft

Temporarily, i put the entire url into the sidebar: https://gunretort.xyz/index.php/Form:Retort?namespace=Draft

but of course that's not the right way to do it. It has 2 issues:

  • if my domain changes (which it might) this will break.
  • if i have my wiki set to open links in new windows (which i do), then this opens in a new window (which it shouldn't)
First of all, it should be "query string=namespace=Draft", not "query string="namespace=Draft" ". But that's not really relevant here, because those instructions are for #forminput; #formlink doesn't have a "namespace" option. Instead, "Draft:" should be added to the page name formula in the form. Yaron Koren (talk) 00:56, 9 April 2018 (UTC)

:JW - Ok, so i think i must put an info tag at the top of the form. Based on the manual, i get something like:

 {{{ info page name=Draft: }}}

Where, in the formula, do you put the User-input? Do i have to make this a field in the Template? -Thx PS- Thx for all your development of incredible mediawiki extensions!

Thanks! Oh, I thought before that you already had a page name formula, given that you were using #formlink. Since you're not, I think you just need to use #forminput instead of #formlink (and get rid of those quotation marks), and the whole thing will work. Yaron Koren (talk) 02:29, 9 April 2018 (UTC)
jw: But i want a link, not an input-box. Isn't #forminput an text-input-box? Are you saying i can put namespace or prefix in the #forminput that's in the form? Or maybe put namespace or prefix in the Save button? -thx
If you want a link, then you definitely need a page name formula. See here for one example of a page name formula in use. Yaron Koren (talk) 03:57, 9 April 2018 (UTC)
jw: hey, my infotag was pretty close. In your example, i see one input on the 1st screen, where the page-name is entered. I'm not seeing how that one input box gets loaded into the page-name. i the magic might happen in PF_Form.php
This works, but not: I made a page called New_Retort. It contains:
{{#forminput:form=Retort|button text=New Retort|query string=namespace=Draft}}
. That works.
Solved! I figured out that your form-wizard makes a form which is self-referential. It puts the form and the forminput which calls that form on the same page. All this time i was trying to create a forminput on another page that points to the form which already contains forminput.
No page name formula needed.
Fyi, if you label a link in your sidebar as "New Page", it will break the sidebar (nothing to do with Extension:Page_Forms).

namespace query parameter doesn't work[edit]

https://mydomain.com/index.php/Form:Retort?namespace=Draft

should create a page in the "Draft" namespace, i think. It doesn't.

any fix?

See above. Yaron Koren (talk) 01:02, 9 April 2018 (UTC)

Embeding Special:RunQuery on a page is generating an error[edit]

MediaWiki 1.30.0
PHP 7.1.8 (apache2handler)
Semantic MediaWiki 2.5.6
Page Forms 4.3 (624f2a9) 18:20, 16 January 2018
{{Special:RunQuery/query form name}}
MediaWiki internal error.
Original exception: [WsznpY93tCo5DbDx4XRdJwAAAAM] 2018-04-10 16:34:45: Fatal exception of type "MWException"
Exception caught inside exception handler.
Set $wgShowExceptionDetails = true; at the bottom of LocalSettings.php to show detailed debugging information.
Upgraded to PageForms 4.3 and get error
[Ws5Q-Z3aU0dVxecP9WjFDAAAAAU] /index.php/LADR_Downloads_and_Statistics TypeError from line 46 of /app/mediawiki/extensions/SemanticMediaWiki/includes/formatters/MessageFormatter.php: Argument 1 passed to SMW\MessageFormatter::__construct() must be an instance of Language, instance of StubUserLang given, called in /app/mediawiki/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php on line 89

Backtrace:

#0 /app/mediawiki/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(89): SMW\MessageFormatter->__construct(StubUserLang)
#1 /app/mediawiki/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(291): SMW\ParserFunctionFactory->newAskParserFunction(Parser)
#2 /app/mediawiki/includes/parser/Parser.php(3383): SMW\ParserFunctionFactory->SMW\{closure}(Parser, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string)
#3 /app/mediawiki/includes/parser/Parser.php(3106): Parser->callParserFunction(PPFrame_DOM, string, array)
#4 /app/mediawiki/includes/parser/Preprocessor_DOM.php(1229): Parser->braceSubstitution(array, PPFrame_DOM)
#5 /app/mediawiki/includes/parser/Parser.php(2921): PPFrame_DOM->expand(DOMElement, integer)
#6 /app/mediawiki/includes/parser/Parser.php(1277): Parser->replaceVariables(string)
#7 /app/mediawiki/includes/parser/Parser.php(451): Parser->internalParse(string)
#8 /app/mediawiki/includes/content/WikitextContent.php(329): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#9 /app/mediawiki/includes/content/AbstractContent.php(516): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#10 /app/mediawiki/includes/poolcounter/PoolWorkArticleView.php(144): AbstractContent->getParserOutput(Title, integer, ParserOptions)
#11 /app/mediawiki/includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()
#12 /app/mediawiki/includes/page/Article.php(585): PoolCounterWork->execute()
#13 /app/mediawiki/includes/actions/ViewAction.php(68): Article->view()
#14 /app/mediawiki/includes/MediaWiki.php(499): ViewAction->show()
#15 /app/mediawiki/includes/MediaWiki.php(293): MediaWiki->performAction(Article, Title)
#16 /app/mediawiki/includes/MediaWiki.php(851): MediaWiki->performRequest()
#17 /app/mediawiki/includes/MediaWiki.php(523): MediaWiki->main()
#18 /app/mediawiki/index.php(43): MediaWiki->run()
#19 {main}

This is still just with the embedded query page -- Legaulph (talk) 18:20, 11 April 2018 (UTC)

Very interesting - that seems like an SMW error. I don't know if I can help with this... Yaron Koren (talk) 18:34, 11 April 2018 (UTC)

What's the index or named-constant for the Form namespace?[edit]

PF_NS_FORM. Yaron Koren (talk) 13:20, 11 April 2018 (UTC)

How to use VE in "free text area" when "edit with forms"[edit]

Hi Yaron,

When using a form to edit a page there is the option of keeping the "free text" area.

How does one get the form edit page to use Visual Editor for the Free Text area?

ty -Rich

There's currently no way to do it, although there might be one coming soon. Yaron Koren (talk) 13:20, 11 April 2018 (UTC)

ok. thanks. Are you following Extension:VEForPageForm? .. any thoughts on weather or not this extension is doing things in a way that Page Forms may someday include? (re: Topic:Ub2nfjjlhm8gfdwq)

Yes - that extension's code would most likely be getting used in one way or another. Yaron Koren (talk) 14:33, 11 April 2018 (UTC)

Bug? Form doesn't like an article-name.[edit]

I've created several pages with my form, no prob. But this particular name returns an error: "All governments are tyrannical by nature. "

= Internal error =
[Ws67PpT2BBCEdzFEIF@mHwAAAVQ] /index.php/Special:FormStart?page_name=All+governments+are+tyrannical+by+nature.+&form=Retort&namespace=Draft Wikimedia\Assert\ParameterAssertionException from line 63 of /home/gunsywtx/public_html/vendor/wikimedia/assert/src/Assert.php: Bad value for parameter $dbkey: invalid DB key 'FormEdit/Retort/Draft:All_governments_are_tyrannical_by_nature._'
Backtrace:
#0 /home/gunsywtx/public_html/includes/title/TitleValue.php(82): Wikimedia\Assert\Assert::parameter(boolean, string, string)
#1 /home/gunsywtx/public_html/includes/specialpage/SpecialPage.php(100): TitleValue->__construct(integer, string, string)
#2 /home/gunsywtx/public_html/includes/specialpage/SpecialPage.php(84): SpecialPage::getTitleValueFor(string, string, string)
#3 /home/gunsywtx/public_html/includes/specialpage/SpecialPage.php(629): SpecialPage::getTitleFor(string, string)
#4 /home/gunsywtx/public_html/extensions/PageForms/specials/PF_FormStart.php(130): SpecialPage->getPageTitle(string)
#5 /home/gunsywtx/public_html/extensions/PageForms/specials/PF_FormStart.php(164): PFFormStart::getFormEditURL(string, string)
#6 /home/gunsywtx/public_html/extensions/PageForms/specials/PF_FormStart.php(81): PFFormStart->doRedirect(string, string, NULL)
#7 /home/gunsywtx/public_html/includes/specialpage/SpecialPage.php(522): PFFormStart->execute(NULL)
#8 /home/gunsywtx/public_html/includes/specialpage/SpecialPageFactory.php(578): SpecialPage->run(NULL)
#9 /home/gunsywtx/public_html/includes/MediaWiki.php(287): SpecialPageFactory::executePath(Title, RequestContext)
#10 /home/gunsywtx/public_html/includes/MediaWiki.php(851): MediaWiki->performRequest()
#11 /home/gunsywtx/public_html/includes/MediaWiki.php(523): MediaWiki->main()
#12 /home/gunsywtx/public_html/index.php(43): MediaWiki->run()
#13 {main}

Solved: Page_Forms doesn't like trailing spaces in article name.

Request: do RTrim and LTrim on the entered name.

Cheers!

Good idea - I added in a fix for this a few days ago. Yaron Koren (talk) 01:56, 16 April 2018 (UTC)
Thx! Github master? Johnywhy (talk) 20:56, 25 April 2018 (UTC)
That would work, although there's also been a new version of Page Forms out in the meantime. Yaron Koren (talk) 21:07, 25 April 2018 (UTC)

147 Lines of Errors when using a form[edit]

Im getting 147 lines of errors when I load a form to edit or save a form. Its the following three errors repeated.

  • PHP Warning: Missing argument 9 for CargoSQLQuery::newFromValues(), called in /wiki/extensions/PageForms/includes/PF_ValuesUtils.php on line 136 and defined in /wiki/extensions/Cargo/includes/CargoSQLQuery.php on line 42
  • PHP Notice: Undefined variable: offsetStr in /wiki/extensions/Cargo/includes/CargoSQLQuery.php on line 47
  • PHP Notice: Undefined variable: offsetStr in /wiki/extensions/Cargo/includes/CargoSQLQuery.php on line 78

--Cody3647 (talk) 15:32, 13 April 2018 (UTC)

Nevermind, not sure if maybe I had mismatched versions but Ive updated both via git and the errors are gone.--Cody3647 (talk) 14:51, 14 April 2018 (UTC)

Accessing data from a field across Page Forms using mysql[edit]

I am trying to access data saved to a specific textarea field across several Page Forms using a mysql call, but I can't seem to find where the Page Forms data is stored in my mysql wiki database. Does anyone know where it is stored? Or, better yet, is there an easier way to pull that data so I can drop it into a javascript-powered (D3.js) chart on a Special page?

The data doesn't get stored anywhere, unless you use either Cargo or Semantic MediaWiki to store it. I would definitely recommend using one of those, if you're not already. Yaron Koren (talk) 12:15, 20 April 2018 (UTC)
That's the info I needed. I'll go with Cargo. Thanks for the assist! Mdav109 (talk) 10:28, 21 April 2018 (UTC)

Format Form Output?[edit]

I'm curious to know how to format the form's output in a wiki page. For example, when the form is filled there are no spaces between the pipe, parameter, and parameter value.

Ex.

{{TestInfobox
|param1=test
|param2=test
|param3=test
|param4=test
|param5=test
}}

How do I format the output so that there are spaces between the pipe, parameter, and value?

Ex.

{{TestInfobox
| param1 = test
| param2 = test
| param3 = test
| param4 = test
| param5 = test
}}

I'm asking because this is the format in which all of my wiki's pages are formatted. Thanks for any help. Monochromatic Bunny (talk) 18:44, 22 April 2018 (UTC)

There's no setting for that; you'd have to do it in the code. If you were going to change the code, this looks like the line that needs to change. Yaron Koren (talk) 01:56, 23 April 2018 (UTC)

Use Form to add to page, without having other templates visible[edit]

Hi, I'd like to have a page "Travels", starting with a form that allows to add basic information about a specific voyage. Following on the same page should be all the entries people made. Can I use {{form:Name}} in a page? How can I make the form only add to a page in the beginning or end, but not edit the whole page? Best regards, Heinrich

There may be a way to do what you're talking about, but I would recommend that each specific voyage get its own page - and then the "Travels" page would just query all those voyages. It makes both editing and display easier, I think. And you can use a popup form within the "Travels" page to create the other pages, so that users don't have to leave that page. Yaron Koren (talk) 18:43, 25 April 2018 (UTC)