Jump to content

Invalid Input


d@rk_blu3

Recommended Posts

Good Day!Hi guys;Can anyone knows how o validate input using append?I,m using a static (required field validator) and code like this (see below) but my project manager does'nt want it

   Private Function IsValidInput() As Boolean        _errormessage = ""        If txtBilFName.Text.Trim.Length = 0 Then            _errormessage = " - Please enter your firstname[billing]<br>"        End If        If txtBilLName.Text.Trim.Length = 0 Then            _errormessage &= " - Please enter your lastname[billing]<br>"        End If        If txtBilStreet.Text.Trim.Length = 0 Then            _errormessage &= " - Please enter street[billing]<br>"        End If        If txtBilCity.Text.Trim.Length = 0 Then            _errormessage &= " - Please enter city[billing]<br>"        End If        If ddlBilState.SelectedValue.Length = 0 Then            _errormessage &= " - Please select state[billing]<br>"        End If        If txtBilZipcode.Text.Trim.Length = 0 Then            _errormessage &= " - Please enter zipcode[billing]<br>"        End If        If txtBilPhone.Text.Trim.Length = 0 Then            _errormessage &= " - Please enter phone[billing]<br>"        End If        If Not Session.Item("Email") Is Nothing Then            If txtEmail.Text.Trim.Length = 0 Then                _errormessage &= " - Please enter email<br>"            End If            If Not Validators.IsEmailValid(txtEmail.Text.Trim) Then                _errormessage &= " - Invalid email format<br>"            End If            If Validators.IsEmailExist(txtEmail.Text.Trim) Then                _errormessage &= " - Email already exist<br>"            End If            If txtPassword1.Text.Trim.Length = 0 Then                _errormessage &= " - Please enter password<br>"            End If            If txtPassword1.Text.Trim.Length < 6 Then                _errormessage &= " - Password must be at least 6 characters<br>"            End If            If Not txtPassword1.Text.Equals(txtPassword2.Text) Then                _errormessage &= " - Password not matched "            End If        End If        If radShipDifAddr.Checked Then            If txtShpFName.Text.Trim.Length = 0 Then                _errormessage &= " - Please enter your firstname[shipping]<br>"            End If            If txtShpLName.Text.Trim.Length = 0 Then                _errormessage &= " - Please enter your lastname[shipping]<br>"            End If            If txtShpStreet.Text.Trim.Length = 0 Then                _errormessage &= " - Please enter street[shipping]<br>"            End If            If txtShpCity.Text.Trim.Length = 0 Then                _errormessage &= " - Please enter city[shipping]<br>"            End If            If ddlShpState.SelectedValue.Length = 0 Then                _errormessage &= " - Please select state[shipping]<br>"            End If            If txtShpZipcode.Text.Trim.Length = 0 Then                _errormessage &= " - Please enter zipcode[shipping]<br>"            End If            If txtShpPhone.Text.Trim.Length = 0 Then                _errormessage &= " - Please enter phone[shipping]<br>"            End If        End If        If _errormessage <> "" Then            Return False        Else            Return True        End If    End Function

Is there anyone have an idea. Only server side validation is acceptable. Please help.... :)

Edited by aspnetguy
Link to comment
Share on other sites

hi, is this what you want.<asp:requiredfieldvalidator id="passReqVal" runat="server" ControlToValidate="txtboxname" ErrorMessage="missing password" Font-Size="10">* </asp:requiredfieldvalidator>// Collects all the error msg.<asp:validationsummary id="ValSum" Runat="server" Font-Size="10" DisplayMode="SingleParagraph" HeaderText="Please Enter "></asp:validationsummary>This kinda required field validation is fired when the page is postbacked.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...