Help - Search - Members - Calendar
Full Version: Using an image to submit comments
Movable Type Community Forum > Additional Resources > Tips and Tricks
alex
Have you tried putting post in the 'value' attribute? This is what I've used succesfully on other sites (granted not in  MT) and it has always worked. I think that the lack of "value='submit'" forces the button to use a default state of 'submit'.

CODE
<input type=image src="/images/submit.gif" name="hidden_Submit" alt="Submit" border="0" value="Submit">


Depending on whether or not you want to support older browsers (4.x and below) you could use:

CODE
<button name="mybutton" value="Post Me!" type="submit"></button>


The button tag is in the specs and can be fully customized by CSS. Again, I haven't utilized this in MT as of yet.

Hope this helps,
kadyellebee
You might want to check out how Robyn at Ain't Too Proud to Blog does it - I know that she uses images to submit her comments.

smile.gif
Kristine
btrott
The name of the form input tag needs to be "post"--is it?

CODE
<input type="image" src="/images/submit.gif" name="post" border="0">


And if you use an image for Preview, the "name" has to be "preview".
brenmae
Hi Ben and everyone,

I've tried my best to tweak the template to make this work, but without success. Is there any solution to this problem or should i just leave it be? Just want to know so that i can finally move on!  ???
annabel
QUOTE
So... since there isn't a form param named post, the system isn't registering it as a post attempt.

You could hack mt-comments.cgi to look for 'post.x' instead of 'post'.

i can't see the word "post" anywhere in mt-comments.cgi.

where should i be looking?
ewingren
QUOTE
Ben:

yes it is.

this is what i have in my individual archive template:

CODE
<input type="image" name=post src="../img/smile.gif" border="0">


everything works as per normal if i use a normal "submit" button. it was only until i changed it to use an image instead that the problem occured.

maybe if you put " around the name value -> "post"
ewingren
ok. i'm stuck. trying to use images in the place of the POST, PREVIEW and CANCEL buttons.

ben's suggestion:

CODE
<input type="image" src="/images/submit.gif" name="post" border="0">

...does not do the trick. the image shows allright and when clicked it *seems* like it calls the right script but nothing new is created. am i missing something?

guillebe, does your suggestion to hack  /lib/MT/App/Comments.pm apply to anyone who want's to use an image as a button or is it for brenmae's case only?
pandemonia
Hello everyone...

I'm being successful in modding MT so far, but i just encountered a small issue.

I'm trying to change the default " POST " button in the submit comments form to an image with the usual html (input type=image name=post src=...), but with no success. instead of actually posting the data, the user is redirected to a page with all comments for the entry.

I tried the names "post" and "submit" for the image, but with no success.

If anyone has any suggestions, please help me. My head is tired from too much MT'ing already   sad.gif

-- michell
brenmae
sorry, i had to revive this topic. i'm having the very same problem, and there doesn't seem to be an obvious solution to this. can someone shed some more light on this matter?
brenmae
thanks for the link, Kristine. i tried, i really tried to figure it out, but... i still can't. more suggestions?
brenmae
Ben:

yes it is.

this is what i have in my individual archive template:

CODE
<input type="image" name=post src="../img/smile.gif" border="0">


everything works as per normal if i use a normal "submit" button. it was only until i changed it to use an image instead that the problem occured.
btrott
Oh, I see why it doesn't work... when you click on an image submit in a form, the browser sends two form parameters, based on the name of the form input. So, for example, with a name="post", the two params would be post.x and post.y, corresponding to the spot on which you clicked on the image.

So... since there isn't a form param named post, the system isn't registering it as a post attempt.

You could hack mt-comments.cgi to look for 'post.x' instead of 'post'.
girlie
I looked at Robyn's site (mentioned by Kristine above) and I noticed in her source code, she isn't using the name attribute, but is using the value attribute.

Hmmmmmmm.
richK
You should be looking in mt/lib/MT/App/Comments.pm (lines 24-30ish).
guillebe
look in /lib/MT/App/Comments.pm for the lines saying

CODE
if ($q->param('post')) {


and

CODE
} elsif ($q->param('preview')) {


change them to

CODE
if ($q->param('post') || $q->param('post.x') ) {


and

CODE
} elsif ($q->param('preview') || $q->param('preview.x')) {


respectively.

Works here.. is it ok, Ben? Perhaps it could make it to next revision  smile.gif
ewingren
yes!

guillebe's hack works wonders!

thanx!
edb
Ah, what a little searching turned up!  Well it works wonderfully and much thanks to everyone for the hard work.  My only question is, can the same be done (ie use an image as a button) for the type=button controls, "cancel" and "forget info" ?  Thanks again!
demonsurfer
should be a onClick submit line and a small javascript called..
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.