Submit form by clicking pic, but depends on what pic you click - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Submit form by clicking pic, but depends on what pic you click

I am doing a website where if you click on a thumbnail of a picture of a car the next page will go into the detail of that car. Now, I recently posted a message asking how a can get a picture to submit the form. I got two responses:
One was to insert this code on image "image" . THAT DID NOT WORK.

The second was to make the image an input type, like so:. THAT DID WORK BUT IT DOES SUBMIT THE NAME OF THE IMAGE CLICK, BUT IT SUBMITS THE X AND Y POSITION CLICKED ON THE PICTURE.

I need to find a way so that when a user clicks a picture, the name of the picture name is submitted. Can anyone help me out?

Thanks

Comments

  • bagles1bagles1 Posts: 54Member
    You can go about this several different ways, here is one. 1) Wrap it in an tag, ie. image or you could also put the same function in the onClick of the anchor tag. 2) Create a hidden text field(s) with the name being the name of the image then set the value = false. In your form submission function you should then change the value of that hidden text field to true and then submit your form. Hope this helps. If you have mutltiple images in one form then you would want to check for the one that returns true on the ASP side, all the rest wouldn't matter.

    example:

    function submitMyForm(oForm, oFld) {
    eval(oForm.name + "." + oFld.name + ".value = true");
    oForm.submit();
    }









    -Bagles1


    : I am doing a website where if you click on a thumbnail of a picture of a car the next page will go into the detail of that car. Now, I recently posted a message asking how a can get a picture to submit the form. I got two responses:
    : One was to insert this code on image "image" . THAT DID NOT WORK.
    :
    : The second was to make the image an input type, like so:. THAT DID WORK BUT IT DOES SUBMIT THE NAME OF THE IMAGE CLICK, BUT IT SUBMITS THE X AND Y POSITION CLICKED ON THE PICTURE.
    :
    : I need to find a way so that when a user clicks a picture, the name of the picture name is submitted. Can anyone help me out?
    :
    : Thanks
    :
    :

Sign In or Register to comment.