asp.net

Discussion in 'ASP.NET / ASP.NET Core' started by dogchief, Feb 2, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have 4 asp:textbox tags2 are using requiredfieldvalidators and 2 are regularexpressionvalidators. i also have an asp:button that should submit the information when filled out correctly. if i leave everything blank the 2 requiredfieldvalidators show there messages the other 2 will not. everything is setup identically so i am not sure what i am missing or forgetting that all 4 are not coming up when i click the submit button. It is kind of like when we sign up for the forum except all four messages should show at the same. also if i fill in the requiredfieldvalidators and submit it, itis accepting the information and not popping up the message for the regularexpressionvalidators unless i input the information incorrectly in those 2 textboxs. here is the code



    <script language=vb runat="server">
    Sub Button1_Click(sender as Object, e as EventArgs)
    Page.Databind
    End sub
    </script>
    Thanks for any light you can shine on this.
     
  2. <</font>script</font> </font>language</font>='vb'</font> </font>runat</font>='server'></font>Sub</font>as</font>Object</font>as</font>End</font>sub
    </font></</font>script</font>></P></font></</font>HEAD</font>></P></font><</font>body</font>></P></font><</font>form</font> </font>runat</font>='server'</font> </font>ID</font>='Form2'></P></font><</font>br</font>></P></font><</font>asp:textbox</font> </font>id</font>='UserName'</font> </font>runat</font>='server'</font> </font>Width</font>='144px'></</font>asp:textbox</font>></P></font><</font>asp:requiredfieldvalidator</font> </font>id</font>='UserNamerequired'</font> </font>Runat</font>='server'</font> </font>ControlToValidate</font>='UserName'> </font></</font>asp:requiredfieldvalidator</font>></P></font><</font>br</font>></P></font><</font>br</font>></P></font><</font>asp:textbox</font> </font>id</font>='EmailAddress'</font> </font>runat</font>='server'</font> </font>Width</font>='144px'></</font>asp:textbox</font>></P></font><</font>asp:regularexpressionvalidator</font> </font>id</font>='EmailAddressrequired'</font> </font>Runat</font>='server'</font> </font>ControlToValidate</font>='EmailAddress'</font> </font>ValidationExpression</font>='^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|([a-zA-Z0-9\-\.]+))\.(com|net|org|edu|mil|uk|)$'></font></</font>asp:regularexpressionvalidator</font>></P></font><</font>br</font>></P></font><</font>br</font>></P></font><</font>asp:textbox</font> </font>id</font>='PayPalAcct'</font> </font>runat</font>='server'</font> </font>Width</font>='144px'></</font>asp:textbox</font>></P></font><</font>asp:requiredfieldvalidator</font> </font>id</font>='PayPalvalidator'</font> </font>Runat</font>='server'</font> </font>ControlToValidate</font>='PayPalAcct'></font></</font>asp:requiredfieldvalidator</font>></P></font><</font>br</font>></P></font><</font>br</font>></P></font><</font>asp:textbox</font> </font>id</font>='Pick'</font> </font>runat</font>='server'</font> </font>Width</font>='144px'></</font>asp:textbox</font>></P></font><</font>asp:regularexpressionvalidator</font> </font>id</font>='Pickvalidator'</font> </font>Runat</font>='server'</font> </font>ControlToValidate</font>='Pick'</font> </font>ValidationExpression</font>='^(\d{1}-\d{1}-\d{1}-\d{1}-\d{1}-\d{1})|(\d{1}-\d{1}-\d{1}-\d{1}-\d{1}-\d{2})|(\d{1}-\d{1}-\d{1}-\d{1}-\d{2}-\d{1})|(\d{1}-\d{1}-\d{1}-\d{2}-\d{1}-\d{1})|(\d{1}-\d{1}-\d{2}-\d{1}-\d{1}-\d{1})|(\d{1}-\d{2}-\d{1}-\d{1}-\d{1}-\d{1})|(\d{2}-\d{1}-\d{1}-\d{1}-\d{1}-\d{1})|(\d{1}-\d{1}-\d{1}-\d{1}-\d{2}-\d{2})|(\d{1}-\d{1}-\d{2}-\d{1}-\d{1}-\d{2})|(\d{1}-\d{2}-\d{1}-\d{1}-\d{1}-\d{2})|(\d{2}-\d{1}-\d{1}-\d{1}-\d{1}-\d{2})|(\d{2}-\d{1}-\d{1}-\d{1}-\d{2}-\d{1})|(\d{2}-\d{1}-\d{1}-\d{2}-\d{1}-\d{1})|(\d{2}-\d{1}-\d{2}-\d{1}-\d{1}-\d{1})|(\d{2}-\d{2}-\d{1}-\d{1}-\d{1}-\d{1})|(\d{1}-\d{1}-\d{1}-\d{2}-\d{2}-\d{1})|(\d{1}-\d{1}-\d{2}-\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d{2}-\d{2}-\d{2}-\d{1}-\d{2})|(\d{2}-\d{1}-\d{2}-\d{2}-\d{2}-\d{1})|(\d{2}-\d{1}-\d{2}-\d{2}-\d{1}-\d{2})|(\d{2}-\d{2}-\d{2}-\d{2}-\d{1}-\d{1})|(\d{2}-\d{2}-\d{2}-\d{1}-\d{2}-\d{1})|(\d{2}-\d{2}-\d{2}-\d{1}-\d{1}-\d{2})|(\d{2}-\d{2}-\d{1}-\d{1}-\d{2}-\d{2})|(\d{1}-\d{2}-\d{2}-\d{2}-\d{2}-\d{1})|(\d{2}-\d{2}-\d{1}-\d{2}-\d{1}-\d{2})|(\d{1}-\d{2}-\d{2}-\d{2}-\d{2}-\d{2})|(\d{2}-\d{1}-\d{2}-\d{2}-\d{2}-\d{2})|(\d{2}-\d{2}-\d{1}-\d{2}-\d{2}-\d{2})|(\d{2}-\d{2}-\d{2}-\d{1}-\d{2}-\d{2})|(\d{2}-\d{2}-\d{2}-\d{2}-\d{1}-\d{2})|(\d{2}-\d{2}-\d{2}-\d{2}-\d{2}-\d{1})|(\d{2}-\d{2}-\d{2}-\d{2}-\d{2}-\d{2})|(\d{2}-\d{1}-\d{1}-\d{2}-\d{2}-\d{1})$'></font></</font>asp:regularexpressionvalidator</font>></P></font><</font>br</font>></P></font><</font>p</font> </font>align</font>='center'></P></font><</font>asp:button</font> </font>id</font>='Button1'</font> </font>onclick</font>='Button1_Click'</font> </font>Runat</font>='server'</font> </font>Text</font>='Submit'></</font>asp:button</font>></P></font></</font>p</font>></P></font></</font>form</font>></P></font>

    </font>

    Post Edited By Moderator (bruce) : 2/3/2005 6:51:44 PM GMT
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    Hi.. i think i messed up your post, the scrolling horizontally and i was trying to fix it.

    I think the problem is with the regex validation. It doesn't fail when you leave the field blank. You can either change the regex or add a required field validator to the other 2 text box.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  4. Bruce

    Bruce DiscountASP.NET Staff

  5. yeah - simply just add a requiredvalidator to the fields that you use the regularexpression validators on.

    remember, the inbuilt validators in VS.Net are fired up structurally. Meaning that you can decide in which order they will be fired up on.

    So just remember to put the requiredvalidator BEFORE the regular expression validator in the code.

    ----
    Brian H. Madsen
    Microsoft SQL Server IG Perth - Organiser
    http://www.sqlserver.org.au
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page