Web Analytics Made Easy -
StatCounter Capturing data in MVC 5 (HTML & CSS) - CodingForum

Announcement

Collapse
No announcement yet.

Capturing data in MVC 5 (HTML & CSS)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Capturing data in MVC 5 (HTML & CSS)

    I'm in the process of refitting a web site in MVC. The site was previously created in ASP.NET and worked really well.

    Things are progressing nicely, but I've now got to the Contact page, which is where things are starting to go wrong. The contact page contains 8 data-capture fields, of which two are drop-down lists. Two of the fields are for telephone number and email address so there's a need for me to validate the contents of those accordingly. On top of this, those two fields (along with 2 others) must be completed before the user is able to proceed.

    In the ASP.NET version, the telephone number and email address fields were validated using Regular Expression validators, with the required fields being validated using Required Field validators. When the user clicks the Submit button, the code behind it uses the information to generate an email to the owner of the website.

    My questions are this:
    1. How do I code the MVC equivalent of the Regular Expression validators?
    2. How do I code the MVC equivalent of the Required Field validators?
    3. How do I code the MVC equivalent of the "code-behind" to generate the email?


    There is NO database associated with this website, and I'm quite keen to keep it that way. All of the reading I've done so far has suggested that I need to use a Model for this, but I'm not seeing how that's necessary if there's no plan to store the information in a database.

    TIA.
Working...
X