Browse Source

add form validation

tags/v1.21.12.1
Gitea 4 years ago
parent
commit
dc55975478
1 changed files with 39 additions and 4 deletions
  1. +39
    -4
      templates/repo/modelarts/trainjob/new.tmpl

+ 39
- 4
templates/repo/modelarts/trainjob/new.tmpl View File

@@ -155,7 +155,6 @@
<a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
</div>

<!-- 模态框 -->
<div class="ui parameter modal" style="height: 70%;">
<div class="header">
@@ -352,7 +351,41 @@
.modal('hide');
})

$('.ui.create_train_job.green.button').click(function(e) {
function validate(){
$('.ui.form')
.form({
on: 'blur',
inline:true,
fields: {
boot_file: {
identifier : 'boot_file',
rules: [
{
type: 'regExp[/.+\.py$/g]',
prompt : '启动文件必须为.py结尾'
}
]
},
work_server_number: {
identifier : 'work_server_number',
rules: [
{
type : 'integer[1..25]',
prompt : '计算节点需要在1-25之间,请您键入正确的值'
}
]
}
},
onSuccess: function(){
$('.ui.page.dimmer').dimmer('show')
},
onFailure: function(e){
return false;
}
})
}

function send_run_para(){
var run_parameters = []
$(".dynamic.field .two.fields").each(function(){
var para_name = $(this).find('input[name=shipping_first-name]').val()
@@ -362,8 +395,10 @@

// 后台接收的参数,这个后台根据需要更改相应name属性。
$('#store_run_para').val(run_parameters)
}

// // 加载框加载
// $('.ui.page.dimmer').dimmer('show')
$('.ui.create_train_job.green.button').click(function(e) {
send_run_para()
validate()
})
</script>

Loading…
Cancel
Save