Extension talk:InputBox

Jump to: navigation, search

About this board

Edit description

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

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"
Acagastya (talkcontribs)

Is there a way to enable spell check?

Ciencia Al Poder (talkcontribs)

On Firefox, right-click inside the textbox enable spell check (or similar, my language is not english)

Acagastya (talkcontribs)

That is not what I am asking. I don't want a hack for that. Just like how the summary textbox provides spellcheck by default, there should be at least an option to enable spell check that works on various browsers.

Ciencia Al Poder (talkcontribs)

Spell check is specific for each browser. Browsers enable it for default on textarea, and disable it for default on normal textbox (being inputbox of this type). My edit summaries don't have spellcheck, maybe it works for you if you have Visual Editor enabled and it uses a textarea instead of a normal texbox for this. Anyway, I don't know of another way to enable it for inputbox and this extension doesn't provide configuration/parameters to enable it.

Acagastya (talkcontribs)

Visual Editor is disabled in my preferences. But spell check is set to true to the summary textbox.

Ciencia Al Poder (talkcontribs)

Maybe you manually enabled it in the past and the browser remembers that?

Acagastya (talkcontribs)

No, I did not enable it manually. But there might be a way, as a design improvement, to add spell check.

Quiddity (WMF) (talkcontribs)

Suggestion filed as phab:T167195, with a note about how FF doesn't enable it for single-line <input type="text"> by default.

In the meantime, you can do what I did, and enable it at all sites, via instructions in https://superuser.com/a/599303

Reply to "Spell check?"
Ibutakov.smartec (talkcontribs)

is there any way to add button or smth to add namespace for new page from list? Ibutakov.smartec (talk) 16:09, 22 April 2016 (UTC) (talkcontribs)

okay, if someone needs solution i will provide it here:

	 * Generate create page form
	public function getCreateForm() {
		global $wgScript;

		if ( $this->mType == "comment" ) {
			if ( !$this->mButtonLabel ) {
				$this->mButtonLabel = wfMessage( 'inputbox-postcomment' )->text();
		} else {
			if ( !$this->mButtonLabel ) {
				$this->mButtonLabel = wfMessage( 'inputbox-createarticle' )->text();

		$htmlOut = Xml::openElement( 'div',
				'class' => 'mw-inputbox-centered',
				'style' => $this->bgColorStyle(),
		$createBoxParams = array(
			'name' => 'createbox',
			'class' => 'createbox',
			'action' => $wgScript,
			'method' => 'get'
		if ( $this->mID !== '' ) {
			$createBoxParams['id'] = Sanitizer::escapeId( $this->mID );
		$htmlOut .= Xml::openElement( 'form', $createBoxParams );
		$editArgs = $this->getEditActionArgs();
		$htmlOut .= Html::hidden( $editArgs['name'], $editArgs['value'] );
		$htmlOut .= Html::hidden( 'preload', $this->mPreload );
		foreach ( $this->mPreloadparams as $preloadparams ) {
			$htmlOut .= Html::hidden( 'preloadparams[]', $preloadparams );
		$htmlOut .= Html::hidden( 'editintro', $this->mEditIntro );
		$htmlOut .= Html::hidden( 'summary', $this->mSummary );
		$htmlOut .= Html::hidden( 'nosummary', $this->mNosummary );
		$htmlOut .= Html::hidden( 'prefix', $this->mPrefix );
		$htmlOut .= Html::hidden( 'minor', $this->mMinor );
		if ( $this->mType == 'comment' ) {
			$htmlOut .= Html::hidden( 'section', 'new' );

		global $InputBoxNSList;

		$htmlOut .= Xml::openElement( 'select',
				'name' => 'ns',
				'class' => 'mw-ui-input mw-ui-input-inline createboxInput',
		foreach ($InputBoxNSList as $NS) {
			$htmlOut .= Xml::openElement( 'option',
				array('value' => $NS,
			$htmlOut .= $NS;
			$htmlOut .= Xml::closeElement( 'option' );
		$htmlOut .= Xml::closeElement( 'select' );

		$htmlOut .= Xml::openElement( 'input',
				'type' => $this->mHidden ? 'hidden' : 'text',
				'name' => 'title',
				'class' => $this->getLinebreakClasses() .
					'mw-ui-input mw-ui-input-inline createboxInput',
				'value' => $this->mDefaultText,
				'placeholder' => $this->mPlaceholderText,
				'size' => $this->mWidth,
				'dir' => $this->mDir,
		$htmlOut .= $this->mBR;
		$htmlOut .= Xml::openElement( 'input',
				'type' => 'submit',
				'name' => 'create',
				'class' => 'mw-ui-button mw-ui-progressive createboxButton',
				'value' => $this->mButtonLabel
		$htmlOut .= Xml::closeElement( 'form' );
		$htmlOut .= Xml::closeElement( 'div' );

		// Return HTML
		return $htmlOut;
	public static function onMediaWikiPerformAction(
	) {
		if( $wiki->getAction( $request ) !== 'edit' ){
			# not our problem
			return true;
		if( $request->getText( 'prefix', '' ) === '' && $request->getText( 'ns', '' ) === ''){
			# Fine
			return true;

		$params = $request->getValues();

		$title = $params['prefix'];
		if ($request->getText( 'ns', '' ) != ''){
			if ( $params['ns'] !='(main)') { $title .= $params['ns'] . ':'; }
		if ( isset( $params['title'] ) ) {
			$title .= $params['title'];
		unset( $params['ns'] );
		unset( $params['prefix'] );
		$params['title'] = $title;

		global $wgScript;
		$output->redirect( wfAppendQuery( $wgScript, $params ), '301' );
		return false;
Reply to "Namespaces for create form"

How can I allow a user to search by pageid?

Stevenpcox (talkcontribs)

I would like users to be able to look up an article based on pageid.

Using ?curid=PAGEID I can add the pageid to a url and go directly to the page. I would like to have a search function where the user input the pageid into a field, mediawiki appends the URL and the desired page opens up.

This should be easy. The only thing I cannot figure out is how to have the user type the pageid into a field and hit enter. From there I can turn it into a variable and inject it into the URL.

Reply to "How can I allow a user to search by pageid?"
Cpiral (talkcontribs)

The namespaces parameter doesn't take the space character. So there's no searching talk namespaces. Quoting or underscoring fails to help. This is an 8 yr old problem?

Please accept the namespace numbers directly that are output the URL. Please accept namespace aliases. Please ignore capitalization. Please ignore whitespace between the field separator. Thanks a lot.

Reply to "Namespaces parameter still broken"

Open created page in new tab. Not in current.

Aka sektor (talkcontribs)

How do I get by clicking on the button creation page, go to the new tab and does not remain in the current? What is correct in extension code, if in no other way?


Как сделать, чтобы по нажатию на кнопку создания страницы, переходило в новую вкладку, а не оставалась в текущей? Что поправить в коде расширения, если по-другому нельзя?

Ciencia Al Poder (talkcontribs)

Add this JavaScript code to your wiki:

// Create page form: open on new window
  $('form.createbox').attr('target', '_blank');
Aka sektor (talkcontribs)

Thank you very much. Work fine.

Dturtill (talkcontribs)

Is there any way that this can be used to create a subpage of the page the button is on, please.

Eg if the button was on a page called January the create button would create a subpage called January/whatever the title was entered

Ciencia Al Poder (talkcontribs)

Yes. Add: