training: add form check

dev_trainings
p31729568 6 years ago
parent 1c52835c1a
commit 8ddfbcc7c7

@ -279,7 +279,7 @@ class TrainingsController < ApplicationController
end end
def find_tag_id def find_tag_id
@tag_id = params[:id] @tag_id = params[:tag_id] || params[:id]
Rails.logger.info("##########TAG_ID:#{@tag_id}") Rails.logger.info("##########TAG_ID:#{@tag_id}")
@training_type = @tag_id == "aeee0601_2019" ? 3 : @tag_id == "ceeaa06_2019" ? 4 : 0 @training_type = @tag_id == "aeee0601_2019" ? 3 : @tag_id == "ceeaa06_2019" ? 4 : 0
render_404 if @training_type == 0 render_404 if @training_type == 0

@ -126,7 +126,7 @@
<div> <div>
<p class="collegeInfo"><%= @training_title %></p> <p class="collegeInfo"><%= @training_title %></p>
<%= form_for @training do |f| %> <%= form_for @training do |f| %>
<%= hidden_field_tag(:id, @tag_id) %> <%= hidden_field_tag(:tag_id, @tag_id) %>
<p class="subtitle">基本信息</p> <p class="subtitle">基本信息</p>
<li class="clearfix infoBar"> <li class="clearfix infoBar">
@ -304,6 +304,19 @@
return; return;
} }
<% if @training_type == 3 %>
var trainingCategory = $('input[type="radio"][name="training_category"]:checked').val();
if (trainingCategory == undefined || trainingCategory == '') {
alert('请选择培训类型');
return;
}
if ($("input[type='checkbox'][name='research_field[]']:checked").length == 0) {
alert('请选择授课类型/研究领域');
return;
}
<% end %>
if (userphone == '') { if (userphone == '') {
alert("请输入手机号码"); alert("请输入手机号码");
return; return;

Loading…
Cancel
Save