Extension talk:Semantic Forms Inputs

About this board

User input validation on Form

1 (talkcontribs)

Is it possible to do user input validation using a Form? E.g. if the property is a simple string, I want to ensure a user enters a string, otherwise prompt an error e.g. "Please enter some value".

I attempted to some basic validation using regexp input type but this wont work for other scenarios such as using a listbox or dropbox value.

Any suggestions?

Reply to "User input validation on Form"

Open tasks on phabricator

Kghbln (talkcontribs)

@F.trott There are some tasks still open on Phabricator. I guess it will be best to reassign them to the Page Forms extension if applicable or decline them.

I am going to archive the extension's page since it make not much sense to have it because MW 1.23 is not de facto out of support.

F.trott (talkcontribs)

Agreed. I'll look through the issues and re-assign or close them.

F.trott (talkcontribs)

Ok, done.

@Yaron Koren, these are all from when we still used Bugzilla. Feel free to ignore.

Yaron Koren (talkcontribs)

@F.trott - thanks. Who knows, maybe one or more of them are still an actual bug.

Reply to "Open tasks on phabricator"

Call to a member function registerInputType() on null

Summary by Kghbln

Semantic Forms Inputs was completely obsoleted with version 3.7 of Semantic Forms.

RacingRalf (talkcontribs)

After updating SemanticForms from 3.6 to 3.7 I get the following error:

PHP Fatal error:  Call to a member function registerInputType() on null in /srv/www/extensions/SemanticFormsInputs/SemanticFormsInputs.php on line 131

MW: 1.27.1

SFI: master

F.trott (talkcontribs)

SFI was discontinued and the most important inputs merged with SF 3.4.3.

RacingRalf (talkcontribs)

Ah, hehe, ok.

Maybe mention this somewhere?


F.trott (talkcontribs)

Just done on the extension page. :)

Kghbln (talkcontribs)

I made this even more obvious and added explicit version information. I hope this is ok.

Kghbln (talkcontribs)

I must add that I do not get the described issue with SF 3.7 however I now get it with PF 4.0 - still the conclusion remains the same.

regexp input type is not working

Summary by F.trott

Regexp was fixed and transferred to SemanticForms 3.4.3. It was removed from SFI 0.10.

Ace.philscan (talkcontribs)

The regexp input type show here Extension:Semantic Forms Inputs#Regular expression filter is not working.

Attached is the error that I encountered when trying to save '0' integer

And the error message above can't be removed since the form cannot be resubmitted when the 'Save page' is click.

Here's the field definition:

{{{field|dividend_most_recent|placeholder=Most Recent|input type=regexp|regexp=/^\d*$/|message=Please enter decimal/numbers!|base type=regexp|base prefix=filter2|filter2.regexp=/^.{0,10}$/|filter2.message=Please enter only up to 10 digits!|filter2.base type=regexp}}}

Please help

Jongfeli (talkcontribs)

This has been reported a while back, see: T97023. Wich version of MW are you using?

Ace.philscan (talkcontribs)
Ace.philscan (talkcontribs)

Also the Semantic Versions, thanks.

Installed extensions

Kc5vcx (talkcontribs)

regex input type seems broken in MW 1.26.0 too, doesn't do any checking.

Oetterer (talkcontribs)

For me (on mw 1.25.5), it works if I omit the enclosing slashes. So instead of writing

{{{field|foo|input type=regexp|regexp=/^[0-9A-Za-z ]+$/}}}

I use

{{{field|foo|input type=regexp|regexp=^[0-9A-Za-z ]+$}}}
F.trott (talkcontribs)

Regexp was fixed and transferred to SemanticForms 3.4.3. It was removed from SFI 0.10.

Ace.philscan (talkcontribs)

Thank you. It works :)..

Ubuntu SWM Semantic Form date picker error: jquery.ui.position: Error Module jquery.ui.position has failed dependencies

Fustbariclation (talkcontribs)

I'm having a problem with date picker in a Semantic Form. I'm getting this error message:

jquery.ui.position: Error Module jquery.ui.position has failed dependencies

I've tried to find a solution, but, so far, no luck. Any suggestions?

Ubuntu: 3.16.0-31-generic #43-Ubuntu SMP Tue Mar 10 17:37:36 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

MediaWiki Versions look OK - all current.

F.trott (talkcontribs)

No idea. Maybe you could try to set debug=true in the URL and then find the actual trigger of the error using Firebug or the like.

Some thing (talkcontribs)

this is an option in creating a form, though the value is not rendered as a text field in any form i have created. the markup appears instead. was this ever a viable option?

I wish to use SematicForms to select from a group of categories, and add the category to the page.


Yaron Koren (talkcontribs)

"category" comes from Semantic Forms, not Semantic Forms Inputs - you should ask about it on the SF talk page.

datepicker doesn't render a popup calender, renders a basic input field

UlaniBlue (talkcontribs)

Using input type=datepicker on a form to render a popup calendar results and a plain text field is rendered.



SemanticForms: 3.4.2-alpha

