Skip to main content
Known Participant
March 25, 2009
Answered

Making form button be a link?

  • March 25, 2009
  • 3 replies
  • 1809 views
I would like to know if you can use a simple form button be used as a standard link like any other graphic or text can be. The only way I can think of is to capture the button and it's text and cut it out in Photoshop and make it a button that way. Can you do it without turning it into a graphic?
This topic has been closed for replies.
Correct answer Newsgroup_User
sjurick wrote:
> I admit it sounds elementary but I have a form which has its action assigned to
> inserting a record in my DB (action="<?php echo $editFormAction; ?>"). There
> is only one button on the page which is the Insert Record button. Next to it
> I'd like to have a Cancel button which simply returns to an URL or the page
> from which the user was on to get to this "Insert Records" page. I don't think
> I can nest a form within a form to allow a separate button and action pointing
> to an URL can I?
>
... onclick="location=document.referrer">

Mick

3 replies

Inspiring
March 26, 2009
Michael White wrote:
> sjurick wrote:
>> I would like to know if you can use a simple form button be used as a
>> standard link like any other graphic or text can be. The only way I
>> can think of is to capture the button and it's text and cut it out in
>> Photoshop and make it a button that way. Can you do it without
>> turning it into a graphic?
>>
> <input type="button" onclick="location=http://example.com">
> Mick
should be:

onclick=""location=http://example.com"">

Mick
Inspiring
March 25, 2009
sjurick wrote:
> I would like to know if you can use a simple form button be used as a standard
> link like any other graphic or text can be. The only way I can think of is to
> capture the button and it's text and cut it out in Photoshop and make it a
> button that way. Can you do it without turning it into a graphic?
>
<input type="button" onclick="location=http://example.com">
Mick
DwFAQ
Participating Frequently
March 25, 2009
umm...

Sure! Create a form, add a submit button and have form action go to page you'd like button linked to.
SJurickAuthor
Known Participant
March 25, 2009
Sorry, brain fart. I was trying to add a button to an existing form which pointed to an URL. I just pre-pended an href tag to the front of the label and that did it. One puzzling thing though. Now I have a very small black pixel on the lower right and left hand sides of the Cancel button that I can't seem to get rid of. They are the size of a period but I have no text periods anywhere near the button or href code.