I found that there is a way to add javascript files in the form validation function as stated in "drupal_add_js not work in form validation failed".
However, I would like to know how to add javascript using the drupal_add_js function with the inline option. I would just like to execute some javascript code while I am in the validation function of the Drupal Form API.