MyBB Community Forums

Full Version: SOLVED: form class, onChange/onSelect
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

With the form class and a select box, is there a way to feed attributes like "OnSelect" or "OnChange" to the form class?

I want to trigger actions once a selection has been made without a user having to click a button


SOLVED: Thought I would post this solution in case anyone is having the same issue in developing a plugin.

Here is an example of how to overcome this
$category_box = $form->generate_select_box('category" onChange="some_JS_Function()', $categories, $mybb->input['category']);

This is a bit hacky but what it does is it uses the name section, and put's in it's own escape then adds the call to JS onChange. Again not ideal but hey, if it works, it works Smile