Want to post but can't?

Want to just shoot the breeze? Forum 42 is the place!

Moderator:Moderators

Post Reply
User avatar
nitro2k01
Posts:651
Joined:Tue Dec 19, 2006 12:41 pm
Want to post but can't?

Post by nitro2k01 » Thu Jun 30, 2022 5:04 am

Want to post to this forum but can't because the text box for entering the message is broken? The answer is probably no, since this place is dead as a dodo at this point, but here's a solution for you anyway.

The problem is that the HTML tag for the message textarea is broken and missing a space. So it looks like this...

Code: Select all

<textareaname="message" id="message" rows="15" cols="76" 
instead of like this:

Code: Select all

<textarea name="message" id="message" rows="15" cols="76" 
It's unclear exactly why his happens, but my theory is that newer versions of PHP are incompatible with the older versions of phpBB that some forums still use.

Here's a user script you can add to Tampermonkey to make this, and potentially other phpBB forums with the same problem, work. (You'd need to add the site you want to add as a match line.)

Code: Select all

// ==UserScript==
// @name         Fix GBADEV forum
// @namespace    http://www.dwedit.org/
// @version      0.2
// @description  Fix invalid HTML tag for the posting textarea
// @author       Dwedit
// @author       nitro2k01
// @match        https://forum.gbadev.org/*
// @match        https://forums.benheck.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    //Code to replace an HTML tag name
    //https://stackoverflow.com/questions/15086677/replace-specific-tag-name-javascript
    function changeTag(el, newTagName = "div") { var newEl = document.createElement(newTagName); [...el.children].forEach(o => newEl.appendChild(o)); [...el.attributes].forEach(o => newEl.attributes.setNamedItem(o.cloneNode())); el.parentNode.replaceChild(newEl, el); return newEl; }
    var elements = document.getElementsByTagName("textareaname=\"message\"");
    if (elements !== undefined && elements.length > 0)
    {
        var element = elements[0];
        element.setAttribute("name","message");
        // Preserve the message for edit/preview. Trim the string to get rid of annoying whitespace at the end of the string.
        var message=element.innerHTML.trim();
        var newEl=changeTag(element, "textarea");
        newEl.innerHTML=message;
    }
})();
Here's where I first encountered this issue, on a different forum, for reference: https://forum.gbadev.org/viewtopic.php?f=6&t=18213

Edit: fixed typo.
My blog
ASM Retro <- Gameboy Classic Backlight

Being the sadistic bastard I am, I have covered Frog's left eye with a Santa hat.

Last edited by nitro2k01 tomorrow, 1:48 pm; edited 1 time in total

Post Reply