SemanticFormsInputs: 0.10.1

Am I missing something in my setup?

F.trott (talkcontribs)

Datepicker is now part of SemanticForms, so no need for SemanticFormsInputs anymore (unless you have other inputs from SFI). Anyway, if you have pulled the latest SemanticForms it should work. Do you get any JavaScript errors? Are other inputs using JS working? Is your wiki public?

UlaniBlue (talkcontribs)


As far as I can tell, I have the latest versions of the extensions installed.

The date time input works, just not datepicker.

Yes, it's public. You can see the problem here http://lnk2.biz/1Xqt2VT

I'm a little perplexed.

F.trott (talkcontribs)

Hmm, I do not have a login, so cannot edit. Anyway, it works for me with the latest SF (which is 3.4.3-alpha) and SFI (0.10.1). There were some issues fixed in SF 3.4.3-alpha, so there is a good chance that upgrading it will fix the problem.

Legaulph (talkcontribs)
MediaWiki 1.26.2

Semantic Forms 3.6-alpha

Semantic MediaWiki 2.3.1
Semantic Forms Inputs 0.10.0

I updated to the latest release of Semantic Forms and Semantic Forms Inputs.

I’m using |{{{field|cat|input type=categories|top category=category|hideroot}}}

It used to give me a list of categories with checkboxes for each category, now it creates a bulleted list.

Is there another way of getting the checkboxes back?

F.trott (talkcontribs)

Input type Category is not part of SFI. (talkcontribs)

Because datepicker is moved to Semantic Forms, date time picker (SFI_DateTimePicker.php) can no longer call SFIDatePicker

F.trott (talkcontribs)

Normally this should not be a problem. The class is still available. Did you update SemanticForms? (talkcontribs)

Yes both SemanticForms and SemanticFormInputs are updated via git clone.

However command "grep -r SFIDatePicker ." under both SemanticForms and SemanticFormInputs directories return only calls to the class in SFI_DateTimePicker.php, no class definition.

[root@server1 extensions]# git clone https://git.wikimedia.org/git/mediawiki/extensions/SemanticForms.git

[root@server1 extensions]# git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticFormsInputs.git

[root@server1 extensions]# grep -r SFIDatePicker .

./SemanticFormsInputs/includes/SFI_DateTimePicker.php:          $this->mDatePicker = new SFIDatePicker( $this->mInputNumber . '_dp', $dateString, $this->mInputName, $this->mIsDisabled, $this->mOtherArgs );

./SemanticFormsInputs/includes/SFI_DateTimePicker.php:                  SFIDatePicker::getParameters(),

[root@server1 extensions]#

F.trott (talkcontribs)

You are right. The class was renamed SFDatePicker when it was moved to SF.

F.trott (talkcontribs)

In fact the new name is SFDatePickerInput.

I just fixed it. (talkcontribs)

Thank you.

I thinks it is "SFDatePickerInput".

Also after replacing SFIDatePicker with SFDatePickerInput in SFI_DateTimePicker.php, the form starts to render without any fatal php errors, but now pickers wont work and there is a javascript error, something to do with "window.SFI_DTP_init" (I am not good with javascript). Only 2 text input fields appear on the form.

Also there is a php notice now:

PHP Notice:  Undefined property: SFISettings::$datePickerDisableInputField

F.trott (talkcontribs)

I'll look at it tomorrow.

F.trott (talkcontribs)

I put in a fix that unbroke it for me. Could you give it a try? (talkcontribs)

It works.

Thank you

Use of wfMsg was deprecated in MediaWiki 1.21.

Summary by Kc5vcx


Kc5vcx (talkcontribs)

Also, FYI...

Use of wfMsg was deprecated in MediaWiki 1.21.

  • SFI_DatePicker.php line 91 calls wfMsg()
  • SFI_DatePicker.php line 45 calls SFIDatePicker::setup()
  • SF_FormInput.php line 329 calls SFIDatePicker->__construct()
  • - line - calls SFFormInput::getHTML()
  • SF_FormPrinter.php line 2027 calls call_user_func_array()
  • SF_FormPrinter.php line 1475 calls SFFormPrinter->formFieldHTML()
  • SF_AutoeditAPI.php line 886 calls SFFormPrinter->formHTML()
  • SF_AutoeditAPI.php line 115 calls SFAutoeditAPI->doAction()
  • SF_FormEdit.php line 92 calls SFAutoeditAPI->execute()
  • SF_FormEditAction.php line 205 calls SFFormEdit->printForm()
  • SF_FormEditAction.php line 27 calls SFFormEditAction::displayForm()
  • MediaWiki.php line 458 calls SFFormEditAction->show()
  • MediaWiki.php line 255 calls MediaWiki->performAction()
  • MediaWiki.php line 682 calls MediaWiki->performRequest()
  • MediaWiki.php line 476 calls MediaWiki->main()
  • index.php line 41 calls MediaWiki->run()
Kghbln (talkcontribs)

This has now been migrated. Thanks for noting.