Tag Archives: javascript

A Pepper Solution Company is Recruiting Skilled JAVASCRIPT Engineer


The company generating innovations in communication robot solution, SEIKATSUKAKUMEI is recruiting javascript engineers. “SEIKATSUKAKUMEI” means revolution in life.

Pepper requires engineers.

Continue reading A Pepper Solution Company is Recruiting Skilled JAVASCRIPT Engineer


(日本語) jQuery.validationEngine: ポップアップの位置を変更する方法


Sorry, this entry is only available in Japanese.


Use AngularJS on Rails form_for


I used AngularJS on Rails form_for. The most annoying thing is form_for generates form tag with action attribute.

Environment

  • Rails 4.1.8
  • Ruby 2.2.2
  • AngularJS 1.4.7
  • Ubuntu 15.04

Circumstance

Rails form_for generates form tag with some attributes, including action. Of course, we can add other attributes. But, AngularJS conflicts with this.

In the following code, problem occurs.

After clicking the button, AngularJS process will be executed and original form process will be executed.

AngularJS prevent original process when form doesn’t have action attribute, but rails add action attributes automatically. I couldn’t find the way to prevent rails from adding action attribute.

Solution

Add onsubmit="return false;" to the form tag.

また AngularJS: How to prevent form submission after click on button? に記載されているような方法もありますが、 javascript として 他のところで使えないので、 上に書いたやり方の方がきれいに見えます。