Topic on Project:Support desk

Jump to navigation Jump to search

How to add an email field to a ContactPage contact form?

7
49.230.16.152 (talkcontribs)

I have a principally all core 1.34.2 MediaWiki website with one extension (Extension:ContactPage)

I went through ContactPage documentation here and through HTMLForm documentation here and didn't find any mention for an email field.

Just a side note - email fields are well accepted in Drupal and WordPress so I am a bit surprised not to find them in MediaWiki; perhaps I miss something.

How to add an email field to a ContactPage contact form?

Ammarpad (talkcontribs)

There's already an email field by default. 'RequireDetails' => true, will make it mandatory.

182.232.129.245 (talkcontribs)

@Ammarpad

I vaguely recalled I had an email field and didn't understand where it disappeared to, now I understand:

If 'AdditionalFields' => array() is not empty, than it stops appearing.

Because, indeed, my additional fields array isn't empty and shouldn't be empty my question still stands.

Ammarpad (talkcontribs)

I don't understand what you mean. Whether 'AdditionalFields' is empty or not, there's an email field. In fact you cannot remove it without fiddling with the extension code, maybe that's what you did. MediaWiki:contactpage-fromaddress is the label message for the email field.

182.232.129.245 (talkcontribs)

@Ammarpad

Actually it did happen to me - when my array wasn't empty the email field in the form was gone (!) but now I understand that it happened because some buggy code inside the array; when I debugged the code the problem was gone and the email field was back on the form !

The bug/problem was, if I recall correctly the lack of 'class' => 'HTMLTextField', and perhaps also the lack of a comma, in two similar fields.

182.232.129.245 (talkcontribs)

@Ammarpad it might have actually been a CSS problem --- as I am adding fields I am starting to have "jumbeled" CSS, for example, only the notification "your email is needed to get a response" (translated from Hebrew) appears but not the email field (although the email field appears in HTML source) and also, the checkbox box for "send me a copy of my message (translated from Hebrew) goes on top of that very message.

I think that the CSS of the form isn't modular.

182.232.129.245 (talkcontribs)

@Ammarpad please delete my last message above about CSS, because it is misleading:

The CSS of the form is indeed modular; it's I that caused harm with a CSS change I made long ago and I now fixed (I mistakenly made the email field to have display:none by either canceling its display solely or the display of a class it shares).

Reply to "How to add an email field to a ContactPage contact form?"