2013-07-29 3 views
1

내 컨트롤러에서 함수를 호출하는 Ruby on Rails 앱에 버튼이 있습니다.버튼을 클릭 할 때 rail on button_to를 비활성화하는 방법은 무엇입니까?

버튼을 클릭하면 함수가 호출됩니다.

그래서이 버튼을 클릭 한 후 비활성화하고 기능이 완료된 후에 다시 사용 가능하게하고 싶습니다.

어떻게하면됩니까? 내보기 코드 아래

<div style="float: left; width: auto; padding-right: 1%"> 
    <%= button_to_function l(:gerar_build_project), remote_function(:action => 'exec_client', :controller => 'repositories') %> 
</div> 

답변

0

당신은 :disable_with 속성을 가진 모든 버튼을 비활성화 할 수 있습니다. 사용해보기 :

<div style="float: left; width: auto; padding-right: 1%"> 
    <%= button_to_function l(:gerar_build_project), remote_function(:action => 'exec_client', :controller => 'repositories'), :disable_with => "Submitting...." %> 
</div> 

희망이 있습니다. 감사합니다

+0

사용합니다. 무엇 : disable_with해야했는데? – kamusett

0
  1. 사용 button_to_function 방법 페이지
  2. 에서
  3. jquery, jquery_ujs을 포함 jquery-rails 보석 작동을하지 않습니다 'data-disable-with' => 'Submitting'