-10

I have three images :

<img src="{% static "img/lt.png" %}" />
<img src="{% static "img/en.png" %}" />
<img src="{% static "img/ru.png" %}" />

I need them to be in the form, however I want there to be no submit button - when user clicks on the image the form gets submitted. Is it possible ? How can I do that ?

Marijus
  • 4,195
  • 15
  • 52
  • 87
  • 2
    possible duplicate of [Using an image as a submit button](http://stackoverflow.com/questions/5283360/using-an-image-as-a-submit-button). Or [Submit Button Image](http://stackoverflow.com/questions/11772326/submit-button-image). Or [button image as form input submit button](http://stackoverflow.com/questions/3381609/button-image-as-form-input-submit-button). – cmbuckley Sep 24 '13 at 22:35

2 Answers2

5

Use input with type="image" to your problem

<input type="image" src="YourImage" />
Donovan Charpin
  • 3,567
  • 22
  • 30
0

You can add javascript click handlers to the images that submit the form using javascript.

    <img src="{% static "img/ru.png" %}" onclick="submitForm();" />

    <script type="text/javascript">
        function submitForm() {
            document.getElementById('form1').submit();
        }
    </script>

This can also allow you to modify any potentially hidden input fields before the submit occurs.

Nunners
  • 3,047
  • 13
  • 17