Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java DateTextBox验证不起作用_Java_Spring_Jsp_Dojo - Fatal编程技术网

Java DateTextBox验证不起作用

Java DateTextBox验证不起作用,java,spring,jsp,dojo,Java,Spring,Jsp,Dojo,我想在用户输入无效输入(如“abcd”)时验证DateTextBox字段。如果用户输入无效输入,我想限制表单提交 下面是我用于验证的代码。但每当我给出“fromdate”和“todate”时,单击按钮表单都会正确验证并限制提交。但是在“fromdate”日历弹出窗口中,所有日期都被删除。我想重置约束 任何帮助都将不胜感激。提前谢谢 function validateForm() { alert('Validate'); var form = dijit.byId("form1");

我想在用户输入无效输入(如“abcd”)时验证DateTextBox字段。如果用户输入无效输入,我想限制表单提交

下面是我用于验证的代码。但每当我给出“fromdate”和“todate”时,单击按钮表单都会正确验证并限制提交。但是在“fromdate”日历弹出窗口中,所有日期都被删除。我想重置约束

任何帮助都将不胜感激。提前谢谢

 function validateForm()
{   alert('Validate');
    var form = dijit.byId("form1");
    alert('form '+form);
    if(form.validate()) {   
        console.info("It was valid!");
    } else {
    var result= alert('The value entered is invalid.Please provide the valid input.');
    if(result= true){

    //
   }


<tr>
            <td class="label"><label
                title="A single Deduction Date can be entered in the From/To fields or a range of Deduction Dates can be entered to search multiple days.">
            Deduction Date From</label></td>
            <td class="content"><form:input
                path="deductionSearchFilter.deductionDateFrom" size='20'
                id="fromDedDate" dojotype="dijit.form.DateTextBox"
                onchange="dijit.byId('toDedDate').constraints.min = arguments[0];"
                size="10" style="width: 114"
                title="A single Deduction Date can be entered in the From/To fields or a range of Deduction Dates can be entered to search multiple days." />
            <span class="required">To </span><form:input
                path="deductionSearchFilter.deductionDateTo" id="toDedDate"
                dojotype="dijit.form.DateTextBox"
                onchange="dijit.byId('fromDedDate').constraints.min = arguments[0];"
                size="10" style="width: 114"
                title="A single Deduction
          Date can be entered in the From/To fields or a range of Deduction Dates can be entered to search multiple days." />

            </td>
        </tr>


<td align='center'><input id="search" onclick="validateForm();" type="submit" name="Search"
                value="Search" class="button"
                title="View the results of search" />
            </td>
函数validateForm()
{alert('Validate');
var form=dijit.byId(“form1”);
警报(“表格”+表格);
如果(form.validate()){
console.info(“它是有效的!”);
}否则{
var result=alert('输入的值无效。请提供有效的输入');
如果(结果=真){
//
}
扣除日期
到

1)您使用了错误的标记。您正在寻找的是javascript而不是java(jsp)2)您在项目中使用了任何特定的javascript框架吗?Answer确实依赖于此信息。感谢.dojo frameworkSorry迟到。这是您的解决方案吗?
if(result=true)
你确定你的意思不是
=