MyBB Community Forums

Full Version: MyCode for customizable <SELECT></SELECT> tag replacements
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'm trying to use custom MyCode to allow users to build a customizable drop down box for signatures. They have proven very helpful on a previous forum, where people may want to list RPG details of their character that could be 40, 50, 60 lines long, without taking up loads of space on the board.

I've managed to get as far as follows,

\[pb\](.*?)\[/pb\]
<select>$1</select>

~

\[pbl\](.*?)\[/pbl\]
<option>$1</option>

Which allows users to do,

[pb]
[pbl]Hey this is a dropdown box, I wonder what could be lurking...[/pbl]
[pbl]Wow it is me ur friend[/pbl]
[/pb]

Which results in a functioning <SELECT> dropdown box.

I've also found that I can make variants of the [pb] tag that lets me specify formatting, such as,

\[pbbuf\](.*?)\[/pbbuf\]
<select style="color: #F9BB13; background-color: #164833; font-size: 14px;">$1</select>

Which results in a green and gold version of the <SELECT> dropdown, with size 14 font.

What I've been unable to make happen, however, is to put in variants that let users specify the style details themselves, something along the lines of,

[pbc,FFFF00,000000,14,Verdana,500]
[pbl]Wow, custom colours![/pbl]
[/pbc]

Where by setting those variables, the dropdown box would have the properties of #FFFF00 text colour, #000000 background colour, size 14 font, Verdana font and the unopened <SELECT> element would be 500px wide.

Any idea how to make this happen? I've tried putting the elements in directly, such as,
\[pbt\,(.*?)\,(.*?)\](.*?)\[/pbt\]
<select style="font-size: $1px; width: $2px;">$3</select>

But it just leads to a <SELECT> element with default styling.

Thanks for any help you can offer!
Didn't read the whole thing but I guess its about custom styling of select element. Tried using !important in CSS property values?
I didn't yet, but I just somehow got it working anyway.

The code is,

\[pbt\,(.*?)\,(.*?)\,(.*?)\,(.*?)\,(.*?)\](.*?)\[/pbt\]
<select style="font-size: $1px; width: $2px; color: #$3;
background-color: #$4; font-family: $5;">$6</select>

Which allows full customization of all of those things- but you need to put all of those values in. "0" in the Font bit will default the font to the skin standard, in case you're using skins with specific imported fonts that can only be used on one of em.

Thanks anyway! Maybe someone else can use this.