Login Register

dojo submit button not working when I want to validate TextBox before the submition?!!

Hi, everybody,
I have problem with dojo button. Here is my code:

<span id="langDiv" class="th">
        <input type="text" name="name[{LANG}]" value="" style="width: 280px;" dojoType="dijit.form.ValidationTextBox" required="true" invalidMessage="Required field!!" />
</span>
        <button dojoType="dijit.form.Button" name="button" id="addButton"  type="submit">Add</button>

So the problem is that this submit button don't work. It validate the TextBox and bring out the "invalidMessage="Required field!!"", but when I put some text in the field the button don't send anything!!
Why is that happend?
My question is mainly: is there any way to do dojo submit button in this easy way(with type="submit"), or compulsory I have to write some submit() function??!!

10x to everyone with ideas and nice day

(sorry for my bad english)

i think your problem solve

i think your problem solve with this code

<form  dojoType="dijit.form.Form" id="form" autocomplete="off" method="POST" >
  <script type="dojo/method" event="onSubmit">
      if(this.validate()){
      alert(dijit.byId('input').value);
      alert('true');
        return false; //return false will cause the form not to automatically submit
      }else{
        return false;
      }
  </script>       
<span id="langDiv" class="th">
        <input id="input" type="text" name="name[{LANG}]" value="" style="width: 280px;" dojoType="dijit.form.ValidationTextBox" required="true" invalidMessage="Required field!!" />
</span>
        <button dojoType="dijit.form.Button" name="button" id="addButton"  type="submit">Add</button>
</form>

dont forgot:dojo.require("dijit.form.Form");
you can replace dijit.form.ValidationTextBox with dijit.form.TextBox

sorry for my poor language

楼主你好

楼主你好,请问你来自。。。。?