Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Making form button be a link?

Community Beginner ,
Mar 25, 2009 Mar 25, 2009
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?
TOPICS
Server side applications
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 25, 2009 Mar 25, 2009
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 ...
Translate
Advisor ,
Mar 25, 2009 Mar 25, 2009
umm...

Sure! Create a form, add a submit button and have form action go to page you'd like button linked to.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 25, 2009 Mar 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2009 Mar 25, 2009
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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 26, 2009 Mar 26, 2009
Thanks Mick. It was the document.referrer that did it. Couldn't get the location=http://URL to work, however I noticed that there is and URL parameter for document. so I'll play with that in case I need it for other projects.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 26, 2009 Mar 26, 2009
LATEST
.oO(sjurick)

>Thanks Mick. It was the document.referrer that did it. Couldn't get the
>location=http://URL to work, however I noticed that there is and URL parameter
>for document. so I'll play with that in case I need it for other projects.

You might want to use JavaScript to create/print that button, because it
requires scripting to work. Nothing is more annoying than a non-working
button or link, which will happen here if the user doesn't have JS.

Micha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2009 Mar 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 26, 2009 Mar 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines