views:

55

answers:

5

I want to make the descriptive text around a form link also open the form. I want to make it so you can click on "Some Text Here" (below) and open the form on somesomite.com just as if you clicked on the image below this text (somebut.gif, below)

<DIV style="position: absolute; top:10px; right:10px; width:70px; height:25px">
<font color="white"><b>Some Text Here<b></font>
</div>
<DIV style="position: absolute; top:50px; right:10px; width:70px; height:25px">
<form action="https://www.somesite.com/cgi-bin/something" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.somesite.com/somebut.gif" border="0" name="submit">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----LONG_KEY...>
</form>
</div>

Thanks

A: 

just wrap the "some text here with a link to the site"

<a href="https://www.somesite.com/cgi-bin/something"&gt;&lt;font color="white"><b>Some Text Here<b></font></a>
Mark Hazlett
I added a line to the code in my question - the encrypted key. Just calling the cgi in you suggestion won't pass the key.
Rilien
You realize that both `font` and `b` tags are not standard.
Joseph Silvashy
+1  A: 

Give the form a name and use JavaScript to submit the form. You should also stay away from <font> and <b> tags; they're deprecated.

<!-- ... snip ... -->
<strong style="cursor: pointer; color: #FFF; " onclick="document.forms['someform'].submit(); ">Some Text Here</strong>
<!-- ... snip ... -->
<form name="someform" action="https://www.somesite.com/cgi-bin/something" method="post">
<!-- ... snip ... -->

If you prefer to use anchor tags to get all of the CSS pseudo-classes, etc., then you can do this instead of the bare <strong> tag:

<a href="#" style="font-weight: bold; text-decoration: none; color: #FFF; " onclick="document.forms['someform'].submit(); return false; ">Some Text Here</a>

Finally, if you don't want to use JavaScript, then you'll have to do some rearranging of your markup and add some CSS, like so:

<form action="https://www.somesite.com/cgi-bin/something" method="post">
    <input type="submit" value="Some Text Here" style="background: none; border: 0; font-weight: bold; color: #FFF; " />
    <input type="hidden" name="cmd" value="_s-xclick" />
    <input type="image" src="https://www.somesite.com/somebut.gif" border="0" name="submit" />
    <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----LONG_KEY..." />
</form>

Add <div> tags as desired.

Christopher Parker
The `font` and `b` tags aren't deprecated, they just aren't standards.
Joseph Silvashy
The W3C would disagree with you: http://www.w3.org/TR/html401/present/graphics.html#edef-FONT
Christopher Parker
Also... it turns out the `<b>` and `<i>` tags aren't deprecated. I always thought they were. No matter, `<b>` and `<i>` solely exist for visual effect, whereas `<strong>` and `<em>` have semantic value. If you're going for bold text without the semantics of the `<strong>` tag attached to the text, use CSS.
Christopher Parker
Now I know why I thought `<b>` and `<i>` were deprecated. `<u>` is deprecated, and the three typically go hand-in-hand. http://www.w3.org/TR/html401/present/graphics.html#edef-U
Christopher Parker
Ah. And `<b>` and `<i>` were removed from XHTML2. http://www.w3.org/TR/xhtml2/elements.html#a_elements I feel better now. :-)
Christopher Parker
I'd also be interested in a non java script solution.
Rilien
Rilien, see my comment on erynion's answer: http://stackoverflow.com/questions/2434486/how-do-i-add-descriptive-text-to-form-link-gif/2434733#2434733
Christopher Parker
+1  A: 

The suggestion from Christopher Parker works. Is there a non-javascript solution? I can't check his answer as working, as I closed my browser and lost the cookie, and now this site doesn't know it's me.

Rilien
Couldn't you just log in again?If you'd like a non-JavaScript solution, then the text "Some Text Here" needs to be placed inside the form and turned into a submit button. Style it to remove the border, etc.
Christopher Parker
Sorry. I hadn't registered, and I lost the cookie, so the system didn't recognize me. I have an OpenID account now, so I won't be answering my own questions like above, only if it's actually my answer.
Rilien
A: 

Isn't the gif the submit button. I want the picture too. If your suggestion allows both then I need an example. I got the javascript working, but I will replace it if there's a non-javascript way to do it. ---This site advertises you don't need an account. I include my e-mail address when I post, and then it puts my name on top of the page and says it's my first post again. The login requires an account and a password. If the site didn't advertise "no registration required" then I would just register - although I may have never came here, as I did a Google search for 'html forum "no registration"'

Couldn't you just log in again? If you'd like a non-JavaScript solution, then the text "Some Text Here" needs to be placed inside the form and turned into a submit button. Style it to >remove the border, etc.

Rilien
Actually, my reputation is now 11, but it only shows 1 question. There's an openid number on my page here, but it doesn't work on the login w/opened page. What's the URL/provider? I tried just the number and these each listed provider.
Rilien
I got my accounts joined. Problem solved.
Rilien
You shouldn't keep posting new answers to your question when you really should be adding comments to existing answers... it pollutes the list of answers to a question and it doesn't notify people that there are new comments waiting for them.
Christopher Parker
Sorry. I hadn't registered, and I lost the cookie, so the system didn't recognize me. I couldn't comment on answers that weren't mine (not enough points to comment "elsewhere"). I have an OpenID account now, so I won't be answering my own questions like above, only if it's actually my answer. Sorry.
Rilien
A: 

They work in the current versions of Firefox, IE, Safari, and Opera. That's standard enough for me.

You realize that both font and b tags are not standard. – Joseph Silvashy

Rilien