Forum Moderators: open

Message Too Old, No Replies

<form> type Button as image hyperlink

         

keyplyr

7:41 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Someone please remind me how to write a simple form type button as an image link to work inside a table cell.

This displays the button but does not work as a hyperlink:

<form method="post"
action="help.html"><input type="submit"
value="Formula Help "></form>

Thanks

bobriggs

7:46 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<input type="image" ...

[added]
forgot:
<input type="image" src="URI...

[edited by: bobriggs at 7:52 am (utc) on July 23, 2002]

keyplyr

7:52 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



> <input type="image" ...

?

bobriggs

7:55 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe I misunderstood. Do you want the button or the image instead of a button?

<form method="post"
action="help.html"><input type="image" src="pathtoimage" value="Formula Help "></form>

[w3.org...]

keyplyr

8:01 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




I just want the browser default button

But this doesn't work...

<form method="post" action="help.html"><input type="button" value="Formula Help"></form>

bobriggs

8:06 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Really early in the morning here - just woke up.

What does the form do, and what does the image have to do with it?

;)

smokin

8:07 am on Jul 23, 2002 (gmt 0)

10+ Year Member



<form method="get" action="help.html"><input type="submit" value="Formula Help"></form>

keyplyr

8:09 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



> What does the form do, and what does the image have to do with it?

There is no form, and I do not want an image - LOL

I have a multi-celled table in which I want a "form-type" button to act as a link to another page. Thanks.

<added> Thanks Smokin, I already tried that, it just reloads the same page. I want it to go to the Help page.

[edited by: keyplyr at 9:05 am (utc) on July 23, 2002]

bobriggs

8:18 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



;) Threw me off with the image stuff.

What smokin said should get the page (only one side effect, you'll have a ? added to the url in the browser address bar.

<added> Thanks Smokin, I already tried that.

Problem solved? or am I still lost? :)

keyplyr

8:23 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




I see what's wrong. Because I am not identifying "which" form, the browser is confusing it with other forms that are in use, i.e. the whole piano utility, and the page is just being reloaded - notice the URL after the Formula Help button is clicked.

Still, I don't know a work around...

bobriggs

8:24 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, I see the page now.

<form name="keyform">
<form method="GET".....</form>
</form>

Is that legal to nest these?

keyplyr

8:28 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



LOL - that didn't work either. This is ridiculous, surely this isn't difficult. I'm sure I've done this many times...

starway

8:30 am on Jul 23, 2002 (gmt 0)

10+ Year Member



You should add this code to every button:

<form>
<input type="button" onclick="window.location.href='page2.html'">
</form>

No need in any action="" for form tags.
But you have to use <form> tag because you use it's elements for some actions. If you won't use it the button will not work (at least) in NN4.x.

keyplyr

8:32 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




Isn't there a way to script it like:

<input type="button" value="Formula Help" onClick="......;">

<added> Thanks starway, posts got overlapped

bobriggs

8:35 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You've got nested forms = they're block level elements.

</form> before the next form.

[added - w3c validator output]
Line 575, column 8:

</center></td></tr>
^

Error: end tag for "FORM" omitted; possible causes include a missing end tag, improper nesting of elements, or use of an element where it is not allowed

Line 55, column 0:

<form name="keyform">
^

Error: start tag was here

keyplyr

9:14 am on Jul 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




Thanks - When I have time, I'd like to completely redo the utility, it's a real mess written 5 years ago (not by me) and I have been repairing it. There are many nesting/open tag issues. I'm just getting around to the HTML after working on the script for quite a while.

note: if I move the closing form tag to where the val says, then it errors for improper placement inside the table - LOL. Too many nested tables (5)

rewboss

7:37 am on Jul 24, 2002 (gmt 0)

10+ Year Member



Using form input buttons as links is possible using onclick as outlined above, but probably should be discouraged for at least two reasons:

1. It's often ugly, especially when you have lots of buttons.
2. It relies on JavaScript being enabled. If it isn't, the button won't do anything.

keyplyr

8:19 am on Jul 24, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




Thanks rewboss

>1. It's often ugly...
>2. It relies on JavaScript being enabled. If it isn't...

1.) Well "ugly" is conditional upon ones taste. In this case I agree.
2.) The entire utility is a form powered by JavaScript, so the page itself would be useless for those who choose to turn JS off.

I have never felt responsible for the self-inflicted limitations of others :)

MikeG

11:36 pm on Nov 6, 2002 (gmt 0)

10+ Year Member



Did this recently, but don't remember EXACTLY what I did....

Did you attempt:

<form>
<a href='link.html'><input type="button" name="Submit" value="Go There"></a>
</form>

you may also want to put in style ref for text-decoration:none

pageoneresults

11:45 pm on Nov 6, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try this...

<form method="link" action="page.htm">
<input type="submit" value="Click Here">
</form>

If you want, you can assign a css class to the input and give it some umph. Be sure to put your display:inline; attribute in there to prevent that ugly form spacing issue.

P.S. It is suggested that you use absolute URI's with this method.

P.S.S. A few years ago I needed this solution. I ended up making the form buttons using css. Then I captured the screen shot of those form buttons on the page. Cropped them, saved them as images and linked them! ;)