SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru redhillccwebmas's Avatar
    Join Date
    Jun 2005
    Posts
    989
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form elements - hotspot linking from within a form element

    Hi there,

    I have the following form code:-

    Code:
    <FORM action=http://www.evolvewebsitedesign.com/submit.asp method=post>
    <INPUT type=hidden value=POK name=name>
    <INPUT type=hidden value=full3050 name=typefile>
    <INPUT type=hidden value=client name=redirect>
    <INPUT type=hidden value=0 name=notproper>
    <INPUT type=hidden value=0 name=emailreq>
    <INPUT type=hidden value=en name=language>
    <INPUT type=hidden value=OCTBONUS_05 name=campdefault>
    <INPUT type=image alt="Download Now!" src="http://www.example.com/test.jpg" value="usandyou" border=0 name=submit>
    </FORM>
    Currently when I click on the image, it is linked successfully to the download file through using this form interface. My problem is I basically need to do the same thing (linking to the download file) through a text-based hyperlink. Is there a way of doing this?

    In the context of what I am using the code for, I am wanting a user to download an executionable file located and processed from within the form action page URL

    I'm not too hot on forms as you can tell!

    Any help is very much appreciated

    Kind Regards

    James

  2. #2
    SitePoint Enthusiast icovey's Avatar
    Join Date
    Jul 2006
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey James,

    I give my forms an id then use the following bit of JS to submit forms using non <input> submit methods:

    HTML Code:
    function submitForm(form) {
    	document.getElementById(form).submit();
    }
    Then wrap the text in an <a> tag that includes an onclick event:

    HTML Code:
    <a href="#" onclick="submitForm('<form id>')">Link Text</a>
    Where <form id> is the id I have given to the form.

    Hope this helps. Cheers,
    Cheers,
    Ian.

    7879 | Web Marketing Lichfield


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •