MyBB Community Forums

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 :

<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 Sad 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"

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

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


Thanks for your reading.
I tried to search on Google, Stackoverflow and here but no result can suit to my issue. Anyone have any suggestions in this case?

If yes. Please let me know. Thanks you!
If you are using a button within a form try this:

<form action="newthread.phpXXXX">
...
<input name="submit" type="submit" class="button">

If you are using the button standalone, use this way:

<a href="url"><button type="button">button_text</button></a>
@effone : I change from <input> to <button>. I want to know what thing the form will POST to "newthread.php" when we clicked to Preview Post. So I can write a simple ajax to handle it without using <input>
When you post to newthread.php it gets submitted as an array "input" which showthread.php catches as a value of the variable $mybb->input['message'].
Hmm, but that is the {$message}

What about the $mybb->input['previewpost'] ? Which file will handle it? I check in the newthread.php but not found anything related to handle the "previewpost"
What is the point in doing this? Just to waste time?
(2013-04-26, 11:28 PM)LCTG Wrote: [ -> ]I check in the newthread.php but not found anything related to handle the "previewpost"

previewpost is all over newthread.php
Thanks everybody has participated to my thead,

I found the solution and solve this issue myself!


Once again. Thanks & Regards!