Extension talk:InputBox

Jump to: navigation, search

About this board

For the page history, see also here. / previous talk on this page

By clicking "Add topic", you agree to our Terms of Use and agree to irrevocably release your text under the CC BY-SA 3.0 License and GFDL
Evolution and evolvability (talkcontribs)

Is there any way to implement an option to choose between basepage prefixes in the same way that |namespaces= can search a specific namespace?

I would like to be able use the |type=create option with a preset list of prefixes, e.g.:

type = create
prefixes = Option1/**, Option2/, Option3/

For context, I'm looking to include on v:WikiJournal_Preprints the following:

type        = create
buttonlabel = Create pre-print
placeholder = Pre-print title
prefixes      = WikiJournal of Medicine/**, WikiJournal of Science/, WikiJournal of Humanities/, WikiJournal of Extra/
break       = no
preload     = WikiJournal_Preprints/preload_draft

Would that be something possible to implement?

Reply to "Multiple basepage prefix option?"

Search for articles that start with a string.

Marianian (talkcontribs)


How do I configure InputBox to search for articles that begin with a specific string in the main namespace, such as "NationStates Issue No. " (with a trailing space)?

Best, Marianian

Quiddity (WMF) (talkcontribs)

Are you trying to setup either:

  • Just pre-made searches for a specific string?
    • this is what you describe above. It would be easiest to just give plain search links, e.g. example search.)
  • An inputbox that enables users to add text to the pre-made search string?
Marianian (talkcontribs)


A NSindex (NSindex.net) user recently suggested to me that I find a way to bring up articles for any given issue just by typing a three digit issue number.

Articles for each issue follow the format "NationStates Issue No. [number]", e.g. "NationStates Issue No. 100" for the article about the 100th issue on NationStates.

The idea that I am trying to achieve is that, for example, when someone types "100" and clicks "search" or something, the article "NationStates Issue No. 100" automatically comes up. It’s like "I feel lucky" except with wiki articles on NSindex.

Best, Marianian

Reply to "Search for articles that start with a string."
Crysis19 (talkcontribs)

I'm not sure why but using InputBox is breaking things. I didn't realize it until I go to create a Subpage and see how broken it is.

A simple Inputbox, using preload=Template:Characters creates the page Tester. On this page is a slash-removal link to a subpage History.

The goal is when viewing the page Tester, the link will read as History, and take you to Tester/History when clicked.

What happens instead is the link takes you to /History instead. Which is a subpage of nothing. If you try going to Tester/History through the browser address bar, and put PARENTPAGE on that afterwards, it gives you TEMPLATE:PARENTPAGE as a result.

Does anyone know how to fix this? Or will I have to go back to creating pages with the subst template feature instead?

Crysis19 (talkcontribs)

Actually, more testing seems to make this a flaw in MediaWiki itself.

As I just created a page "Tester2" with subst:Template:Characters in it. And now it's being seen as a template page instead of it's own page. Because the subpage links do not work, and it's parent is Template:ParentPage.

So I'm not sure what is wrong. It seems like something is royally screwing up my MW installation.

Because going directly to a page named "Jason", creating it, typing in for a link to a subpage named History, and previewing it, and it doesn't work right.

Reply to "Pages Created are Broken"

Several input boxes forms a name for an artilce

Fokebox (talkcontribs)

Could someone let me know if it is possible to make that several input boxes forms a name for an artilce? Example: First input box has name of the book, second author of the book and result is "Name of the book - Name of the author"

Quiddity (WMF) (talkcontribs)

Hi Fokebox. Please could you give us more details about "the problem you are trying to solve"? What you have given above is "the solution you think might work", which doesn't help us understand alternative ways we might be able to help you. Thanks!H

Fokebox (talkcontribs)

So I would like to have for example two boxes. I want to fill author name to the first one and book name to the second one and after pressing button create page I want to have a result Author Name - Book Name

Quiddity (WMF) (talkcontribs)

Ah, I think I understand. It is not possible to have two separate textfields that automatically combine using this.

What you could do instead, is use the "placeholder" parameter to give the editor a hint about the preferred title convention. E.g.

 placeholder=Author Name - Book Name
 buttonlabel= &nbsp;                     foo                    &nbsp;

which results in

Hope that helps.

Fokebox (talkcontribs)

Thank you! I did so, but I wanted two separate boxes ) one for Author another for Book ) ... any way it also fine for me

Fokebox (talkcontribs)

I have one more question - How can I set button width?

Quiddity (WMF) (talkcontribs)

I've added a hacky example to my demo above. Please don't overuse it!

Fokebox (talkcontribs)

I did so before your example ) I thought there is a set for button width just like for input itself )

Reply to "Several input boxes forms a name for an artilce" (talkcontribs)

Is there a way to add the ajax search suggestion to an inputbox? Thanks

Stefahn (talkcontribs)

I would like to know this too.
In my eyes the search is no fun if there's no autocompletion / suggestions...

Emijrp (talkcontribs)

I have found a hack to add ajax suggestions to any inputbox. You must add the following code to your MediaWiki:Common.js, and refresh browser cache.

document.getElementById('searchform').action = '/w/index.php';
document.getElementsByName('search')[0].id = 'searchInput';
Nicolas NALLET (talkcontribs)

This hack could drive an server error if don't replace by your article path which could be : wiki or w or index.php or anything else you have configurerd.

In the example above the article path is just w

Reply to "Add SearchSuggest to inputbox?"
Aka sektor (talkcontribs)

I solved issue with opening creation page in a new tab: Topic:Tgoy9eqm9yhkl8ec

However, now there is another. How to make it so that the form is cleaned?

It turns out that a new tab is opened, and the text in the form remains on the previous one.


Решил вопрос c открытием в новой вкладке: Topic:Tgoy9eqm9yhkl8ec

Однако теперь есть другой. Как сделать так, чтобы форма при этом очищалась? Получается, что открывается новая вкладка, а на предыдущей остается текст в форме.

Reply to "Text remains in the form"

How to avoid the namespace selection box?

Kghbln (talkcontribs)

When using type "search" or "fulltext" one gets the namespace selection box like e.g. here. However if I click on "Content pages" shortcut at the top of the box like e.g. there the namespace selection box is hidden.

To cut it short: How do I direct the search to e.g. the Content namespaces. I am asking because on a mobile skin we get about 15 to 20 cm of box shown before any possible result which is just overdoing things.

Quiddity (WMF) (talkcontribs)

This seems to be impossible, at the moment. (To use specific keywords: You're asking for a way to make any searches (not just through the InputBox extension) send you to the "Content" tab (&profile=default) instead of the "Advanced" tab (&profile=advanced)

The tab you end up on, is based on whether we individually (as logged-in users), have ever selected the checkbox "Remember selection for future searches" in the "Advanced" search tab. -- You can confirm this by doing a test search in a Private/Incognito window.

I've filed phab:T170011 with the request for a method to reset it. (I believe it might still be possible by resetting all user-preferences. But that's obviously not optimal.)


Semi-related: There's ongoing work at m:WMDE Technical Wishes/AdvancedSearch to rethink the Advanced Search - both making it clearer, and making more of the advanced functionality easier to use. I'll send a note to one of the people working on it, with your points, and ask if there are separate mockups for the mobile UI, yet. Thanks!

Kghbln (talkcontribs)

Thanks a lot for your extensive reply which is as much appreciated as creating the task on phabricator as well as making discovery/wmde aware of the need for a mobile specific path.

Indeed if you are not logged in the namespace selection box is not shown. However if you are logged in the namespace selection box is shown even if you did not check "Remember selection for future search"

I kinda expected that it is currently not possible to do this. As a first step it will probably by nice if the namespace selection box may be toggled with a collapsed view by default.

Reply to "How to avoid the namespace selection box?"
C Wagner (talkcontribs)

Is there a way to get focus on InputBox?

Quiddity (WMF) (talkcontribs)

I don't think there is (certainly not documented).

There is a semi-related FAQ at w:en:Wikipedia:FAQ/Main_Page#Why doesn't the cursor appear in the search box, like with Google? which might help explain why that isn't a standard feature. I'm not a developer, but the code in w:en:MediaWiki:Gadget-searchFocus.js might be adaptable to that use, if you absolutely must have that functionality somewhere?

Hope that helps.

Reply to "autofocus"
Loman87 (talkcontribs)

Hi everybody, I want to use the parameter 'prefix=' in my InputBox 'type=fulltext' to limit search within a specific category. I use CirrusSearch as search engine, so it supports queries like 'incategory:[CategoryName]'. So in my Inputbox I would use something like 'prefix=incategory:[CategoryName]'. I tried but in the query results I see it has been searched something like '[wordQueried] prefix:incategory:[CategoryName]'.

I have read in InputBox documentation that this feature was supported just by Lucene; is there any chance to see it working also with other search engines? I think it could be an intersting upgrade for InputBox users. Thanks for your help! Lorenzo

Quiddity (WMF) (talkcontribs)

Hi. The "prefix" parameter is just for finding "pages that start with a specific string their name", so won't work for your purpose here.

I think the "default" parameter might be the closest to what you want. Your users will need to (1) Leave the 'default' as it appears, and (2) add a space after the default. But it will work, as long as you use underscores for multi-word category names. E.g. see this revision. Hope that helps.

Loman87 (talkcontribs)

Hi, thanks for your answer. Yes, the other option is to use the parameter 'default' but I don't like it very much. Is it possible to add this feature for future updates? Thanks, Lorenzo

Quiddity (WMF) (talkcontribs)

I've added a comment at the existing feature-request, Phab:T147951. I'm not sure if any developers are actively working on this extension currently, so patches welcome if you know how to code! Otherwise, it may take a long time.

Loman87 (talkcontribs)

Thanks very much! Unfortunately I am not an actual developer, however I am going to study the source to understand what could be done. Bye!

Quiddity (WMF) (talkcontribs)

This is now possible! documentation update, or example:

Loman87 (talkcontribs)

Thanks for the update! This works just for the Mediawiki 1.28 release?

Quiddity (WMF) (talkcontribs)

Sadly not. This is for the 1.30+ update only, per the documentation diff link.

Reply to "Paramater prefix doesn't work"
Waschl87 (talkcontribs)

In my wiki people create category pages with the input box and some preloaded content. Clicking on the "Create Page" requires my users to save the previewed page. As they do not have to change anything in the new page's content, this is annoying and many of my users don't really get what is going on. Is there any way to skip the preview step and automatically generate the page with the given name and preloaded content?

Quiddity (WMF) (talkcontribs)

There is not a way to do that, using this extension. However you could use the "editintro=" parameter to add a high-visibility message at the top (for example, using "template:welcome" as the editintro value).

Waschl87 (talkcontribs)

Thanks for your reply. Yes I already use the editintro=, but still some of my users get confused. Are you aware of any other extension or workaround which may help?

Quiddity (WMF) (talkcontribs)

Nothing that I know of, I'm afraid.

Waschl87 (talkcontribs)

OK, thanks anyway @Quiddity (WMF)

Reply to "Directly create page without preview"