Merge branch 'master' into 'master'

Fix bug.

See merge request spen/seminar!33
This commit is contained in:
chiu 2022-01-11 02:24:34 +00:00
commit df01e1294b
2 changed files with 9 additions and 3 deletions

View File

@ -109,7 +109,7 @@
$("form.form-horizontal").submit(function(){ $("form.form-horizontal").submit(function(){
var flag = true; var flag = true;
$("div[required=\"required\"]").each(function(i,v){ $("div[required=\"required\"]").each(function(i,v){
if($(v).find("input:checked").length == 0){ if($(v).find("input").length != 0 && $(v).find("input:checked").length == 0){
$(v).find("input").attr("required","required"); $(v).find("input").attr("required","required");
flag = false; flag = false;
}else{ }else{
@ -121,11 +121,11 @@
$("form.form-horizontal [type=\"submit\"]").click(function(){ $("form.form-horizontal [type=\"submit\"]").click(function(){
var flag = true; var flag = true;
$("div[required=\"required\"]").each(function(i,v){ $("div[required=\"required\"]").each(function(i,v){
if($(v).find("input:checked").length == 0){ if($(v).find("input").length != 0 && $(v).find("input:checked").length == 0){
$(v).find("input").attr("required","required"); $(v).find("input").attr("required","required");
flag = false; flag = false;
}else{ }else{
$(v).find("input").removeAttr("required") $(v).find("input").removeAttr("required");
} }
}) })
return flag; return flag;

View File

@ -28,6 +28,12 @@
window.alert("<%=notice%>"); window.alert("<%=notice%>");
</script> </script>
<% end %> <% end %>
<style type="text/css">
.checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] {
position: relative;
margin: 0;
}
</style>
<%= form_for @seminar_signup, url: seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup"} do |f| %> <%= form_for @seminar_signup, url: seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup"} do |f| %>
<fieldset> <fieldset>