MyBB Hacks

Full Version: How to use <button> tags within MyBB forms?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello.

I've some trouble in using <button> tags within MyBB forms.

For example :

PHP Code:
<form action="newthread.phpXXXX">
...
<button name="submit" type="submit">
<span>Post Thread</span>
</button>

<button name="previewpost" type="submit">
<span>Preview Post</span>
</button>
...
</form>



And you will know what happen Frown When click  to the Preview button, it will do post thread process Smile

I don't know which file where I can handle the preview process in MyBB. I found in the "newthread.php"

Code:
$mybb->input['action'] == "previewpost"


But I don't know what it do exactly...


Thanks for your reading.

Specify a value for your buttons.
(04-27-2013 03:39 AM)RateU Wrote: [ -> ]Specify a value for your buttons.

Please explain it more detail. I'm quite new to MyBB.

Do you mean

PHP Code:
<button type="button" value="previewpost">Preview Post</button>

Something like this:

HTML Code
<button type="submit" name="previewpost" value="previewpost">Preview Post</button>

(04-28-2013 07:28 AM)RateU Wrote: [ -> ]Something like this:

HTML Code
<button type="submit" name="previewpost" value="previewpost">Preview Post</button>


Thanks you. I solved it few days ago. But really thanks you so much!

But I've new small issue.

In the forumdisplay_inlinemoderation template, I'm using this instead of MyBB <input> tags.

PHP Code:
<button class="ui-button button2" id="inline_go" name="go" type="submit"><span><span>{$lang->inline_go}({$inlinecount})</span></span></button>
&nbsp;
<button class="ui-button button2" onclick="javascript:inlineModeration.clearChecked();" type="button"><span><span>{$lang->clear}</span></span></button>


The clear button is working and also the go button is working too. But the {$inlinecount} not display correct.

When I check to the checkbox, it will change the value attribute of <button> tags


What should I do?

The inlinecount "auto update" is related to the inline_moderation.js file. So maybe you need to look at (maybe you need to modify) the file.
(04-30-2013 02:42 AM)RateU Wrote: [ -> ]The inlinecount "auto update" is related to the inline_moderation.js file. So maybe you need to look at (maybe you need to modify) the file.

Yes, I know and I checked it before I posted the previous post. The inlinecount will be set for the value attribute. But the button element don't need value attribute.

For example,

Old inlinecount will change the value attribute like this :

PHP Code:
<input value="Go (0)" />
When we tick to some threads
==> <input value="Go (1)" />


And now with the button it will look like this :

PHP Code:
<button>Go (0)</button>
When we tick to some threads
==> <button value="Go (1)">Go (0)</button>
instead of
==> <button>Go (1)</button>


How to do that? I have no idea with javascript Frown

Set the inline_go id to your span (not to your buttons), then edit the file, maybe use innerHTML for the elements that use the id (goButton). You can find more than one in that file.
Works like a charm Smile Thanks a lot, RateU !

Have a Good day!
Reference URL's