We help IT Professionals succeed at work.

ASP vb.net validation question

CPOINT2000
CPOINT2000 asked
on
Medium Priority
251 Views
Last Modified: 2012-05-11
I have written a VB net web program.  That does the validation in VB.  However this causes problem with screen re-draw.  My undesrtanding is I need to do this in client side, as a script?  I have numerous fields that check for content, size and in some cases content value is based on other fields on the form.

I have the following vb code for example field,
************************************************
        If mxorg = 0 Then
            If istextwflen(org.Text, 3) = False Then
                MsgBox("ORG can only be 3 character text value!")
                org.Focus()
            Else
                org.Text = UCase(org.Text)
            End If
        Else
            org.Text = "***"
        End If

************************************************
And the ASP side has this;
************************************************
                <td class="specialPanelPositionStyle">
   
                    <asp:TextBox ID="org" runat="server" CssClass="smalltxtbox"
                        MaxLength="3" ToolTip="Enter a 3 Character Origin value." CausesValidation="False">
                       
                        </asp:TextBox>    
                </td>
************************************************
I do not want the build in validation because that puts asterix and message on form.  I want a pop up box.  Do I do this in script? or is there some code I can write in ASP section as shown above?

Sorry if I am not clear.
Thanks
Comment
Watch Question

Top Expert 2011

Commented:
Why not do this on the database side?

Set up your fieldname and give it a character lenght of 3.

Then first of all, then this will look more like this:

                <td class="specialPanelPositionStyle">
   
                    <asp:TextBox ID="org" style="width: 3x;" runat="server" CssClass="smalltxtbox"
                        MaxLength="3" ToolTip="Enter a 3 Character Origin value." CausesValidation="False">
                        (max characther: 3)                      
                        </asp:TextBox>    
                </td>
Top Expert 2011
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks I will try this suggestion.  Actually size is not an issue, that is already setup on field.  I need to validate to make sure, it is text, or date, or numeric.  In some cases it has to allow blank and or values.  In some validations (for example date from/to field) need to validate field is valid yyyymmdd ad the from is prior to to date, to date is after from date, etc...  Instead of at time form is submitted I like to validate as field lost focus or is changed.  This is a vb program that is already been out for some time, which is being converted to web application, and I am trying to keep same functionality as possible as PC version.  That's why I am insisting on client side validation.  Reason I placed the ASP code there is that was generated by system for the field, I was trying to see if there was any code I could insert in there, case, if condition etc...  However I will try the script example you provided now.  Thanks

Author

Commented:
Thanks sorry got side tracked, just got back into code.  This worked.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.