Copy link to clipboard
Copied
Dear friends :
I have a form and a javascript to control the inputs after clicking the "submit" button :
This javascript verifies that some conditions must accomplish when one of the checkboxes is checked, for example. It works perfect when I use the typical submit button: it verifies the checkbox, and tells you to fill a text field when you forgot it... however, as soon as I change the tag of the button in order to customize it with an image, it fails : it does display the javascript verification, does remind you to fill the text field, BUT then it reloads the page and unchecks all the values that already are filled by user... any explanation ?
This is my typical button:
<input name="button" type="button" onclick="Validar(this.form)" value="Continue" />
This is my image button:
<input type="image" src="img/btn_continue.png" onclick="Validar(this.form)" width="101" height="22"/>
It is the same !! why does it fail ?? thanks in advance for your answers...
Copy link to clipboard
Copied
It is the same !! why does it fail ?? thanks in advance for your answers...
No, it's not the same. A form button automatically submits the form if the validation script returns true. An image simply executes the validation script. When you use an image, the validation script needs to submit the form as well.
Using image buttons for forms is generally not a good idea because the form cannot be submitted if JavaScript is disabled.
Copy link to clipboard
Copied
thanks for the reply David, definetly you KNOW ![]()
Well.. anyway.. I need to customize my button... what would you suggest ? Thanks in advance,
Copy link to clipboard
Copied
Googling around I found this... thanks a lot,
Find more inspiration, events, and resources on the new Adobe Community
Explore Now