View Full Version : Replacing multiple buttons with images in the same form?


PayBas
12th January 2007, 01:48 AM
Okay here's the deal, I'm trying to replace the "preview post" and "submit new thread" buttons in the "newthread" template with images, I need this for my skin.
So very basically this is what vBull looks like at default:
<form action="newthread.php?do=postthread&amp;f=$forumid" method="post" name="vbform"<if condition="!is_browser('webtv')"> onsubmit="return vB_Editor['$editorid'].prepare_submit(this.subject.value, $vboptions[postminchars])"</if>>
<lots of hidden inputs>
<input type="submit" class="button" name="sbutton" value="$vbphrase[submit_new_thread]" accesskey="s" tabindex="1" />
<input type="submit" class="button" name="preview" value="$vbphrase[preview_post]" accesskey="r" tabindex="1" />
</form>
and I want it to look something like this:
<form action="newthread.php?do=postthread&amp;f=$forumid" method="post" name="vbform"<if condition="!is_browser('webtv')"> onsubmit="return vB_Editor['$editorid'].prepare_submit(this.subject.value, $vboptions[postminchars])"</if>>
<lots of hidden inputs>
<input type="image" class="button" name="sbutton" src="images/post.gif" id="{$editorid}_save" value="$vbphrase[submit_new_thread]" accesskey="s" tabindex="1" />
<input type="image" class="button" name="preview" src="images/preview.gif" value="$vbphrase[preview_post]" accesskey="r" tabindex="1" />
</form>

However this does NOT work because Internet Explorer discards the "value" statement or something (it does work in FF). Basically you cannot have multiple image submit buttons cuz then it messes up :(.
I know this can be fixed by using javascript, but I cannot get it working.


My javascript skills kinda suck so I ended up with stuff like this:
<input type="image" class="button" name="preview" src="/images/en_US/preview.gif" onclick="javascript: document.vbform.submit.value('$vbphrase[preview_post]');return false;" accesskey="r" tabindex="1" />
which didnt get me anywhere.
You see the problem for me is that the "preview' button doesnt get registered correctly (or at all). Doesn't matter if I press "post" or "preview".... it gives the same result... the message gets posted.


Any help would be appreciated.