Extension talk:Page Forms/Archive October to December 2008
This page is an archive. Do not edit the contents of this page. Please direct any additional comments to the current talk page. |
Using query results as links
I'm using an inline query ({{#ask:}}) with a custom template to display results on a page, however when I include the page title in the template to create an automatic link to that page, it looks really messy as the page names are all of the form "event_<12 digit timestamp>".
Is there any way to rewrite the link name, as using the syntax [[{{{page_title}}}|More info here]] fails.
Ideally I'd use the html <a href="{{{page_title}}}">More info here</a>, however this also fails due to the {{{page_title}}} element.
Any ideas - everything I've tried so far has failed?
- Hi, I believe this is a Semantic MediaWiki, as opposed to Semantic Forms, question. However, I think I know what's causing the problem - try using "[[{{{page_title}}}|More info here]]" again, but add "|link=none" to the #ask query. Yaron Koren 16:32, 15 October 2008 (UTC)
- Thanks Yaron, your suggestion made it work perfectly!
Problem when editing a field that contains a template with parameters
Hello ! My situation is that I defined a form to edit some simple sheets that have a name, date and description fields, the latter being a textarea in the form. In the description field I have a template applied to format some words. Typically the desc field will get that kind of value:
[[Image:test.jpg|200px]] blahblahblah {{Format|[[word]]}} blabhlahblah {{Format|word}} blabhlahblah
The Format temaplate will just change the size of these word and put them in bold+italic That kind of value is accepted without any problems by the form, but when I try to make an edit using the form, the description field gets truncated at the first semi colon character from a template that way (not truncated for the image)
[[Image:test.jpg|200px]] blahblahblah {{Format
Any idea for a workaround about that ?
- Hi, this should have been fixed a few weeks ago. Are you using the latest version of Semantic Forms? Yaron Koren 15:11, 19 October 2008 (UTC)
- Hi, I used the version from semantic_forms_1.3.4.zip , is there a more recent one ?
- Ah, it looks like you've found a bug in parsing, then. You could always move that description stuff into the free text, which would solve that problem. Yaron Koren 13:20, 20 October 2008 (UTC)
- Well that's not the ideal solution because I have different fields that fill different part of a template, so I think I'll create pages with the form and make subsequent edits with the normal edit tab so that everything is clean when a new version of SemanticForms comes out :)
"has alternate form" redlinks when using log format URL's (index.php?title=)
I'm using the "has default form" and "has alternate form" functionality on property pages so that users are presented with a choice when they click a redlink that is the object of particular properties. When I'm using multiple values, it produces redlinks that point here:
/index.php?title=Special:AddData/Person/John_Citizen?alt_form[0]=Role&alt_form[1]=Committee
... which causes an error because I'm not using short url's, and so there are two question marks. Anyone know a way around this? It's not an option for me to use the shortned URL format. - Borofkin 05:59, 20 October 2008 (UTC)
- You've found a bug in SF; this will be fixed in the next version. For now, you can fix it yourself by changing, in the file /includes/SF_GlobalFunctions.php, the line
$add_data_url .= ($i == 0) ? "?" : "&";
to
$add_data_url .= (strpos($add_data_url, "?")) ? "&" : "?";
Yaron Koren 23:48, 20 October 2008 (UTC)
- Thanks very much Yaron -- this has solved my problem. - Borofkin 00:01, 23 October 2008 (UTC)
Turning on 'nowiki' for form input
When setting up a wiki, where the standard user input is via a form, I can get some unfortunate results when a user enters text in a box that is then interpreted as wiki-text which the user didn't want. I wonder can we turn on 'nowiki' for the text taken from text-boxes in forms? For example, if we have have parameter x and the user enters '|x=' in a text box, then x will accidentally be set.
Pnelnik 10:47, 20 October 2008 (UTC)
- Unfortunately, I think that would cause more problems than it would fix. I guess tell your users to not enter pipe characters ('|') haphazardly into form fields. Yaron Koren 13:22, 20 October 2008 (UTC)
Having a Cancel button, rather than a link (making forms look neater)
I see that we have a link cancel at the bottom of the form. It sits beside three buttons Save Page, Show Preview andShow Changes. I wonder would it be tidier to have a Cancel button, just like it's neighbours, rather than just a link?
See for example see the Joe the plumber form
Pnelnik 20:04, 20 October 2008 (UTC)
Though looking at this issue some more, it seems that the buttons and the cancel link are not specific to sematic forms, but rather are inherited from the standard mediawiki edit pages.
Pnelnik 20:34, 20 October 2008 (UTC)
Any way to style mandatory fields ?
I don't know if it is something that was overlooked so far, but since there is a 'flag' to force mandatory fields on forms, I would expect to see them identified as such.
Did I miss this feature ?
Would it be possible to give these fields a special CSS class or ID so we could style them differently ? or maybe would you consider adding a mark or an icon next to fields that are mandatory ?
- Laurent Alquier
- Hi, this already is done, though it's not well-documented: every mandatory field belongs to the "mandatoryField" CSS class. Yaron Koren 21:15, 21 October 2008 (UTC)
- Thanks. I was able to change the style of mandatory fields. - Laurent
Dropdown doesn't autopopulate when editing a page
Question. Great extension by the way, but I'm having issues with the drop down box. Basically, all inputs on a form auto populate based on what is already on the page. For some reason, dropdown doesn't do this.
For example, if I have a template with parameters A, B and C. If A and B are text boxes, and C is a dropdown. On the form, I put in values for A, B and C. If I then Edit using form, based on what I just made, it seems to erase entered C and makes it blank again, but A and B retain their values.
- Hm. It shouldn't be doing that, although sometimes browsers cache the value of dropdowns. If you hit shift-reload on the form page, is the problem still there? Yaron Koren 05:24, 26 October 2008 (UTC)
- Yes it is. It looks like the only forms affected by the glitch are ones which are used in expressions. For example, in textbox "D" lets say, the user can use a template which will do math for him ( {{{Skill|skillname=|skill level=}}} ). This is one of the two forms which are not auto populating. The other is a dropdown box which is used in a switch expression (Textbox c is feat1. feat1 becomes {{{#switch:Feat1}}} when used in the template, followed by a series of expressions.
- Does the value in the template definitely match, character for character, the value in the dropdown? Yaron Koren 17:57, 26 October 2008 (UTC)
- Character for Character, its an exact match, even the spacing and capitalization. I even tried removing the expression and seeing if it would even keep the value just passed normally to the template. No go
- I don't quite understand - in that last test you tried, what was the difference between values "C" and "D"? Yaron Koren 02:03, 27 October 2008 (UTC)
Extending forms to be used with queries
It seems that the forms can very nearly be used as query forms. For example see query forms example. But they still need a little work, see discussion details
Pnelnik 13:29, 29 October 2008 (UTC)
- This is a nice idea, though it's currently impossible, because the preview page is out of the control of SF. It's planned to make preview part of SF (see here), and if/when that's done this could be an interesting feature to look into. Yaron Koren 16:35, 29 October 2008 (UTC)
- An alternative would be to have a button that does almost exactly the same as the 'Save Page' button, but instead it saves to say a page QueryResult:<query_id>, where the query_id is uniquely generated for each query. Then the query result pages would then need to be frequently purged. We would also need the permissions set so that everyone would be able to run a query without having to log-in or do a CAPTCHA. Pnelnik 17:53, 29 October 2008 (UTC)
red links
I followed the instructions on the example page and every time I create a book, the author's red link points to a usual edit page instead of to Special:AddData. After editing the book's page with no changes and save it, it works properly. Is there a practical solution to this on MW 1.13? Thanks, Alain.
- Hi, what versions of SF and SMW are you using? Yaron Koren 13:31, 6 November 2008 (UTC)
- Hi, I'm using SF version 1.3.5 with SMW 1.3. Thanks, Alain
- Oh, okay - I didn't really read your question before. This problem is mentioned at the end of the 'red links' section of the documentation; currently the only solution is to disable caching on the wiki. Yaron Koren 14:57, 6 November 2008 (UTC)
- Hi, I completely missed that section for some odd reason. Works now, thanks. Alain
Hi I too have a problem with red links. I'm using MW 1.12.0, SMW 1.4.1 and I'm trying to get Semantic Forms 1.4 to work. If I use the redlink code I get a message saying sffadddatalink() not defined. If I remove the code, then the redlinks don't work. Suggestions? Thanks, bluethorn
- Oh, oops, I renamed sffAddDataLink() to SFLinkUtils::addDataLink() without changing that patch code. I just updated it, so please try out the new version of the patch and let me know if you still encounter any problems. Yaron Koren 06:15, 2 January 2009 (UTC)
- It works! The upgrade is awesome. Thanks. Bluethorn 20:17, 2 January 2009 (UTC)
Current URL
How to get the 'Current URL' of the page, just like 'current user' in the semantic forms?
- What would you need that for? Yaron Koren 13:29, 26 November 2008 (UTC)
- I am creating a semantic form for bookmarks, so I want to get the page URL automatically
- So I assume you're planning to have the name of each page be the URL itself? That could be awkward... but in any case, even if you do that, the user shouldn't need to enter it twice - you could have the URL retrieved by the template itself, using the {{PAGENAME}} call. Yaron Koren 17:20, 26 November 2008 (UTC)
- Thank you, Yaron
- So I assume you're planning to have the name of each page be the URL itself? That could be awkward... but in any case, even if you do that, the user shouldn't need to enter it twice - you could have the URL retrieved by the template itself, using the {{PAGENAME}} call. Yaron Koren 17:20, 26 November 2008 (UTC)
Is it possible to have a multivalue field that has carriage returns?
I can't seem to get this to work with the forms but I have built templates that use this format. Any help would be great.
- Ex
-
- Template
{| class="wikitable" ! Parent | [[Name::{{{Name|}}}]] |- ! Childern | {{#arraymap:{{{Childern|}}}|,|*|[[Childern::x]]}} |}
- Example Page
{{Parent |Name=My Name |Childern= *My first child *My second child }}
- Someone else asked about this recently - I don't think it's possible now, but maybe it should be, using "\n". I'll look into this. By the way, it's spelled "children". Yaron Koren 16:41, 12 December 2008 (UTC)
- arraymap contains as last param a NEW delimiter, so you can input with "," and displayed with linebreak
Problem with Input Type Date
A strange error occurs in context with the Type:Date. I am using a semantic form with the field input type date. In most cases the date is not understood. (e.g.: The date "2009/03/01" was not understood or "2008/01/31".) It seems that only the months october, november, december works fine and all other dates were not understood correctly. (Using SemanticForms 1.3.9 and SemanticMediawiki 1.4) JMK 13:44, 15 December 2008 (UTC)
- Hi, I can see what the problem might be (bad parsing of the leading zero), although I can't reproduce it, which makes it hard to fix. This wouldn't be a public wiki, would it? Yaron Koren 16:01, 15 December 2008 (UTC)
- Unfortunatly the wiki isn't public :( (I also recognized the leading zero problem earlier, because all date inputs like 2008/12/01 rechanges in the form into [1] [December] [2008] - with a missing leading zero. Might that be the reason for the twodigit months not getting affected?) JMK 16:41, 15 December 2008 (UTC)
- Maybe, who knows - I just know that it hasn't happened for me. Could you maybe try to duplicate the problem on http://scratchpad.referata.com? Yaron Koren 19:30, 15 December 2008 (UTC)
- I have rebuild an Example from our wiki and found out that Referata uses the parameter "wgAmericanDates = true;". I added it to our LocalSettings.php and it seems to solve the problem. The error is maybe somewhere in the default date print out: Year/Month/Day. JMK 19:58, 15 December 2008 (UTC)
- Hi, that's certainly odd; I changed the data in your test page to the Y/M/D format, but I still couldn't reproduce the problem; and date parsing is the same regardless of whether or not $wgAmericanDates is set... anyway, I'm glad it worked. Yaron Koren 20:24, 15 December 2008 (UTC)
- Weird, but thanks for your efforts. JMK 20:29, 15 December 2008 (UTC)JMK
- Semantic Mediawiki Update 1.4.1 solves the problem. JMK 09:34, 17 December 2008 (UTC)
- Ah, that explains it. Cool. Yaron Koren 14:59, 17 December 2008 (UTC)
Multiple Values in Ask Statements
You have an awesome extension here. And you've answered a couple of my other questions excellently, thank you. I have a property "Topic" that can ahve multiple values, and it works perfectly. The problem is that I also call up pages automatically that share the same value for "Topic" as the current page. Again, this works great when there is only one value, but when there are multiple values the ask statement needs all values to be met before it pulls up a page. Is there a way that I can have the ask statement pull up a page that matches any of the values on the page instead of having to match all of them? Thanks --67.42.49.34 06:02, 20 December 2008 (UTC)
- Sorry, I don't understand. Is this a Semantic Forms question? Yaron Koren 22:06, 20 December 2008 (UTC)
- Technically, the part I am having problems with is in Semantic, but I posted here because it only comes up using the advice on this page for how to enter multipls values for a single property in a form. I have people fill out the property "topic" with multiple values like so: {{#arraymap:{{{topic|}}}|,|x|[[Topic::x]]}} That works great. But on the same template I also have an ask question that uses "Topic"
{{#ask: | [[Category:Experiential Learning]] | [[Topic::{{{topic}}}]] | default=No Experiential Learning Ideas use this topic yet. | ?The Point }}
This works great, but if I have two values for "topic" (ie Teamwork, Trust) then only those things that have "Teamwork, Trust" as their topic get pulled up. My question is there a way I can rephrase my ask question so that I can have the ask question pull up any of the values for "Topic" (ie Teamwork OR trust) instead of needing both? I hope that makes more sense.
- Ah - I think you can embed the #ask statement within the #arraymap statement, or the other way around, to get it to work. If you still can't figure it out, I'd suggest writing the SMW users mailing list. Yaron Koren 00:20, 21 December 2008 (UTC)
Chooser
After some work, I got the chooser function to work in one of my template, viewable here. The dropdown works great, but for every template in the dropdown, there is also a button for "add another" down below. Is this normal, or is there a way I can remove the "add another" buttons because they are really odd. Thank you very much, and I do apologize for all the questions. --67.42.49.34 20:04, 20 December 2008 (UTC)
- No, there's no way - this would require a "limit=" parameter for template declarations, which hasn't been implemented. Yaron Koren 22:06, 20 December 2008 (UTC)
Autocompletion data corruption warning
The autocompletion feature does not guarantee that the autocompleted text is identical to the value of the parameter it is expanding. In fact, it is quite buggy, as you can see in this screenshot. I contacted the author but he was unconcerned. If your data is important I don't suggest using autocompletion. --Alterego 03:05, 22 December 2008 (UTC)
- Hi - I was "unconcerned" because, as you stated, the bug was a result of a patch you created; unless I'm missing something. Yaron Koren 04:28, 22 December 2008 (UTC)