Jump to content

Need Help on "simple user validation"

- - - - -

  • Please log in to reply
3 replies to this topic

#1
e4tmonkieshyt

e4tmonkieshyt

    Newbie

  • Members
  • Pip
  • 4 posts
Hi everyone,

I've got this project i'm working on, I just started learning asp.net. pretty much i got the layout done but am lost because i don't know how to do anything other than that.

Quote

Requirements

Develop an ASP.NET page with the HTML form with the following form fields:

First Name: required; max. 25
Last Name: required; max. 25
Company: max. 50
Phone: must be 10; must be numeric.
Email: max. 50; must be in email format.
Credit Card Number: required; Master started with 5, Visa 4, Amex 3; last group of Master and Visa 4 digits, Amex 3.
Expiration Date: required; must be in month and year format.

Use ASP.net requiredfieldvalidator to validate the required form fields and regex to validate the rest of the validation requirements.

Use regex to reject the following metachacaters for all form fields: ^ $ \ / ( ) | ? + * [ ] { } ><

the main thing i don't know how to do is the credit card portion and using regex to reject certain metacharacters. is there a drag and drop in visual studios for this or any tutorial instructing me how to do this?

Edited by e4tmonkieshyt, 05 June 2010 - 06:08 AM.


#2
l@mbd@

l@mbd@

    Newbie

  • Members
  • PipPip
  • 27 posts
[^whatever]

will match anything that is not these characters: w, h, a, t, e, v, e, and r

Drag and drop? you bet. In visual studio, it's under the *validators* portion of the controls toolbox.

#3
tjcool

tjcool

    Newbie

  • Members
  • PipPip
  • 18 posts
bro just limit the text box by setting
text box.maxlenth=25;
and Field Required validator.....
where
there is property fieldtovalidate=textbox1;
:closedeyes:

#4
gokuajmes

gokuajmes

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 518 posts
FirstName :
Drop a textbox into the form.Change ID to frstName.
Set the MaxLength property of frstName to 25 [to limit the user from typing more than 25 characters]
Drop a Required Field validator from the Validation Group of the Toolbox in Visual Studio & place it near to frstName.
Set the Property "Control to Validate" to frstName [select from drop down that appears when clicking Control to validate property].Also change the Text property to "Please type your First Name" and Display to "Dynamic"

Similarly do the same for, LastName,Company.

Phone Number:
Assume the textbox to be txtPhone.Drop a Regular expression validator near to the txtPhone.
Set the Validation Expression property to this "^[0-9]{10}$" without the quotes.

Similarly use Regular expression validator for Credi card and Date




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users