2015-12-11 88 views
0

因此,這裏是我的.haml代碼:Ruby on Rails的 - JQuery的空字段

%h1= t('.title') 
%p= t('.contact_us') 

= form_tag request_contact_path, method: 'post' do 
    = label_tag :name, t('.name') 
    = text_field_tag :name, '', title: t('.enter_name'), size: 30 

    = label_tag :email, t('.email') 
    = email_field_tag :email, '', title: t('.enter_email') 

    = label_tag :song, t('.song') 
    = text_field_tag :song, '', title: t('.enter_song') 

    = label_tag :artist, t('.artist') 
    = text_field_tag :artist, '', title: t('.enter_artist') 

    = label_tag :album, t('.album') 
    = text_field_tag :album, '', title: t('.enter_album') 

    = label_tag :reason, t('.reason') 
    = text_area_tag :reason, '', title: t('.enter_reason') 

    = label_tag :message, t('.message') 
    = text_area_tag :message, '', title: t('.enter_message') 

    = submit_tag t('.submit') 

    =link_to t('Cancel'), root_path 

我試圖使用jQuery(而且必須是JQuery的!),使按鈕不能選擇提交(或一些錯誤拋出)如果至少電子郵件字段是空的,有沒有一種可能的方法來實現這一目標?我會非常精明的幫助或提示

回答