SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Addict chartahir's Avatar
    Join Date
    Oct 2006
    Location
    Karachi, Pakistan
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Input type image ???

    i've defined the input type as image and i want to submit the form when clicked on image.

    How can i do this ??
    chartahir

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    var theInput = document.getElementById("inputID");
    theInput.onclick = function()
    {
          document.forms["formName"].submit();
    }

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you even need to do that?

    I was under the impression that <input type="image"> when clicked immediately submitted the form.

  4. #4
    SitePoint Addict chartahir's Avatar
    Join Date
    Oct 2006
    Location
    Karachi, Pakistan
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, i need it, because there are two different form defined on the same page and this one with input type image does not work.
    chartahir

  5. #5
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Would you try out this? Simply different function than 7stud's function:
    Code:
    function DoSubmitForm(frmName){
    	frmName.submit();
    }
    <img src="./images/button1.jpg" style="cursor:pointer;" onClick="DoSubmitForm('frmregister');" />
    <img src="./images/button2.jpg" style="cursor:pointer;" onClick="DoSubmitForm('frmsignup');" />
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  6. #6
    SitePoint Addict chartahir's Avatar
    Join Date
    Oct 2006
    Location
    Karachi, Pakistan
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks rajug , its simple and solved my problem,
    now i've another on my site, on one page i've three forms, each with different name, one for login,one for subscription and the last for lost password, the first two works fine when i type the in the text boxes and simply presses "Enter" but for lost password only works when i click on the submit button, it doesn't work with pressing the Enter button

    Whats the problem ?
    chartahir


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
  •