html - Why does the required field validator not work if I click twice? -


i have form on aspx page asks email address. want email address required field using requiredfieldvalidator force user enter email address.

the validator works on first click, i.e. code associated submit click won't execute, submit form if click second time though there still no email in email field.

am using incorrectly? should use javascript instead of class?

            <tr>                 <th class="style1"><strong>email: </strong></th>                 <th class="style2"><asp:textbox id="email" runat="server" class="textboxes"/>                     <asp:requiredfieldvalidator id="requiredfieldvalidator1" runat="server"                     controltovalidate="email"                     errormessage="email required field."                     forecolor="red"/>                 </th>             </tr> 

as best practice, use page.isvalid in server side prevent such kind of scripts errors.

if (page.isvalid)                 {                     //do stuffs                 } 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -