# Calling javascript in submit

**URL:** <https://www.ruby-forum.com/t/calling-javascript-in-submit/117038>\
**Category:** Rails\
**Created:** [October 12, 2007, 11:21am UTC](https://www.ruby-forum.com/t/calling-javascript-in-submit/117038 "2007-10-12T11:21:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ravikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@ravikanth](https://www.ruby-forum.com/u/ravikanth)\
**Post date:** [October 12, 2007, 11:21am UTC](https://www.ruby-forum.com/t/calling-javascript-in-submit/117038/1 "2007-10-12T11:21:41Z")

</div>

Hi,

I want to call javascript function which is doing some validation . I  
want to call this function in onclick of submit button . can anybody  
help

---

<div class="post-metadata">

**Author:** ![ravikanth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce7236/32.png) [@ravikanth](https://www.ruby-forum.com/u/ravikanth)\
**Post date:** [October 12, 2007, 3:32pm UTC](https://www.ruby-forum.com/t/calling-javascript-in-submit/117038/2 "2007-10-12T15:32:09Z")

</div>

On Oct 12, 11:21 am, Ravi K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi,
> 
> I want to call javascript function which is doing some validation . I  
> want to call this function in onclick of submit button . can anybody  
> help

You should probably call it onsubmit:
