htmllistviewdrop-down-menuonsubmitmybb

How to exchange text for a list in HTML?


I am home unemployed due to COVID-19 and with a lot of spare time so I decided to see how hard could it be to modify some MyBB code and I was doing okay until now.

I am sure the answer to my question is out there but I am so lost that I don't even know how to search to fix my problem, I been searching and trying to figure it out for the past 4 hours and at this point, I just don't know what else to try.

Here is the code I want to modify.

<td class="trow2">{$prefixselect}<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /></td>

That piece of code is from a MyBB template called "newthread". The purpose of the code is to type a subject in a textbox in order to post a new thread. But what I want to do is give the user a drop-down list to choose from instead of typing a text.

Here is the other piece of code I am trying to use without any success.

<input list="browsers">
<datalist id="browsers">
  <option value="Internet Explorer">
  <option value="Firefox">
  <option value="Chrome">
  <option value="Opera">
  <option value="Safari">
</datalist>

If I copy-paste everything that I've tried so far, I will finish this post tomorrow and will make a lot of good HTML developers cringe like never before.

Any help is appreciated. Thanks.

PS: Adding the code to this post was another challenge on its own. XD


Solution

  • Well in my learning journey I came back here. The solution was very simple and here it is.

    I replaced this part of the code:

    <input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /></td>
    

    For this code:

    <td class="trow2">{$prefixselect}
            <select>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
            </select>