Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 4 of 4

Thread: form validation

  1. #1
    ashishchauhan is offline Junior Member
    Join Date
    Mar 2010
    Posts
    3

    Unhappy form validation

    Hi,

    I have been trying to validate this form in Topics .
    Can some one help me with this form ?

    http://www.brooomsticks.net/form_tag/form.zip
    Attached Files Attached Files

  2. #2
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    Can you tell us a bit about the problem you're having getting it to work? You should be able to model it after the contact us form topic, we do some validation in there.

  3. #3
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    Or, you can add a javascript function within your <div> tag that looks something like this:

    Code:
    <script type="text/javascript">
    function CheckFields()
    {
    var ergx = new RegExp(''\w+([-+.'']w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*''); 
    if(document.getElementById("MailName").value == "" || document.getElementById("MailPhone").value == "" || document.getElementById("MailEmail").value == "" || document.getElementById("MailSubject").value == "" || document.getElementById("MailMessage").value == "")
    {
    alert("Please complete entries.");
    return false;
    } 
    if(!ergx.test(document.getElementById("MailEmail").value))
    {
    alert("Invalid Email.");
    return false;
    }
    }
    </script>

  4. #4
    ashishchauhan is offline Junior Member
    Join Date
    Mar 2010
    Posts
    3

    Default Hi

    validation is working. how do i validate dropdown and radio buttons .

    i am using this code on submit button:


    <INPUT onclick="MM_validateForm('Name','','R','LastName', '','R','CompanyName','','R','EMail','','RisEmail', 'Address','','R','EnquiryMessage','','R');return document.MM_returnValue" value=Submit type=submit name=B1>