Little Javascript validation script help please

Discussion in 'HTML & Website Design' started by stricksurfer, Jan 24, 2009.

  1. #1
    Can someone give me specific JavaScript code to check if the field Affiliatecode has the characters "http://" in it in the form code below? I can't understand how to validate this label and input name stuff... Please provide the head code too... I'm a newbie. Thanks...


    <form method="post" action="http://oi.vresp.com?fid=aa7d65ed2a" target="vr_optin_popup" onsubmit="window.open( 'http://www.verticalresponse.com', 'vr_optin_popup', 'scrollbars=yes,width=600,height=450' ); return true;" >

    <div style="font-family: verdana; font-size: 11px; width: 160px; padding: 10px; border: 1px solid #000000; background: #dddddd;">
    <strong><span style="color: #333333;">Sign Up Today!</span></strong>
    <p style="text-align: right; margin-top: 10px; margin-bottom: 10px;"><span style="color: #f00;">* </span><span style="color: #333333">required</span></p>
    <label style="color: #333333;">Email Address:</label> <span style="color: #f00">* </span>
    <br/>
    <input name="email_address" size="15" style="margin-top: 5px; margin-bottom: 5px; border: 1px solid #999; padding: 3px;"/>
    <br/>
    <label style="color: #333333;">Affiliate Code:</label>
    <br/>
    <input name="Affiliatecode" size="15" style="margin-top: 5px; margin-bottom: 5px; border: 1px solid #999; padding: 3px;"/>
    <br/>
    <input type="submit" value="Join Now" style="margin-top: 5px; border: 1px solid #999; padding: 3px;"/><br/>
    <br/><span style="color: #333333"><a href="http://www.verticalresponse.com" title="Email Marketing by VerticalResponse">Email Marketing</a> by VerticalResponse</span>
    </div>
    </form>
     
    stricksurfer, Jan 24, 2009 IP
  2. xcrox

    xcrox Banned

    Messages:
    232
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    use this function

    function isUrl(s) {
    	var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
    	return regexp.test(s);
    }
    Code (markup):
     
    xcrox, Jan 25, 2009 IP
  3. stricksurfer

    stricksurfer Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I don't understand this.... Help!
     
    stricksurfer, Jan 25, 2009 IP
  4. xcrox

    xcrox Banned

    Messages:
    232
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I hope you know basics of JS.
     
    xcrox, Jan 25, 2009 IP