tags:

views:

21

answers:

2

Hi. I have this :

<form onSubmit="return loadingArtP();" action="./index.php?status=addarticle" enctype="multipart/form-data" method="post" name="addarticle">
    // some input parameters
    <a href="javascript:document.addarticle.submit()">Add</a>
</form>

When i click on "Add" i need to call the loadingArtP() function before send the form, but it doesnt work. How can do it?

+1  A: 

As KennyTM stated, you should use an

<input type="submit">

instead. This will ensure that the submit event is fired properly.

Delan Azabani
+1  A: 

Submitting a form programmatically skips the onsubmit listener (note that it's onsubmit, not onSubmit as in your code). You can either use a real submit button as KennyTM's comment suggested, or call the event listener manually before submitting via code.

Jani Hartikainen